[PATCH] D124012: [Clang] Fix references to captured variables in dependant context.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 19 10:18:33 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/Sema/SemaLambda.cpp:539-546
 void Sema::buildLambdaScope(LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator,
                             SourceRange IntroducerRange,
                             LambdaCaptureDefault CaptureDefault,
                             SourceLocation CaptureDefaultLoc,
-                            bool ExplicitParams, bool ExplicitResultType,
-                            bool Mutable) {
+                            bool ExplicitParams, bool Mutable) {
   buildLambdaScopeCaptures(LSI, CallOperator, IntroducerRange, CaptureDefault,
                            CaptureDefaultLoc, ExplicitParams, Mutable);
----------------
IIRC, we added `buildLambdaScope()` quite recently, so perhaps that function should go away now and callers just call `buildLambdaScopeCaptures()` directly?


================
Comment at: clang/lib/Sema/SemaLambda.cpp:1377
 
-  ContextRAII ManglingContext(*this, Class->getDeclContext());
+  Method->setInnerLocStart(LambdaLoc);
+  CompleteLambdaCallOperator(
----------------
Out of curiosity, why isn't this part of `CompleteLambdaCallOperator()` like all the other setters? (Should template instantiation also be setting this?)


================
Comment at: clang/lib/Sema/SemaLambda.cpp:1378-1383
+  CompleteLambdaCallOperator(
+      Method, Intro.Range.getBegin(), ParamInfo.getTrailingRequiresClause(),
+      MethodTyInfo, ParamInfo.getDeclSpec().getConstexprSpecifier(), Params,
+      ExplicitResultType);
 
+  ContextRAII ManglingContext(*this, Class->getDeclContext());
----------------
The previous logic was to enter a mangling context and then check params, but the new logic checks params outside of the mangling context. Is that intentional?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124012



More information about the cfe-commits mailing list