@@ -2063,16 +2063,15 @@ class StringLiteral : public Node {
2063
2063
class LambdaExpr : public Node {
2064
2064
const Node *Type;
2065
2065
2066
- void printLambdaDeclarator (OutputStream &S) const ;
2067
-
2068
2066
public:
2069
2067
LambdaExpr (const Node *Type_) : Node(KLambdaExpr), Type(Type_) {}
2070
2068
2071
2069
template <typename Fn> void match (Fn F) const { F (Type); }
2072
2070
2073
2071
void printLeft (OutputStream &S) const override {
2074
2072
S += " []" ;
2075
- printLambdaDeclarator (S);
2073
+ if (Type->getKind () == KClosureTypeName)
2074
+ static_cast <const ClosureTypeName *>(Type)->printDeclarator (S);
2076
2075
S += " {...}" ;
2077
2076
}
2078
2077
};
@@ -2209,39 +2208,6 @@ FOR_EACH_NODE_KIND(SPECIALIZATION)
2209
2208
2210
2209
#undef FOR_EACH_NODE_KIND
2211
2210
2212
- inline void LambdaExpr::printLambdaDeclarator (OutputStream &S) const {
2213
- struct LambdaDeclaratorPrinter {
2214
- OutputStream &S;
2215
- void operator ()(const ClosureTypeName *LambdaType) {
2216
- LambdaType->printDeclarator (S);
2217
- }
2218
-
2219
- // Walk through any qualifiers to find the lambda-expression.
2220
- void operator ()(const SpecialName *Name) {
2221
- Name->match ([&](StringView, const Node *Name) { Name->visit (*this ); });
2222
- }
2223
- void operator ()(const NestedName *Name) {
2224
- Name->match ([&](const Node *, const Node *Name) { Name->visit (*this ); });
2225
- }
2226
- void operator ()(const LocalName *Name) {
2227
- Name->match ([&](const Node *, const Node *Name) { Name->visit (*this ); });
2228
- }
2229
- void operator ()(const QualifiedName *Name) {
2230
- Name->match ([&](const Node *, const Node *Name) { Name->visit (*this ); });
2231
- }
2232
- void operator ()(const GlobalQualifiedName *Name) {
2233
- Name->match ([&](const Node *Child) { Child->visit (*this ); });
2234
- }
2235
- void operator ()(const StdQualifiedName *Name) {
2236
- Name->match ([&](const Node *Child) { Child->visit (*this ); });
2237
- }
2238
- void operator ()(const Node *) {
2239
- // If we can't find the lambda type, just print '[]{...}'.
2240
- }
2241
- };
2242
- return Type->visit (LambdaDeclaratorPrinter{S});
2243
- }
2244
-
2245
2211
template <class T , size_t N>
2246
2212
class PODSmallVector {
2247
2213
static_assert (std::is_pod<T>::value,
@@ -4324,20 +4290,26 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExprPrimary() {
4324
4290
// Invalid mangled name per
4325
4291
// http://sourcerytools.com/pipermail/cxx-abi-dev/2011-August/002422.html
4326
4292
return nullptr ;
4293
+ case ' U' : {
4294
+ // FIXME: Should we support LUb... for block literals?
4295
+ if (look (1 ) != ' l' )
4296
+ return nullptr ;
4297
+ Node *T = parseUnnamedTypeName (nullptr );
4298
+ if (!T || !consumeIf (' E' ))
4299
+ return nullptr ;
4300
+ return make<LambdaExpr>(T);
4301
+ }
4327
4302
default : {
4328
4303
// might be named type
4329
4304
Node *T = getDerived ().parseType ();
4330
4305
if (T == nullptr )
4331
4306
return nullptr ;
4332
4307
StringView N = parseNumber ();
4333
- if (!N.empty ()) {
4334
- if (!consumeIf (' E' ))
4335
- return nullptr ;
4336
- return make<IntegerCastExpr>(T, N);
4337
- }
4338
- if (consumeIf (' E' ))
4339
- return make<LambdaExpr>(T);
4340
- return nullptr ;
4308
+ if (N.empty ())
4309
+ return nullptr ;
4310
+ if (!consumeIf (' E' ))
4311
+ return nullptr ;
4312
+ return make<IntegerCastExpr>(T, N);
4341
4313
}
4342
4314
}
4343
4315
}
0 commit comments