forked from OSchip/llvm-project
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
This commit is contained in:
parent
ddc9a06e95
commit
da298aa913
|
@ -158,6 +158,7 @@ private:
|
|||
QualifiedNameNode *QN);
|
||||
SymbolNode *demangleDeclarator(StringView &MangledName);
|
||||
SymbolNode *demangleMD5Name(StringView &MangledName);
|
||||
SymbolNode *demangleTypeinfoName(StringView &MangledName);
|
||||
|
||||
VariableSymbolNode *demangleVariableEncoding(StringView &MangledName,
|
||||
StorageClass SC);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -374,3 +374,8 @@
|
|||
; CHECK-EMPTY:
|
||||
; CHECK-NEXT: ??_P
|
||||
; CHECK-NEXT: error: Invalid mangled name
|
||||
|
||||
.?AUBase@@@8
|
||||
; CHECK-EMPTY:
|
||||
; CHECK-NEXT: .?AUBase@@@8
|
||||
; CHECK-NEXT: error: Invalid mangled name
|
||||
|
|
|
@ -209,6 +209,9 @@
|
|||
??_R0?AUBase@@@8
|
||||
; CHECK: struct Base `RTTI Type Descriptor'
|
||||
|
||||
.?AUBase@@
|
||||
; CHECK: struct Base `RTTI Type Descriptor Name'
|
||||
|
||||
??_R1A@?0A@EA@Base@@8
|
||||
; CHECK: Base::`RTTI Base Class Descriptor at (0, -1, 0, 64)'
|
||||
|
||||
|
|
Loading…
Reference in New Issue