[clang] [clang] Fix issue introduced in predefined expressions in lambdas (PR #217021)

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 27 06:57:04 PST 2026


================
@@ -2122,8 +2122,7 @@ static Decl *getPredefinedExprDecl(Sema &S, DeclContext *DC) {
   auto tryAdjustLambdaContext = [&S, &LSI](DeclContext *&DC) {
     if (isLambdaCallOperator(DC)) {
       auto E = S.FunctionScopes.rend();
-      while (LSI != E && isa<CapturingScopeInfo>(*LSI) &&
-             !isa<LambdaScopeInfo>(*LSI))
+      while (LSI != E && !isa<LambdaScopeInfo>(*LSI))
         ++LSI;
       assert(LSI != E && "Should be in a lambda scope info");
       if (dyn_cast<LambdaScopeInfo>(*LSI)->BeforeCompoundStatement)
----------------
StefanPaulet wrote:

Sorry for the mistake, the analyzer is right and my assumption that a `LambdaScopeInfo` always exists was wrong. I created a PR to fix this #246670

https://github.com/llvm/llvm-project/pull/217021


More information about the cfe-commits mailing list