summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-09-23 13:13:37 +0000
committerNico Weber <nicolasweber@gmx.de>2019-09-23 13:13:37 +0000
commitda298aa913754eb70cf2dc8fac0ed6b5ae72cfe9 (patch)
tree7d8eefdba856dacabaf178385744bcad1b829323 /llvm/lib
parentddc9a06e95db3b0d81f1954edae4b04d385f5866 (diff)
downloadbcm5719-llvm-da298aa913754eb70cf2dc8fac0ed6b5ae72cfe9.tar.gz
bcm5719-llvm-da298aa913754eb70cf2dc8fac0ed6b5ae72cfe9.zip
llvm-undname: Add support for demangling typeinfo names
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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Demangle/MicrosoftDemangle.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp
index bf7d77638f3..4be6e5a233b 100644
--- a/llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -783,8 +783,26 @@ SymbolNode *Demangler::demangleMD5Name(StringView &MangledName) {
return S;
}
+SymbolNode *Demangler::demangleTypeinfoName(StringView &MangledName) {
+ assert(MangledName.startsWith('.'));
+ MangledName.consumeFront('.');
+
+ TypeNode *T = demangleType(MangledName, QualifierMangleMode::Result);
+ if (Error || !MangledName.empty()) {
+ Error = true;
+ return nullptr;
+ }
+ return synthesizeVariable(Arena, T, "`RTTI Type Descriptor Name'");
+}
+
// Parser entry point.
SymbolNode *Demangler::parse(StringView &MangledName) {
+ // Typeinfo names are strings stored in RTTI data. They're not symbol names.
+ // It's still useful to demangle them. They're the only demangled entity
+ // that doesn't start with a "?" but a ".".
+ if (MangledName.startsWith('.'))
+ return demangleTypeinfoName(MangledName);
+
if (MangledName.startsWith("??@"))
return demangleMD5Name(MangledName);
OpenPOWER on IntegriCloud