[PATCH] D119136: [clang] Implement Change scope of lambda trailing-return-type

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 14 10:40:09 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:1397
+        for (LateParsedAttribute *Attr : LateParsedAttrs) {
+          ParseLambdaLexedAttribute(*Attr, Attributes, D);
+          delete Attr;
----------------
cor3ntin wrote:
> aaron.ballman wrote:
> > I think you should add an assert before this call to ensure that all attributes are GNU ones.
> I'm not sure that gains much? 
> In the future if late parsing is implemented for `__declspec` this would just work , unless we add an assert. I'd be fine adding it though.
Because `ParseLambdaLexedAttribute()` specifically parses GNU attribute args and not declspec ones, I think that function should be renamed. Once that function is renamed to say GNU explicitly, then there's a question of what happens when we hand it late parsed declspec attribute. Which is why I was suggesting a comment above to mention that declspec attributes don't late parse anyway.

Another way to handle this that's more general would be to change `ParseLambdaLexedAttribute()` to parse different args depending on the syntax of the attribute (then it can keep its generic name).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119136



More information about the cfe-commits mailing list