diff options
author | Fangrui Song <maskray@google.com> | 2018-05-24 06:57:57 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-05-24 06:57:57 +0000 |
commit | 79420acb96db4f0cdf83b190e2171d3024fe4b17 (patch) | |
tree | b1e3e1a8146c7bac4fd3ee45c02ba07d88c2985d /llvm/lib/Demangle/ItaniumDemangle.cpp | |
parent | 43bfe84451ea49981cb5fcf2d70c9711714dc87d (diff) | |
download | bcm5719-llvm-79420acb96db4f0cdf83b190e2171d3024fe4b17.tar.gz bcm5719-llvm-79420acb96db4f0cdf83b190e2171d3024fe4b17.zip |
[demangler] Add ItaniumPartialDemangler::isCtorOrDtor
Reviewers: erik.pilkington, ruiu, echristo, pcc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D47248
llvm-svn: 333159
Diffstat (limited to 'llvm/lib/Demangle/ItaniumDemangle.cpp')
-rw-r--r-- | llvm/lib/Demangle/ItaniumDemangle.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/lib/Demangle/ItaniumDemangle.cpp b/llvm/lib/Demangle/ItaniumDemangle.cpp index 4b2bde0daca..8955c55c312 100644 --- a/llvm/lib/Demangle/ItaniumDemangle.cpp +++ b/llvm/lib/Demangle/ItaniumDemangle.cpp @@ -5264,6 +5264,38 @@ bool ItaniumPartialDemangler::hasFunctionQualifiers() const { return E->getCVQuals() != QualNone || E->getRefQual() != FrefQualNone; } +bool ItaniumPartialDemangler::isCtorOrDtor() const { + Node *N = static_cast<Node *>(RootNode); + while (N) { + switch (N->getKind()) { + default: + return false; + case Node::KCtorDtorName: + return true; + + case Node::KAbiTagAttr: + N = static_cast<AbiTagAttr *>(N)->Base; + break; + case Node::KFunctionEncoding: + N = static_cast<FunctionEncoding *>(N)->getName(); + break; + case Node::KLocalName: + N = static_cast<LocalName *>(N)->Entity; + break; + case Node::KNameWithTemplateArgs: + N = static_cast<NameWithTemplateArgs *>(N)->Name; + break; + case Node::KNestedName: + N = static_cast<NestedName *>(N)->Name; + break; + case Node::KStdQualifiedName: + N = static_cast<StdQualifiedName *>(N)->Child; + break; + } + } + return false; +} + bool ItaniumPartialDemangler::isFunction() const { assert(RootNode != nullptr && "must call partialDemangle()"); return static_cast<Node *>(RootNode)->getKind() == Node::KFunctionEncoding; |