[PATCH] D124351: [Clang] Implement Change scope of lambda trailing-return-type

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 23 18:12:01 PST 2023


shafik added inline comments.


================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:1301-1302
         SourceLocation AttrNameLoc = ConsumeToken();
-        Attr.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
-                    ParsedAttr::AS_Keyword);
+        Attributes.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr,
+                          0, ParsedAttr::AS_Keyword);
       } else if (Tok.is(tok::kw___attribute))
----------------
Minor edit


================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:1304
       } else if (Tok.is(tok::kw___attribute))
-        ParseGNUAttributes(Attr, nullptr, &D);
+        ParseGNUAttributes(Attributes, nullptr, &D);
       else
----------------



================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:1494
 
-    // Parse lambda-specifiers.
-    ParseLambdaSpecifiers(LParenLoc, /*DeclEndLoc=*/T.getCloseLocation(),
-                          ParamInfo, EllipsisLoc);
-
-    // Parse requires-clause[opt].
-    if (Tok.is(tok::kw_requires))
-      ParseTrailingRequiresClause(D);
-  } else if (Tok.isOneOf(tok::kw_mutable, tok::arrow, tok::kw___attribute,
-                         tok::kw_constexpr, tok::kw_consteval, tok::kw_static,
-                         tok::kw___private, tok::kw___global, tok::kw___local,
-                         tok::kw___constant, tok::kw___generic,
-                         tok::kw_groupshared, tok::kw_requires,
-                         tok::kw_noexcept) ||
-             (Tok.is(tok::l_square) && NextToken().is(tok::l_square))) {
-    if (!getLangOpts().CPlusPlus2b)
+  if (Tok.isOneOf(tok::kw_mutable, tok::arrow, tok::kw___attribute,
+                  tok::kw_constexpr, tok::kw_consteval, tok::kw_static,
----------------
This `if` feels pretty messy maybe refactor into something like `CheckHasSpecificers`, maybe?


================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:1381
+  SourceLocation MutableLoc;
+  LateParsedAttrList LateParsedAttrs(true);
+
----------------
cor3ntin wrote:
> aaron.ballman wrote:
> > This isn't being used?
> It used to be! Thanks for catching that
If only we had a diagnostic for that....


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124351/new/

https://reviews.llvm.org/D124351



More information about the cfe-commits mailing list