[PATCH] D67851: llvm-undname: Add support for demangling typeinfo names
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 06:11:54 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372602: llvm-undname: Add support for demangling typeinfo names (authored by nico, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D67851?vs=221076&id=221315#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67851/new/
https://reviews.llvm.org/D67851
Files:
llvm/trunk/include/llvm/Demangle/MicrosoftDemangle.h
llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
llvm/trunk/test/Demangle/invalid-manglings.test
llvm/trunk/test/Demangle/ms-operators.test
Index: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
===================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
@@ -783,8 +783,26 @@
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);
Index: llvm/trunk/include/llvm/Demangle/MicrosoftDemangle.h
===================================================================
--- llvm/trunk/include/llvm/Demangle/MicrosoftDemangle.h
+++ llvm/trunk/include/llvm/Demangle/MicrosoftDemangle.h
@@ -158,6 +158,7 @@
QualifiedNameNode *QN);
SymbolNode *demangleDeclarator(StringView &MangledName);
SymbolNode *demangleMD5Name(StringView &MangledName);
+ SymbolNode *demangleTypeinfoName(StringView &MangledName);
VariableSymbolNode *demangleVariableEncoding(StringView &MangledName,
StorageClass SC);
Index: llvm/trunk/test/Demangle/invalid-manglings.test
===================================================================
--- llvm/trunk/test/Demangle/invalid-manglings.test
+++ llvm/trunk/test/Demangle/invalid-manglings.test
@@ -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
Index: llvm/trunk/test/Demangle/ms-operators.test
===================================================================
--- llvm/trunk/test/Demangle/ms-operators.test
+++ llvm/trunk/test/Demangle/ms-operators.test
@@ -209,6 +209,9 @@
??_R0?AUBase@@@8
; CHECK: struct Base `RTTI Type Descriptor'
+.?AUBase@@
+; CHECK: struct Base `RTTI Type Descriptor Name'
+
??_R1A@?0A at EA@Base@@8
; CHECK: Base::`RTTI Base Class Descriptor at (0, -1, 0, 64)'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67851.221315.patch
Type: text/x-patch
Size: 2614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190923/3ddeb9b1/attachment.bin>
More information about the llvm-commits
mailing list