[PATCH] D114309: [Demangle] Add support for D function-local parent symbols
Luís Ferreira via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 6 17:48:46 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG83087c096af9: [Demangle] Add support for D function-local parent symbols (authored by ljmf00).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114309/new/
https://reviews.llvm.org/D114309
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
@@ -45,4 +45,6 @@
std::make_pair("_D8demangle4test11__InterfaceZ",
"Interface for demangle.test"),
std::make_pair("_D8demangle4test12__ModuleInfoZ",
- "ModuleInfo for demangle.test")));
+ "ModuleInfo for demangle.test"),
+ std::make_pair("_D8demangle4__S14testZ", "demangle.test"),
+ std::make_pair("_D8demangle4__Sd4testZ", "demangle.__Sd.test")));
Index: llvm/lib/Demangle/DLangDemangle.cpp
===================================================================
--- llvm/lib/Demangle/DLangDemangle.cpp
+++ llvm/lib/Demangle/DLangDemangle.cpp
@@ -242,6 +242,23 @@
// TODO: Parse template instances with a length prefix.
+ // There can be multiple different declarations in the same function that
+ // have the same mangled name. To make the mangled names unique, a fake
+ // parent in the form `__Sddd' is added to the symbol.
+ if (Len >= 4 && Mangled[0] == '_' && Mangled[1] == '_' && Mangled[2] == 'S') {
+ const char *NumPtr = Mangled + 3;
+ while (NumPtr < (Mangled + Len) && std::isdigit(*NumPtr))
+ ++NumPtr;
+
+ if (Mangled + Len == NumPtr) {
+ // Skip over the fake parent.
+ Mangled += Len;
+ return parseIdentifier(Demangled, Mangled);
+ }
+
+ // Else demangle it as a plain identifier.
+ }
+
return parseLName(Demangled, Mangled, Len);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114309.392247.patch
Type: text/x-patch
Size: 1623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211207/5f1b911a/attachment.bin>
More information about the llvm-commits
mailing list