summaryrefslogtreecommitdiffstats
path: root/libcxxabi
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-04-03 23:14:33 +0000
committerNico Weber <nicolasweber@gmx.de>2019-04-03 23:14:33 +0000
commitc2b872549359704d9af9b693fda47926b2fd1531 (patch)
tree4805b282f2d0a01cf77c3a5a8e86459c312e8895 /libcxxabi
parentc9a012e4eab7f2e9aa8701451b0bf7c6b80222ac (diff)
downloadbcm5719-llvm-c2b872549359704d9af9b693fda47926b2fd1531.tar.gz
bcm5719-llvm-c2b872549359704d9af9b693fda47926b2fd1531.zip
llvm-cxxfilt: Demangle gcc "old-style unified" ctors and dtors
These are variant 4, cf https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c#L1851 https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c#L1880 and gcc seems to sometimes emit them still. Differential Revision: https://reviews.llvm.org/D60229 llvm-svn: 357645
Diffstat (limited to 'libcxxabi')
-rw-r--r--libcxxabi/src/demangle/ItaniumDemangle.h17
-rw-r--r--libcxxabi/test/test_demangle.pass.cpp6
2 files changed, 16 insertions, 7 deletions
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h
index df06aa62d33..4dca309e3cb 100644
--- a/libcxxabi/src/demangle/ItaniumDemangle.h
+++ b/libcxxabi/src/demangle/ItaniumDemangle.h
@@ -2794,11 +2794,13 @@ AbstractManglingParser<Derived, Alloc>::parseOperatorName(NameState *State) {
// <ctor-dtor-name> ::= C1 # complete object constructor
// ::= C2 # base object constructor
// ::= C3 # complete object allocating constructor
-// extension ::= C5 # ?
+// extension ::= C4 # gcc old-style "[unified]" constructor
+// extension ::= C5 # the COMDAT used for ctors
// ::= D0 # deleting destructor
// ::= D1 # complete object destructor
// ::= D2 # base object destructor
-// extension ::= D5 # ?
+// extension ::= D4 # gcc old-style "[unified]" destructor
+// extension ::= D5 # the COMDAT used for dtors
template <typename Derived, typename Alloc>
Node *
AbstractManglingParser<Derived, Alloc>::parseCtorDtorName(Node *&SoFar,
@@ -2821,7 +2823,8 @@ AbstractManglingParser<Derived, Alloc>::parseCtorDtorName(Node *&SoFar,
if (consumeIf('C')) {
bool IsInherited = consumeIf('I');
- if (look() != '1' && look() != '2' && look() != '3' && look() != '5')
+ if (look() != '1' && look() != '2' && look() != '3' && look() != '4' &&
+ look() != '5')
return nullptr;
int Variant = look() - '0';
++First;
@@ -2830,15 +2833,15 @@ AbstractManglingParser<Derived, Alloc>::parseCtorDtorName(Node *&SoFar,
if (getDerived().parseName(State) == nullptr)
return nullptr;
}
- return make<CtorDtorName>(SoFar, false, Variant);
+ return make<CtorDtorName>(SoFar, /*IsDtor=*/false, Variant);
}
- if (look() == 'D' &&
- (look(1) == '0' || look(1) == '1' || look(1) == '2' || look(1) == '5')) {
+ if (look() == 'D' && (look(1) == '0' || look(1) == '1' || look(1) == '2' ||
+ look(1) == '4' || look(1) == '5')) {
int Variant = look(1) - '0';
First += 2;
if (State) State->CtorDtorConversion = true;
- return make<CtorDtorName>(SoFar, true, Variant);
+ return make<CtorDtorName>(SoFar, /*IsDtor=*/true, Variant);
}
return nullptr;
diff --git a/libcxxabi/test/test_demangle.pass.cpp b/libcxxabi/test/test_demangle.pass.cpp
index ddc19617450..bc99ca7cee9 100644
--- a/libcxxabi/test/test_demangle.pass.cpp
+++ b/libcxxabi/test/test_demangle.pass.cpp
@@ -767,8 +767,14 @@ const char* cases[][2] =
{"_ZNK5clang14ASTMergeAction24hasCodeCompletionSupportEv", "clang::ASTMergeAction::hasCodeCompletionSupport() const"},
{"_ZN5clang7ASTUnitC1Eb", "clang::ASTUnit::ASTUnit(bool)"},
{"_ZN5clang7ASTUnitC2Eb", "clang::ASTUnit::ASTUnit(bool)"},
+ {"_ZN5clang7ASTUnitC3Eb", "clang::ASTUnit::ASTUnit(bool)"},
+ {"_ZN5clang7ASTUnitC4Eb", "clang::ASTUnit::ASTUnit(bool)"},
+ {"_ZN5clang7ASTUnitC5Eb", "clang::ASTUnit::ASTUnit(bool)"},
+ {"_ZN5clang7ASTUnitD0Ev", "clang::ASTUnit::~ASTUnit()"},
{"_ZN5clang7ASTUnitD1Ev", "clang::ASTUnit::~ASTUnit()"},
{"_ZN5clang7ASTUnitD2Ev", "clang::ASTUnit::~ASTUnit()"},
+ {"_ZN5clang7ASTUnitD4Ev", "clang::ASTUnit::~ASTUnit()"},
+ {"_ZN5clang7ASTUnitD5Ev", "clang::ASTUnit::~ASTUnit()"},
{"_ZN5clang7ASTUnit19CleanTemporaryFilesEv", "clang::ASTUnit::CleanTemporaryFiles()"},
{"_ZN5clang7ASTUnit28ClearCachedCompletionResultsEv", "clang::ASTUnit::ClearCachedCompletionResults()"},
{"_ZN5clang7ASTUnit26CacheCodeCompletionResultsEv", "clang::ASTUnit::CacheCodeCompletionResults()"},
OpenPOWER on IntegriCloud