diff --git a/third_party/llvm/include/llvm/Demangle/ItaniumDemangle.h b/third_party/llvm/include/llvm/Demangle/ItaniumDemangle.h index c1efd7e..7784e84 100644 --- a/third_party/llvm/include/llvm/Demangle/ItaniumDemangle.h +++ b/third_party/llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -2063,8 +2063,6 @@ class StringLiteral : public Node { class LambdaExpr : public Node { const Node *Type; - void printLambdaDeclarator(OutputStream &S) const; - public: LambdaExpr(const Node *Type_) : Node(KLambdaExpr), Type(Type_) {} @@ -2072,7 +2070,8 @@ class LambdaExpr : public Node { void printLeft(OutputStream &S) const override { S += "[]"; - printLambdaDeclarator(S); + if (Type->getKind() == KClosureTypeName) + static_cast(Type)->printDeclarator(S); S += "{...}"; } }; @@ -2209,39 +2208,6 @@ FOR_EACH_NODE_KIND(SPECIALIZATION) #undef FOR_EACH_NODE_KIND -inline void LambdaExpr::printLambdaDeclarator(OutputStream &S) const { - struct LambdaDeclaratorPrinter { - OutputStream &S; - void operator()(const ClosureTypeName *LambdaType) { - LambdaType->printDeclarator(S); - } - - // Walk through any qualifiers to find the lambda-expression. - void operator()(const SpecialName *Name) { - Name->match([&](StringView, const Node *Name) { Name->visit(*this); }); - } - void operator()(const NestedName *Name) { - Name->match([&](const Node *, const Node *Name) { Name->visit(*this); }); - } - void operator()(const LocalName *Name) { - Name->match([&](const Node *, const Node *Name) { Name->visit(*this); }); - } - void operator()(const QualifiedName *Name) { - Name->match([&](const Node *, const Node *Name) { Name->visit(*this); }); - } - void operator()(const GlobalQualifiedName *Name) { - Name->match([&](const Node *Child) { Child->visit(*this); }); - } - void operator()(const StdQualifiedName *Name) { - Name->match([&](const Node *Child) { Child->visit(*this); }); - } - void operator()(const Node *) { - // If we can't find the lambda type, just print '[]{...}'. - } - }; - return Type->visit(LambdaDeclaratorPrinter{S}); -} - template class PODSmallVector { static_assert(std::is_pod::value, @@ -2392,9 +2358,6 @@ template struct AbstractManglingParser { assert(Parser->TemplateParams.size() >= OldNumTemplateParamLists); Parser->TemplateParams.dropBack(OldNumTemplateParamLists); } - void push_back(Node *Param) { - Params.push_back(Param); - } }; // Template parameter table. Like the above, but referenced like "T42_". @@ -2736,7 +2699,6 @@ AbstractManglingParser::parseUnnamedTypeName(NameState *State) { Node *T = parseTemplateParamDecl(); if (!T) return nullptr; - LambdaTemplateParams.push_back(T); Names.push_back(T); } NodeArray TempParams = popTrailingNodeArray(ParamsBegin); @@ -4324,20 +4286,26 @@ Node *AbstractManglingParser::parseExprPrimary() { // Invalid mangled name per // http://sourcerytools.com/pipermail/cxx-abi-dev/2011-August/002422.html return nullptr; + case 'U': { + // FIXME: Should we support LUb... for block literals? + if (look(1) != 'l') + return nullptr; + Node *T = parseUnnamedTypeName(nullptr); + if (!T || !consumeIf('E')) + return nullptr; + return make(T); + } default: { // might be named type Node *T = getDerived().parseType(); if (T == nullptr) return nullptr; StringView N = parseNumber(); - if (!N.empty()) { - if (!consumeIf('E')) - return nullptr; - return make(T, N); - } - if (consumeIf('E')) - return make(T); - return nullptr; + if (N.empty()) + return nullptr; + if (!consumeIf('E')) + return nullptr; + return make(T, N); } } }