[PATCH] D123909: [Clang] Use of decltype(capture) in parameter-declaration-clause

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 18 04:36:53 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Sema/Sema.h:5281
+                                              SourceLocation TemplateKwLoc,
+                                              bool HasTrailingLParen);
+
----------------
This parameter is always false, so it seems like it can be dropped.


================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:688-694
+/// ParseCXXMaybeMutableAgnosticExpression - Handle Expressions inside of
+/// sizeof, decltype, noexcepr
+/// - unqualified-id
+/// - expression
+/// This serves to silence errors about captured variable refered in lambda
+/// parameter list, if they aree used as the unqualified-id of a decltype,
+/// sizeof, or noexcept expression
----------------



================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:700
+
+  if (Tok.is(tok::identifier) && NextToken().is(tok::r_paren)) {
+    SourceLocation TemplateKWLoc;
----------------
This feels surprisingly restrictive to me, but it's sufficient for getting libstdc++ working again.


================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:713-715
+    }
+  }
+  return ParseExpression();
----------------
In the case we get an error from parsing the unqualified id, I don't think we want to immediately try to parse an expression, right? Seems like a case to return an `ExprError`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123909



More information about the cfe-commits mailing list