[PATCH] D114307: [Demangle] Add support for D anonymous symbols
Luís Ferreira via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 19 19:14:27 PST 2021
ljmf00 created this revision.
ljmf00 added a project: LLVM.
Herald added a subscriber: hiraditya.
ljmf00 requested review of this revision.
Herald added a subscriber: llvm-commits.
Anonymous symbols are represented by 0 in the mangled symbol. We should skip
them in order to represent the demangled name correctly, otherwise demangled
names like `demangle..anon` can happen.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114307
Files:
llvm/lib/Demangle/DLangDemangle.cpp
llvm/unittests/Demangle/DLangDemangleTest.cpp
Index: llvm/unittests/Demangle/DLangDemangleTest.cpp
===================================================================
--- llvm/unittests/Demangle/DLangDemangleTest.cpp
+++ llvm/unittests/Demangle/DLangDemangleTest.cpp
@@ -34,4 +34,7 @@
std::make_pair("_D88", nullptr),
std::make_pair("_D8demangleZ", "demangle"),
std::make_pair("_D8demangle4testZ", "demangle.test"),
- std::make_pair("_D8demangle4test5test2Z", "demangle.test.test2")));
+ std::make_pair("_D8demangle4test5test2Z", "demangle.test.test2"),
+ std::make_pair("_D8demangle9anonymous0Z", "demangle.anonymous"),
+ std::make_pair("_D8demangle9anonymous03fooZ",
+ "demangle.anonymous.foo")));
Index: llvm/lib/Demangle/DLangDemangle.cpp
===================================================================
--- llvm/lib/Demangle/DLangDemangle.cpp
+++ llvm/lib/Demangle/DLangDemangle.cpp
@@ -199,6 +199,15 @@
size_t N = 0;
do {
+ // Skip over anonymous symbols.
+ if (*Mangled == '0') {
+ do
+ ++Mangled;
+ while (*Mangled == '0');
+
+ continue;
+ }
+
if (N++)
*Demangled << '.';
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114307.388679.patch
Type: text/x-patch
Size: 1167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211120/81eca7b8/attachment.bin>
More information about the llvm-commits
mailing list