summaryrefslogtreecommitdiffstats
path: root/libcxxabi/src/cxa_demangle.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [demangler] Fix a bunch of -Wshadow warningsErik Pilkington2017-08-091-105/+105
| | | | | | These were causing failures in -Werror builds. llvm-svn: 310535
* [demangler] Improve representation of substitutions/templatesErik Pilkington2017-08-091-190/+264
| | | | | | Differential revision: https://reviews.llvm.org/D36427 llvm-svn: 310525
* [demangler] Rename some variables, NFCErik Pilkington2017-08-081-662/+662
| | | | llvm-svn: 310415
* [demangler] Fix another oss-fuzz bugErik Pilkington2017-08-061-1/+1
| | | | llvm-svn: 310226
* [demangler] Fix another bug found by oss-fuzz in r309340Erik Pilkington2017-08-011-0/+2
| | | | llvm-svn: 309650
* [demangler] Use _LIBCPP_UNREACHABLE()Erik Pilkington2017-08-011-2/+2
| | | | llvm-svn: 309649
* [demangler] Fix some bugs in r309340 found by oss-fuzzErik Pilkington2017-07-301-7/+20
| | | | llvm-svn: 309520
* [demangler] Fix some overzealous -Wreturn-type errorsErik Pilkington2017-07-281-0/+2
| | | | llvm-svn: 309349
* [demangler] Attempt to fix linux bots, include <cstdio>Erik Pilkington2017-07-281-0/+1
| | | | llvm-svn: 309342
* [demangler] Use an AST to represent demangled namesErik Pilkington2017-07-281-923/+1980
| | | | | | | | | | | | The demangler now demangles by producing an AST, then traverses that AST to produce a demangled name. This is done for performance reasons, now the demangler doesn't manuiplate std::strings, which hurt performance and caused string operations to be inlined into the parser, leading to large code size and stack usage. Differential revision: https://reviews.llvm.org/D35159 llvm-svn: 309340
* [demangler] Respect try_to_parse_template_argsErik Pilkington2017-07-131-10/+13
| | | | | | Fixes an exponential parse found by oss-fuzz. llvm-svn: 307941
* [Demangler] NFC: Don't make the parse_* functions templatesErik Pilkington2017-07-081-180/+117
| | | | | | Differential revision: https://reviews.llvm.org/D35158 llvm-svn: 307482
* [Demangler] NFC: Move Db struct to beginning of fileErik Pilkington2017-07-081-207/+206
| | | | | | Differential revision: https://reviews.llvm.org/D35158 llvm-svn: 307481
* Use _LIBCPP_FALLTHROUGH() to avoid warnings about [[gnu::fallthrough]] being ↵Eric Fiselier2017-06-151-1/+1
| | | | | | unsupported llvm-svn: 305500
* cxa_demangle: fix -Wimplicit-fallthrough for GCC:7Saleem Abdulrasool2017-06-111-1/+1
| | | | | | | Use the C++11 (formalised in C++17) tag to indicate a fallthrough in the switch case. Silences a -Wimplicit-fallthrough warning with gcc:7 llvm-svn: 305173
* [demangler] Fix a exponential string copying bugErik Pilkington2017-05-281-0/+4
| | | | | | | | | | | The problem was that if base_name() was called from a context without an actual base name, it could gulp up the entire string, which can result in recursive duplications. The fix is to be more strict as to what qualifies as a base name. Differential revision: https://reviews.llvm.org/D33637 llvm-svn: 304113
* [Demangler] Remove a failing assert introduced in r303718Erik Pilkington2017-05-241-3/+1
| | | | llvm-svn: 303806
* __cxa_demangle: Fix constructor cv qualifier handlingTamas Berghammer2017-05-241-0/+2
| | | | | | | | | | | | | | | | | Summary: Previously if we parsed a constructor then we set parsed_ctor_dtor_cv to true and never reseted it. This causes issue when a template argument references a constructor (e.g. type of lambda defined inside a constructor) as we will have the parsed_ctor_dtor_cv flag set what will cause issues when parsing later arguments. Reviewers: EricWF, compnerd Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33385 llvm-svn: 303737
* [demangler] Fix a crash in the demangler during parsing of a lamdbaErik Pilkington2017-05-241-23/+31
| | | | | | | | | The problem is that multiple types could have been parsed from parse_type(), which the lamdba parameter parsing didn't handle. Differential revision: https://reviews.llvm.org/D33368 llvm-svn: 303718
* [libc++abi] Disable libc++ extern templates project-wideShoaib Meenai2017-05-101-1/+0
| | | | | | | | | | | | | | libc++abi can't depend on libc++, so disable extern templates in libc++ headers project-wide. This was previously done in cxa_demangle.cpp, but I consider it more appropriate to do at the cmake level (since none of libc++abi's source files can use libc++ extern templates). I also think the _LIBCPP_NO_EXCEPTIONS in cxa_demangle.cpp is suspicious, but I'm doing one thing at a time. Differential Revision: https://reviews.llvm.org/D32329 llvm-svn: 302739
* Add support for demangling C++11 thread_local variables. In clang, the ↵David Bozier2017-01-311-0/+24
| | | | | | grammar for mangling for these names are "<special-name> ::= TW <object name>" for wrapper variables or "<special-name> ::= TH <object name>" for initialization variables. llvm-svn: 293638
* Fix ASAN failure in cxa_demangleMehdi Amini2017-01-271-1/+2
| | | | | | Found with ASAN + libFuzzer by Kostya Serebryany <kcc@google.com> llvm-svn: 293330
* cxa_demangle: fix rvalue ref checkSaleem Abdulrasool2017-01-241-1/+2
| | | | | | | | | | | | When checking if the type is a r-value ref, we would not do a complete check. This would result in us treating a trailing parameter reference `&)` as a r-value ref, and improperly inject the cv qualifier on the type. We now correctly demangle the type `KFvRmE` as a constant function rather than a constant reference. Fixes PR31741! llvm-svn: 292973
* cxa_demangle: avoid butchering the last parameter typeSaleem Abdulrasool2017-01-241-2/+2
| | | | | | | | | | | Fix an off-by-one case which would destroy the final parameter in a CV-qualified function type with a reference. We still get the CV qualification incorrect, but at least we do not clobber the type name any longer. Partially fixes PR31741. llvm-svn: 292963
* Revert r286788Jonathan Roelofs2017-01-181-11/+1
| | | | | | | | | | | | | | | | The Itanium ABI [1] specifies that __cxa_demangle accept either: 1) symbol names, which start with "_Z" 2) type manglings, which do not start with "_Z" r286788 erroneously assumes that it should only handle symbols, so this patch reverts it and adds a counterexample to the testcase. 1: https://mentorembedded.github.io/cxx-abi/abi.html#demangler Reviewers: zygoloid, EricWF llvm-svn: 292418
* clean up `-Wmisleading-indentation` warningSaleem Abdulrasool2016-12-311-2/+2
| | | | | | Clean up the misleading indentation warning from GCC 6. NFC llvm-svn: 290788
* __cxa_demangle: use default member initializationSaleem Abdulrasool2016-11-181-14/+7
| | | | | | | | Sink the Db initialization into the structure rather than out-of-line at the declaration size. This just makes it easier to see what initialization is being performed. NFC. llvm-svn: 287364
* __cxa_demangle: allow demangling invocation blocksSaleem Abdulrasool2016-11-141-4/+7
| | | | | | | | | | | | The block invocation function uses an extension where the prefix is ___Z as opposed to _Z. This should make the tests pass again. Disable a negative test which was testing a crasher. The symbol being demangled is not a valid mangled symbol and will return a nullptr. Adjust the type info decoding test to be a valid symbol name. llvm-svn: 286793
* __cxa_demangle: ensure that we have a mangled symbolSaleem Abdulrasool2016-11-141-1/+9
| | | | | | | | | | | | Ensure that we have a mangled symbol before attempting to demangle it. We would previously treat any input as a mangled symbol rather than checking that the symbol has the initial C++ Itanium v3 mangling prefix of `_Z`. This changes the behaviour from the previous case which would undecorate `f` to `float` rather than nullptr as it should. Unfortunately, we do not have any negative testing for the demangler. llvm-svn: 286788
* Fix ASAN failures in the demanglerMehdi Amini2016-08-131-11/+56
| | | | | | These were found fuzzing with ASAN. llvm-svn: 278579
* [libcxxabi] Teach cxa_demangle about Hexagon's long double sizeBen Craig2016-01-201-1/+1
| | | | | | | cxa_demangle's default size for a long double is 10 bytes. Hexagon only has an 8 byte long double though. llvm-svn: 258313
* [WebAssembly] Accomodate wasm's 128-bit long double.Dan Gohman2016-01-131-1/+2
| | | | llvm-svn: 257614
* ibc++abi: mark visibilitySaleem Abdulrasool2015-12-041-1/+3
| | | | | | | | | Mark functions and types with the appropriate visibility. This is particularly useful for environments which explicitly indicate origin of functions (Windows). This aids in generating libc++abi as a DSO which exposes only the public interfaces. llvm-svn: 254691
* c++abi: whitespace adjustmentSaleem Abdulrasool2015-12-041-5/+2
| | | | | | | Cleanup some code with clang-format to make the following change easier to identify material difference. NFC. llvm-svn: 254690
* Fix Bug 25103 - _cxa_demangle improperly demangles virtual thunks. Thanks to ↵Marshall Clow2015-10-121-1/+1
| | | | | | Jason King for the report and suggested fix llvm-svn: 250097
* Fix incorrect parsing of arguments for nested functions. Reviewed as ↵Marshall Clow2015-10-081-2/+3
| | | | | | http://reviews.llvm.org/D13192. Thanks to Anseny Kapoulkine for the patch. llvm-svn: 249649
* Let cxa_demangle.cpp compile with gcc/libstdc++ 4.8 and clang-cl/MSVC2013's STL.Nico Weber2015-09-201-0/+24
| | | | | | | libstdc++ needs a few typedefs in malloc_alloc. MSVC's STL needs rebind(), construct(), destroy(). MSVC2013 also has no snprintf, but it exists in 2015. llvm-svn: 248129
* [AArch64] Quick fix for cxa demanglerRenato Golin2015-08-191-1/+1
| | | | | | | | | This makes all libcxxabi tests pass on AArch64. Further changes and new tests to come. Patch by Keith Walker. llvm-svn: 245449
* [libcxxabi][mips] Correct float_data::mangled_size for all ABI's.Daniel Sanders2015-07-301-1/+3
| | | | | | | | | | | | | | Summary: Patch by Nitesh Jain and Jaydeep Patil with a small revision to use ABIs rather than Architecture Revisions (which currently imply particular ABIs). Fixes test_demangle.pass.cpp (PR24149). Subscribers: mclow.lists, jaydeep, nitesh.jain, hans, cfe-commits Differential Revision: http://reviews.llvm.org/D11483 llvm-svn: 243645
* Make sure !empty() before calling String::front().Chaoren Lin2015-05-261-4/+7
| | | | | | | | | | Reviewers: howard.hinnant Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9954 llvm-svn: 238263
* libc++abi: remove unused variableSaleem Abdulrasool2015-04-271-2/+1
| | | | | | | The externC variable was set but unused. This constantly flagged a warning from gcc. Replace it with a comment until such a time that we need it. llvm-svn: 235830
* libc++abi: silence some warningsSaleem Abdulrasool2015-04-271-1/+1
| | | | | | | | | Cleans up the -Wundef warning caused by the use of the __LITTLE_ENDIAN__ macro. Instead use `__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__`. `__BYTE_ORDER__` is defined by GCC since 4.2 and by clang. This avoids the undef case where a macro may be undefined. This has previously caught real errors in libunwind. llvm-svn: 235828
* Don't print debugging messages to stdout.Ed Schouten2015-03-191-18/+18
| | | | | | | | | | There is some debugging code in cxa_demangle.cpp that prints messages on stdout. In general this is not safe, as the program itself may use stdout to write its output. Change this code to write to stderr. Differential Revision: http://reviews.llvm.org/D8167 llvm-svn: 232716
* Fix build with GCC:Nick Lewycky2015-03-051-1/+1
| | | | | | | | - GCC doesn't support #pragma mark, only Apple GCC and clang. Wrap the pragma mark's in #if 0 to make gcc ignore them but xcode still see them. - Wrap a bunch of "#pragma clang" lines in #ifdef __clang__. - Pacify gcc's -Wparenthesis in a case where it's quite reasonable. llvm-svn: 231344
* Minor libc++abi changes to make things build better with gcc.Nico Weber2014-06-251-1/+1
| | | | llvm-svn: 211748
* Let libc++abi compile with gcc.Nico Weber2014-05-301-11/+12
| | | | | | | | | | | | | | There was a single problem in cxa_demangle.cpp, where gcc would complain `error: changes meaning of 'String'` about the line `typedef String String;`. According to 3.3.7p2, this diagnostic is allowed (but not required, so clang does not have to report this). As a fix, make string_pair a template and pass String as template parameter. This fixes the error with gcc and also removes some repetition from the code. No behavior change. llvm-svn: 209909
* PR19091: Track whether we're demangling a function template specialization toRichard Smith2014-05-121-11/+29
| | | | | | | determine whether we get a mangling for a return type, rather than trying to figure it out based on whether the mangled name ended with a '>'. llvm-svn: 208611
* Implement ARM EHABI exception handling.Logan Chien2014-05-101-0/+4
| | | | | | | This commit implements the ARM zero-cost exception handling support for libc++abi. llvm-svn: 208466
* Demangle Dc to decltype(auto) as per the Itanium C++ ABI spec.Anders Carlsson2014-02-171-0/+5
| | | | llvm-svn: 201533
* Implement demangling for user-defined operators.Howard Hinnant2014-01-061-0/+13
| | | | llvm-svn: 198643
OpenPOWER on IntegriCloud