Index: libcxxabi/src/demangle/ItaniumDemangle.h =================================================================== --- libcxxabi/src/demangle/ItaniumDemangle.h +++ libcxxabi/src/demangle/ItaniumDemangle.h @@ -71,7 +71,6 @@ X(ForwardTemplateReference) \ X(NameWithTemplateArgs) \ X(GlobalQualifiedName) \ - X(StdQualifiedName) \ X(ExpandedSpecialSubstitution) \ X(SpecialSubstitution) \ X(CtorDtorName) \ @@ -1471,21 +1470,6 @@ } }; -struct StdQualifiedName : Node { - Node *Child; - - StdQualifiedName(Node *Child_) : Node(KStdQualifiedName), Child(Child_) {} - - template void match(Fn F) const { F(Child); } - - StringView getBaseName() const override { return Child->getBaseName(); } - - void printLeft(OutputBuffer &OB) const override { - OB += "std::"; - Child->print(OB); - } -}; - enum class SpecialSubKind { allocator, basic_string, @@ -2676,8 +2660,12 @@ Node *Result = getDerived().parseUnqualifiedName(State); if (Result == nullptr) return nullptr; - if (IsStd) - Result = make(Result); + if (IsStd) { + if (auto *Std = make("std")) + Result = make(Std, Result); + else + return nullptr; + } return Result; } Index: llvm/include/llvm/Demangle/ItaniumDemangle.h =================================================================== --- llvm/include/llvm/Demangle/ItaniumDemangle.h +++ llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -71,7 +71,6 @@ X(ForwardTemplateReference) \ X(NameWithTemplateArgs) \ X(GlobalQualifiedName) \ - X(StdQualifiedName) \ X(ExpandedSpecialSubstitution) \ X(SpecialSubstitution) \ X(CtorDtorName) \ @@ -1471,21 +1470,6 @@ } }; -struct StdQualifiedName : Node { - Node *Child; - - StdQualifiedName(Node *Child_) : Node(KStdQualifiedName), Child(Child_) {} - - template void match(Fn F) const { F(Child); } - - StringView getBaseName() const override { return Child->getBaseName(); } - - void printLeft(OutputBuffer &OB) const override { - OB += "std::"; - Child->print(OB); - } -}; - enum class SpecialSubKind { allocator, basic_string, @@ -2676,8 +2660,12 @@ Node *Result = getDerived().parseUnqualifiedName(State); if (Result == nullptr) return nullptr; - if (IsStd) - Result = make(Result); + if (IsStd) { + if (auto *Std = make("std")) + Result = make(Std, Result); + else + return nullptr; + } return Result; } Index: llvm/lib/Demangle/ItaniumDemangle.cpp =================================================================== --- llvm/lib/Demangle/ItaniumDemangle.cpp +++ llvm/lib/Demangle/ItaniumDemangle.cpp @@ -404,9 +404,6 @@ case Node::KAbiTagAttr: Name = static_cast(Name)->Base; continue; - case Node::KStdQualifiedName: - Name = static_cast(Name)->Child; - continue; case Node::KNestedName: Name = static_cast(Name)->Name; continue; @@ -446,9 +443,6 @@ } switch (Name->getKind()) { - case Node::KStdQualifiedName: - OB += "std"; - break; case Node::KNestedName: static_cast(Name)->Qual->print(OB); break; @@ -550,9 +544,6 @@ case Node::KNestedName: N = static_cast(N)->Name; break; - case Node::KStdQualifiedName: - N = static_cast(N)->Child; - break; } } return false; Index: llvm/lib/Support/ItaniumManglingCanonicalizer.cpp =================================================================== --- llvm/lib/Support/ItaniumManglingCanonicalizer.cpp +++ llvm/lib/Support/ItaniumManglingCanonicalizer.cpp @@ -189,20 +189,6 @@ bool trackedNodeIsUsed() const { return TrackedNodeIsUsed; } }; -/// Convert St3foo to NSt3fooE so that equivalences naming one also affect the -/// other. -template<> -struct CanonicalizerAllocator::MakeNodeImpl< - itanium_demangle::StdQualifiedName> { - CanonicalizerAllocator &Self; - Node *make(Node *Child) { - Node *StdNamespace = Self.makeNode("std"); - if (!StdNamespace) - return nullptr; - return Self.makeNode(StdNamespace, Child); - } -}; - // FIXME: Also expand built-in substitutions? using CanonicalizingDemangler =