[PATCH] D114308: [Demangle] Add support for D special identifiers
Luís Ferreira via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 6 17:48:42 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8a7ddf9e2296: [Demangle] Add support for D special identifiers (authored by ljmf00).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114308/new/
https://reviews.llvm.org/D114308
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
@@ -36,4 +36,13 @@
std::make_pair("_D8demangle4testZ", "demangle.test"),
std::make_pair("_D8demangle4test5test2Z", "demangle.test.test2"),
std::make_pair("_D8demangle4test0Z", "demangle.test"),
- std::make_pair("_D8demangle4test03fooZ", "demangle.test.foo")));
+ std::make_pair("_D8demangle4test03fooZ", "demangle.test.foo"),
+ std::make_pair("_D8demangle4test6__initZ",
+ "initializer for demangle.test"),
+ std::make_pair("_D8demangle4test6__vtblZ", "vtable for demangle.test"),
+ std::make_pair("_D8demangle4test7__ClassZ",
+ "ClassInfo for demangle.test"),
+ std::make_pair("_D8demangle4test11__InterfaceZ",
+ "Interface for demangle.test"),
+ std::make_pair("_D8demangle4test12__ModuleInfoZ",
+ "ModuleInfo for demangle.test")));
Index: llvm/lib/Demangle/DLangDemangle.cpp
===================================================================
--- llvm/lib/Demangle/DLangDemangle.cpp
+++ llvm/lib/Demangle/DLangDemangle.cpp
@@ -247,6 +247,55 @@
const char *Demangler::parseLName(OutputBuffer *Demangled, const char *Mangled,
unsigned long Len) {
+ switch (Len) {
+ case 6:
+ if (strncmp(Mangled, "__initZ", Len + 1) == 0) {
+ // The static initializer for a given symbol.
+ Demangled->prepend("initializer for ");
+ Demangled->setCurrentPosition(Demangled->getCurrentPosition() - 1);
+ Mangled += Len;
+ return Mangled;
+ }
+ if (strncmp(Mangled, "__vtblZ", Len + 1) == 0) {
+ // The vtable symbol for a given class.
+ Demangled->prepend("vtable for ");
+ Demangled->setCurrentPosition(Demangled->getCurrentPosition() - 1);
+ Mangled += Len;
+ return Mangled;
+ }
+ break;
+
+ case 7:
+ if (strncmp(Mangled, "__ClassZ", Len + 1) == 0) {
+ // The classinfo symbol for a given class.
+ Demangled->prepend("ClassInfo for ");
+ Demangled->setCurrentPosition(Demangled->getCurrentPosition() - 1);
+ Mangled += Len;
+ return Mangled;
+ }
+ break;
+
+ case 11:
+ if (strncmp(Mangled, "__InterfaceZ", Len + 1) == 0) {
+ // The interface symbol for a given class.
+ Demangled->prepend("Interface for ");
+ Demangled->setCurrentPosition(Demangled->getCurrentPosition() - 1);
+ Mangled += Len;
+ return Mangled;
+ }
+ break;
+
+ case 12:
+ if (strncmp(Mangled, "__ModuleInfoZ", Len + 1) == 0) {
+ // The ModuleInfo symbol for a given module.
+ Demangled->prepend("ModuleInfo for ");
+ Demangled->setCurrentPosition(Demangled->getCurrentPosition() - 1);
+ Mangled += Len;
+ return Mangled;
+ }
+ break;
+ }
+
*Demangled << StringView(Mangled, Len);
Mangled += Len;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114308.392245.patch
Type: text/x-patch
Size: 3059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211207/808a4a9b/attachment-0001.bin>
More information about the llvm-commits
mailing list