summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Demangle] Add a few more options to the microsoft demanglerMartin Storsjo2019-10-151-19/+30
| | | | | | | | | | | | | | | This corresponds to commonly used options to UnDecorateSymbolName within llvm. Add them as hidden options in llvm-undname. MS undname.exe takes numeric flags, corresponding to the UNDNAME_* constants, but instead of hardcoding in mappings for those numbers, just add textual options instead, as it the use of them here is primarily intended for testing. Differential Revision: https://reviews.llvm.org/D68917 llvm-svn: 374865
* llvm-undname: Delete an empty, unused method.Nico Weber2019-09-201-2/+0
| | | | llvm-svn: 372367
* llvm-undname: Correctly demangle vararg parametersNico Weber2019-06-041-0/+6
| | | | | | | FunctionSignatureNode already had an IsVariadic field, but it wasn't used anywhere yet. Set it and use it. llvm-svn: 362541
* llvm-undname: Several behavior-preserving changes to increase coverageNico Weber2019-06-041-5/+4
| | | | | | | | | | | | | | | | | - Replace `Error = true` in a few branches that are truly unreachable with DEMANGLE_UNREACHABLE - Remove early return early in startsWithLocalScopePattern() because it's redundant with the next two early returns - Remove unreachable `case '0'` (it's handled in the branch below) - Remove an unused bool return - Add test coverage for several early error returns, mostly in array type parsing llvm-svn: 362506
* llvm-undname: Support demangling char8_tNico Weber2019-05-281-0/+1
| | | | | | Ports clang's mangling support added in r354633 to llvm-undname. llvm-svn: 361839
* llvm-undname: Add support for local static thread guardsNico Weber2019-05-281-1/+4
| | | | llvm-svn: 361835
* llvm-undname: Support demangling the spaceship operatorNico Weber2019-04-231-2/+3
| | | | | | Also add a test for demanling the co_await operator. llvm-svn: 359007
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* NFC: Make the copies of the demangler byte-for-byte identicalErik Pilkington2019-01-171-1/+1
| | | | | | | | | | | | | | With this patch, the copies of the files ItaniumDemangle.h, StringView.h, and Utility.h are kept byte-for-byte in sync between libcxxabi and llvm. All differences (namespaces, fallthrough, and unreachable macros) are defined in each copies' DemanglerConfig.h. This patch also adds a script to copy changes from libcxxabi (cp-to-llvm.sh), and a README.txt explaining the situation. Differential revision: https://reviews.llvm.org/D53538 llvm-svn: 351474
* [llvm-undname] Add support for demangling msvc's noexcept types.Zachary Turner2019-01-081-0/+3
| | | | | | | | | | | Starting in C++17, MSVC introduced a new mangling for function parameters that are themselves noexcept functions. This patch makes llvm-undname properly demangle them. Patch by Zachary Henkel Differential Revision: https://reviews.llvm.org/D55769 llvm-svn: 350656
* [MS Demangler] Add a flag for dumping types without tag specifier.Zachary Turner2019-01-021-8/+10
| | | | | | | | Sometimes it's useful to be able to output demangled names without tag specifiers like "struct", "class", etc. This patch adds a flag enabling this. llvm-svn: 350241
* Add missing include file.Zachary Turner2018-12-171-0/+1
| | | | llvm-svn: 349363
* [MS Demangler] Add a helper function to print a Node as a string.Zachary Turner2018-12-171-0/+8
| | | | llvm-svn: 349359
* [MS Demangler] Print public:, protected:, private: if set in FunctionClass ↵Nico Weber2018-11-131-4/+15
| | | | | | | | | | | | or a variable's StorageClass. undname prints them, and the information is in the decorated name, so we probably shouldn't lose it when undecorating. I spot-checked a few of the funnier-looking outputs, and undname has the same output. Differential Revision: https://reviews.llvm.org/D54396 llvm-svn: 346791
* [MS demangler] Use a slightly shorter unmangling for mangled strings.Nico Weber2018-11-091-5/+4
| | | | | | | | | | Before: const wchar_t * {L"%"} Now: L"%" See also PR39593. Differential Revision: https://reviews.llvm.org/D54294 llvm-svn: 346544
* Fix clang -Wimplicit-fallthrough warnings across llvm, NFCReid Kleckner2018-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch should not introduce any behavior changes. It consists of mostly one of two changes: 1. Replacing fall through comments with the LLVM_FALLTHROUGH macro 2. Inserting 'break' before falling through into a case block consisting of only 'break'. We were already using this warning with GCC, but its warning behaves slightly differently. In this patch, the following differences are relevant: 1. GCC recognizes comments that say "fall through" as annotations, clang doesn't 2. GCC doesn't warn on "case N: foo(); default: break;", clang does 3. GCC doesn't warn when the case contains a switch, but falls through the outer case. I will enable the warning separately in a follow-up patch so that it can be cleanly reverted if necessary. Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu Differential Revision: https://reviews.llvm.org/D53950 llvm-svn: 345882
* [MS Demangler] Expose the Demangler AST publicly.Zachary Turner2018-11-011-1/+1
| | | | | | | | | LLDB would like to use this in order to build a clang AST from a mangled name. This is NFC otherwise. llvm-svn: 345837
* [MS Demangler] Fix several crashes and demangling bugs.Zachary Turner2018-08-291-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These bugs were found by writing a Python script which spidered the entire Chromium build directory tree demangling every symbol in every object file. At the start, the tool printed: Processed 27443 object files. 2926377/2936108 symbols successfully demangled (99.6686%) 9731 symbols could not be demangled (0.3314%) 14589 files crashed while demangling (53.1611%) After this patch, it prints: Processed 27443 object files. 41295518/41295617 symbols successfully demangled (99.9998%) 99 symbols could not be demangled (0.0002%) 0 files crashed while demangling (0.0000%) The issues fixed in this patch are: * Ignore empty parameter packs. Previously we would encounter a mangling for an empty parameter pack and add a null node to the AST. Since we don't print these anyway, we now just don't add anything to the AST and ignore it entirely. This fixes some of the crashes. * Account for "incorrect" string literal demanglings. Apparently an older version of clang would not truncate mangled string literals to 32 bytes of encoded character data. The demangling code however would allocate a 32 byte buffer thinking that it would not encounter more than this, and overrun the buffer. We now demangle up to 128 bytes of data, since the buggy clang would encode up to 32 *characters* of data. * Extended support for demangling init-fini stubs. If you had something like struct Foo { static vector<string> S; }; this would generate a dynamic atexit initializer *for the variable*. We didn't handle this, but now we print something nice. This is actually an improvement over undname, which will fail to demangle this at all. * Fixed one case of static this adjustment. We weren't handling several thunk codes so we didn't recognize the mangling. These are now handled. * Fixed a back-referencing problem. Member pointer templates should have their components considered for back-referencing The remaining 99 symbols which can't be demangled are all symbols which are compiler-generated and undname can't demangle either. llvm-svn: 341000
* Add support for various C++14 demanglings.Zachary Turner2018-08-291-2/+3
| | | | | | | | | | Mostly this includes <auto> and <decltype-auto> return values. Additionally, this fixes a fairly obscure back-referencing bug that was encountered in one of the C++14 tests, which is that if you have something like Foo<&bar, &bar> then the `bar` forms a backreference. llvm-svn: 340896
* [MS Demangler] Add output flags to all function calls.Zachary Turner2018-08-291-77/+90
| | | | | | | | | | | | Previously we had a FunctionSigFlags, but it's more flexible to just have one set of output flags that apply to the entire process and just pipe the entire set of flags through the output process. This will be useful when we start allowing the user to customize the outputting behavior. llvm-svn: 340894
* Fix this file to have the necessary standard library includes and useChandler Carruth2018-08-271-2/+2
| | | | | | the `std::` namespace. Should fix a number of build bots as well. llvm-svn: 340721
* [MS Demangler] Re-write the Microsoft demangler.Zachary Turner2018-08-271-0/+590
This is a pretty large refactor / re-write of the Microsoft demangler. The previous one was a little hackish because it evolved as I was learning about all the various edge cases, exceptions, etc. It didn't have a proper AST and so there was lots of custom handling of things that should have been much more clean. Taking what was learned from that experience, it's now re-written with a completely redesigned and much more sensible AST. It's probably still not perfect, but at least it's comprehensible now to someone else who wants to come along and make some modifications or read the code. Incidentally, this fixed a couple of bugs, so I've enabled the tests which now pass. llvm-svn: 340710
OpenPOWER on IntegriCloud