aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Demangle
AgeCommit message (Collapse)AuthorFilesLines
2021-07-14Demangle: correct swift_async demangling for Microsoft schemeSaleem Abdulrasool1-1/+1
The emission was corrected for the swift_async calling convention but the demangling support was not. This repairs the demangling support as well.
2021-07-09[Clang] Introduce Swift async calling convention.Varun Gandhi2-0/+5
This change is intended as initial setup. The plan is to add more semantic checks later. I plan to update the documentation as more semantic checks are added (instead of documenting the details up front). Most of the code closely mirrors that for the Swift calling convention. Three places are marked as [FIXME: swiftasynccc]; those will be addressed once the corresponding convention is introduced in LLVM. Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D95561
2021-06-23[Demangle][Rust] Hide implementation details NFCTomasz Miąsko1-12/+205
Move content of the "public" header into the implementation file. This also renames two enumerations that were previously used through `rust_demangle::` scope, to avoid breaking a build bot with older version of GCC that rejects uses of enumerator through `E::A` if there is a variable with the same name as enumeration `E` in the scope. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D104362
2021-06-18[Demangle][Rust] Parse dot suffixTomasz Miąsko1-1/+9
Allow mangled names to include an arbitrary dot suffix, akin to vendor specific suffix in Itanium mangling. Primary motivation is a support for symbols renamed during ThinLTO import / promotion (ThinLTO is the default configuration for optimized builds in rustc). Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D104358
2021-06-17[Demangle] Support Rust v0 mangling scheme in llvm::demangleTomasz Miąsko1-0/+7
The llvm::demangle is currently used by llvm-objdump and llvm-readobj, so this effectively adds support for Rust v0 mangling to those applications. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D104340
2021-06-08[Demangle][Rust] Parse const backreferencesTomasz Miąsko1-2/+10
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D103848
2021-06-08[Demangle][Rust] Parse type backreferencesTomasz Miąsko1-1/+9
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D103847
2021-06-08[Demangle][Rust] Parse path backreferencesTomasz Miąsko1-1/+5
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D103459
2021-06-07[Demangle][Rust] Parse instantiating crateTomasz Miąsko1-1/+4
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D103460
2021-06-07[Demangle][Rust] Parse dyn-trait-assoc-bindingTomasz Miąsko1-6/+26
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D103364
2021-06-07[Demangle][Rust] Parse dyn-traitTomasz Miąsko1-3/+12
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D103361
2021-06-07[Demangle][Rust] Parse dyn-boundsTomasz Miąsko1-0/+21
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D103151
2021-06-02[Demangle][Rust] Parse bindersTomasz Miąsko1-10/+73
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102729
2021-05-22[Demangle][Rust] Parse function signaturesTomasz Miąsko1-0/+44
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102581
2021-05-22[Demangle][Rust] Parse referencesTomasz Miąsko1-0/+10
Reviewed By: dblaikie Part of https://reviews.llvm.org/D102580
2021-05-22[Demangle][Rust] Parse raw pointersTomasz Miąsko1-0/+8
Reviewed By: dblaikie Part of https://reviews.llvm.org/D102580
2021-05-19[Demangle][Rust] Speculative fix for bot build failureTomasz Miąsko1-5/+5
> error: ‘InType’ is not a class, namespace, or enumeration
2021-05-19[Demangle][Rust] Parse tuplesTomasz Miąsko1-0/+13
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102579
2021-05-19[Demangle][Rust] Parse slice typeTomasz Miąsko1-0/+5
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102578
2021-05-19[Demangle][Rust] Parse array typeTomasz Miąsko1-5/+17
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102573
2021-05-19[Demangle][Rust] Parse named typesTomasz Miąsko1-15/+23
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102571
2021-05-15[Demangle][Rust] Parse trait definitionsTomasz Miąsko1-0/+8
Part of https://reviews.llvm.org/D102549
2021-05-15[Demangle][Rust] Parse trait implementationsTomasz Miąsko1-0/+9
Part of https://reviews.llvm.org/D102549
2021-05-15[Demangle][Rust] Parse inherent implementationsTomasz Miąsko1-0/+16
Part of https://reviews.llvm.org/D102549
2021-05-15[Demangle][Rust] Parse char constantsTomasz Miąsko1-1/+52
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102524
2021-05-15[Demangle][Rust] Parse bool constantsTomasz Miąsko1-1/+17
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102518
2021-05-14[Demangle][Rust] Parse integer constantsTomasz Miąsko1-38/+236
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102179
2021-05-10[Demangle][Rust] Parse basic typesTomasz Miąsko1-0/+97
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102142
2021-05-09[Demangle][Rust] Print special namespacesTomasz Miąsko1-15/+34
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D101821
2021-05-03[demangler] Initial support for the new Rust mangling schemeTomasz Miąsko2-0/+277
Add a demangling support for a small subset of a new Rust mangling scheme, with complete support planned as a follow up work. Intergate Rust demangling into llvm-cxxfilt and use llvm-cxxfilt for end-to-end testing. The new Rust mangling scheme uses "_R" as a prefix, which makes it easy to disambiguate it from other mangling schemes. The public API is modeled after __cxa_demangle / llvm::itaniumDemangle, since potential candidates for further integration use those. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D101444
2021-04-22Fix memory leak in MicrosoftDemangleNodes's Node::toStringRaphael Isemann1-1/+3
The buffer we turn into a std::string here is malloc'd and should be free'd before we return from this function. Follow up to LLDB leak fixes such as D100806. Reviewed By: mstorsjo, rupprecht, MaskRay Differential Revision: https://reviews.llvm.org/D100843
2021-01-27[Demangle] Support demangling Swift calling convention in MS demangler.Varun Gandhi2-0/+5
Previously, Clang was able to mangle the Swift calling convention but 'MicrosoftDemangle.cpp' was not able to demangle it. Reviewed By: compnerd, rnk Differential Revision: https://reviews.llvm.org/D95053
2021-01-14[llvm] Remove redundant return and continue statements (NFC)Kazu Hirata1-1/+0
Identified with readability-redundant-control-flow.
2020-11-13llvmbuildectomy - replace llvm-build by plain cmakeserge-sans-paille2-20/+1
No longer rely on an external tool to build the llvm component layout. Instead, leverage the existing `add_llvm_componentlibrary` cmake function and introduce `add_llvm_component_group` to accurately describe component behavior. These function store extra properties in the created targets. These properties are processed once all components are defined to resolve library dependencies and produce the header expected by llvm-config. Differential Revision: https://reviews.llvm.org/D90848
2020-07-20[NFC] Use std::free instead of ::freeLouis Dionne1-1/+1
Since we include <cstdlib> instead of <stdlib.h>, it makes sense to use std::free.
2020-05-20Give microsoftDemangle() an outparam for how many input bytes were consumed.Nico Weber2-4/+7
Demangling Itanium symbols either consumes the whole input or fails, but Microsoft symbols can be successfully demangled with just some of the input. Add an outparam that enables clients to know how much of the input was consumed, and use this flag to give llvm-undname an opt-in warning on partially consumed symbols. Differential Revision: https://reviews.llvm.org/D80173
2020-02-11Use std::foo_t rather than std::foo in LLVM.Justin Lebar1-4/+2
Summary: C++14 migration. No functional change. Reviewers: bkramer, JDevlieghere, lebedev.ri Subscribers: MatzeB, hiraditya, jkorous, dexonsmith, arphaman, kadircet, lebedev.ri, usaxena95, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D74384
2019-12-04Revert "Add some missing includes to MicrosoftDemangle.cpp (PR44217)"David Blaikie1-2/+0
This reverts commit 9b962d83ece841e43fd2823375dc6ddc94c1b178. This didn't address the underlying issue (in MicrosoftDemangleNodes.h) that was fixed 6 months ago anyway.
2019-12-04Add some missing includes to MicrosoftDemangle.cpp (PR44217)David Blaikie1-0/+2
2019-11-21[cmake] Explicitly mark libraries defined in lib/ as "Component Libraries"Tom Stellard1-1/+1
Summary: Most libraries are defined in the lib/ directory but there are also a few libraries defined in tools/ e.g. libLLVM, libLTO. I'm defining "Component Libraries" as libraries defined in lib/ that may be included in libLLVM.so. Explicitly marking the libraries in lib/ as component libraries allows us to remove some fragile checks that attempt to differentiate between lib/ libraries and tools/ libraires: 1. In tools/llvm-shlib, because llvm_map_components_to_libnames(LIB_NAMES "all") returned a list of all libraries defined in the whole project, there was custom code needed to filter out libraries defined in tools/, none of which should be included in libLLVM.so. This code assumed that any library defined as static was from lib/ and everything else should be excluded. With this change, llvm_map_components_to_libnames(LIB_NAMES, "all") only returns libraries that have been added to the LLVM_COMPONENT_LIBS global cmake property, so this custom filtering logic can be removed. Doing this also fixes the build with BUILD_SHARED_LIBS=ON and LLVM_BUILD_LLVM_DYLIB=ON. 2. There was some code in llvm_add_library that assumed that libraries defined in lib/ would not have LLVM_LINK_COMPONENTS or ARG_LINK_COMPONENTS set. This is only true because libraries defined lib lib/ use LLVMBuild.txt and don't set these values. This code has been fixed now to check if the library has been explicitly marked as a component library, which should now make it easier to remove LLVMBuild at some point in the future. I have tested this patch on Windows, MacOS and Linux with release builds and the following combinations of CMake options: - "" (No options) - -DLLVM_BUILD_LLVM_DYLIB=ON - -DLLVM_LINK_LLVM_DYLIB=ON - -DBUILD_SHARED_LIBS=ON - -DBUILD_SHARED_LIBS=ON -DLLVM_BUILD_LLVM_DYLIB=ON - -DBUILD_SHARED_LIBS=ON -DLLVM_LINK_LLVM_DYLIB=ON Reviewers: beanz, smeenai, compnerd, phosek Reviewed By: beanz Subscribers: wuzish, jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, mgorny, mehdi_amini, sbc100, jgravelle-google, hiraditya, aheejin, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, PkmX, jocewei, jsji, dang, Jim, lenary, s.egerton, pzheng, sameer.abuasal, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70179
2019-11-04[demangle] NFC: get rid of NodeOrStringErik Pilkington1-8/+0
This class was a bit overengineered, and was triggering some PVS warnings. Instead, put strings into a NameType and let clients unconditionally treat it as a Node.
2019-10-15[Demangle] Add a few more options to the microsoft demanglerMartin Storsjo2-20/+41
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
2019-10-02Fix uninitialized variable warning. NFCI.Simon Pilgrim1-1/+1
llvm-svn: 373450
2019-09-23llvm-undname: Add support for demangling typeinfo namesNico Weber1-0/+18
typeinfo names aren't symbols but string constant contents stored in compiler-generated typeinfo objects, but llvm-cxxfilt can demangle these for Itanium names. In the MSVC ABI, these are just a '.' followed by a mangled type -- this means they don't start with '?' like all MS-mangled symbols do. Differential Revision: https://reviews.llvm.org/D67851 llvm-svn: 372602
2019-09-20llvm-undname: Delete an empty, unused method.Nico Weber1-2/+0
llvm-svn: 372367
2019-09-07Synchronize LLVM's copy of libc++abi's demangler with the libc++abiRichard Smith1-0/+10
version after r371273. Also fix a minor issue in r371273 that only surfaced after template instantiation from LLVM's use of the demangler. llvm-svn: 371274
2019-06-04llvm-undname: Correctly demangle vararg parametersNico Weber2-5/+10
FunctionSignatureNode already had an IsVariadic field, but it wasn't used anywhere yet. Set it and use it. llvm-svn: 362541
2019-06-04llvm-undname: More coverage-related cleanupsNico Weber1-11/+9
- The loop in demangleFunctionParameterList() only exits on Error, @, and Z. All 3 cases were handled, so the rest of the function is DEMANGLE_UNREACHABLE. - The loop in demangleTemplateParameterList() always returns on Error, so there's no need to check for that in the loop header and after the loop. - Add test cases for invalid function parameter manglings. - Add a (redundant) test case for a simple template parameter list mangling. - Add a test case pointing out that varargs functions aren't demangled correctly. llvm-svn: 362540
2019-06-04llvm-undname: Add test coverage for demangleInitFiniStub()Nico Weber1-2/+2
llvm-svn: 362536
2019-06-04llvm-undname: Yet more coverage for error pathsNico Weber1-3/+8
- For error returns in demangleSpecialTableNode(), demangleLocalStaticGuard(), RTTITypeDescriptor, demangleRttiBaseClassDescriptorNode(), demangleUnsigned(), demangleUntypedVariable() (via RttiBaseClassArray) - For ?_A and ?_P which are handled at early levels of the demangler but are not implemented in a later stage; this is now more obvious - Replace a "default:" with an explicit list of cases, to get -Wswitch check we list all cases llvm-svn: 362520