[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:57:25 PST 2023


shafik added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:19036
 
 bool Sema::tryCaptureVariable(
     ValueDecl *Var, SourceLocation ExprLoc, TryCaptureKind Kind,
----------------
We have a bunch of bugs that crash in the method and it would be good to rescreen those bugs after landing this to see if it fixes any of those. 


================
Comment at: clang/lib/Sema/SemaLambda.cpp:906
+  // C++11 [expr.prim.lambda]p5:
+  //   The closure type for a lambda-expression has a public inline function
+  //   call operator (13.5.4) whose parameters and return type are described
----------------
This has changed a bit so might be worth updating the wording here to reflect C++20.


================
Comment at: clang/lib/Sema/SemaLambda.cpp:918-920
+      QualType(), nullptr, SC_None, getCurFPFeatures().isFPConstrained(),
+      /*isInline=*/true, ConstexprSpecKind::Unspecified, SourceLocation(),
+      nullptr);
----------------
minor fix


================
Comment at: clang/lib/Sema/SemaLambda.cpp:1007
+  CXXRecordDecl *Class = createLambdaClosureType(
+      Intro.Range, nullptr, LambdaDependencyKind, Intro.Default);
+  LSI->Lambda = Class;
----------------



================
Comment at: clang/lib/Sema/SemaLambda.cpp:1010
+
+  // C++11 [expr.prim.lambda]p5:
+  //   The closure type for a lambda-expression has a public inline function
----------------
Same as comment above about updating wording to reflect C++20.


================
Comment at: clang/lib/Sema/SemaLambda.cpp:1258-1259
+      (getCurrentThisType().isNull() ||
+       CheckCXXThisCapture(SourceLocation(), /*Explicit*/ true,
+                           /*BuildAndDiagnose*/ false)))
+    Diag(Intro.DefaultLoc, diag::err_capture_default_non_local);
----------------



================
Comment at: clang/lib/Sema/TreeTransform.h:13255
+  CXXRecordDecl *Class = getSema().createLambdaClosureType(
+      E->getIntroducerRange(), nullptr, DependencyKind, E->getCaptureDefault());
   getDerived().transformedLocalDecl(OldClass, {Class});
----------------



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