================
@@ -2134,6 +2135,11 @@ ConstructFixItRangeForUnusedCapture(Sema &S, SourceRange 
CaptureRange,
 
 ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, SourceLocation 
EndLoc,
                                  LambdaScopeInfo *LSI) {
+  // Copy the LSI before PopFunctionScopeInfo removes it.
+  // FIXME: This is dumb. Store the lambda information somewhere that outlives
+  // the call operator.
+  LambdaScopeInfo LSICopy = *LSI;
+  LSI = &LSICopy;
----------------
erichkeane wrote:

This seems awful strange.  I don't think this is  'the way', and since it 
changes the address of `LSI`, doesn't it cause any other links of it to break?  
That doesn't seem right.

I DO find myself wondering whether we need to spend some effort just managing 
the `LambdaScopeInfo` in 1 place (push, do thing, pop) instead?  Also-also, 
other than making this variable, we aren't actually referencing LSICopy again?  
What is going on?

https://github.com/llvm/llvm-project/pull/154106
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to