Skip to content

Commit

Permalink
Update LLVM lib/Demangle from r371469 to r372602
Browse files Browse the repository at this point in the history
New:
  - [ms] demangle rtti descriptor names

Ran:

  cp ~/src/llvm-project/llvm/include/llvm/Demangle/*.h third_party/llvm/include/llvm/Demangle/
  cp ~/src/llvm-project/llvm/lib/Demangle/*.cpp third_party/llvm/lib/Demangle/
  cp ~/src/llvm-project/llvm/LICENSE.TXT third_party/llvm/LICENSE.txt

Related to #9.
  • Loading branch information
nico committed Sep 23, 2019
1 parent 3ee555c commit 02a9623
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions demumble_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
('demumble -bx < bar', re.compile(".*unrecognized option `x' in `-bx'.*")),
('demumble < _ZZ3fooiENK3$_0clEi',
'foo(int)::$_0::operator()(int) const\n'),
('demumble .?AVNet@@', "class Net `RTTI Type Descriptor Name'\n"),
]

status = 0
Expand Down
1 change: 1 addition & 0 deletions third_party/llvm/include/llvm/Demangle/MicrosoftDemangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class Demangler {
QualifiedNameNode *QN);
SymbolNode *demangleDeclarator(StringView &MangledName);
SymbolNode *demangleMD5Name(StringView &MangledName);
SymbolNode *demangleTypeinfoName(StringView &MangledName);

VariableSymbolNode *demangleVariableEncoding(StringView &MangledName,
StorageClass SC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ struct TypeNode : public Node {
outputPost(OS, Flags);
}

void outputQuals(bool SpaceBefore, bool SpaceAfter) const;

Qualifiers Quals = Q_None;
};

Expand Down
18 changes: 18 additions & 0 deletions third_party/llvm/lib/Demangle/MicrosoftDemangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions third_party/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ std::string Node::toString(OutputFlags Flags) const {
return {OS.getBuffer()};
}

void TypeNode::outputQuals(bool SpaceBefore, bool SpaceAfter) const {}

void PrimitiveTypeNode::outputPre(OutputStream &OS, OutputFlags Flags) const {
switch (PrimKind) {
OUTPUT_ENUM_CLASS_VALUE(PrimitiveKind, Void, "void");
Expand Down

0 comments on commit 02a9623

Please sign in to comment.