Index: llvm/lib/Demangle/DLangDemangle.cpp =================================================================== --- llvm/lib/Demangle/DLangDemangle.cpp +++ llvm/lib/Demangle/DLangDemangle.cpp @@ -244,6 +244,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; Index: llvm/unittests/Demangle/DLangDemangleTest.cpp =================================================================== --- llvm/unittests/Demangle/DLangDemangleTest.cpp +++ llvm/unittests/Demangle/DLangDemangleTest.cpp @@ -36,5 +36,13 @@ std::make_pair("_D8demangle4testZ", "demangle.test"), std::make_pair("_D8demangle4test5test2Z", "demangle.test.test2"), std::make_pair("_D8demangle9anonymous0Z", "demangle.anonymous"), - std::make_pair("_D8demangle9anonymous03fooZ", - "demangle.anonymous.foo"))); + std::make_pair("_D8demangle9anonymous03fooZ", "demangle.anonymous.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")));