[clang] [Clang] Only remove lambda scope after computing evaluation context (PR #154106)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 18 20:54:22 PDT 2025
================
@@ -16681,7 +16677,8 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
if (!IsInstantiation)
PopDeclContext();
- PopFunctionScopeInfo(ActivePolicy, dcl);
+ if (!RetainFunctionScopeInfo)
+ PopFunctionScopeInfo(ActivePolicy, dcl);
----------------
zyn0217 wrote:
> Do we have some sort of assert to make sure we don't ever end up with unpopped scopes at the end of a TU?
No afaik, but at least we're correctly pairing Pop and Push for lambdas - we call BuildLambdaExpr immediately after FinishFunctionBody. So the behavior should remain the same as before.
> Also, we probably need to document the new bool in a way that makes it clear that you MUST be responsible for popping your own function scope if you pass 'true'.
Done
https://github.com/llvm/llvm-project/pull/154106
More information about the cfe-commits
mailing list