cor3ntin added inline comments.

================
Comment at: clang/lib/Sema/SemaDecl.cpp:15186
+  // different handling.
+  ExprEvalContexts.back().InImmediateFunctionContext = FD->isConsteval();
+
----------------
shafik wrote:
> I am a bit concerned that we are updating `InImmediateFunctionContext` 
> outside of `PushExpressionEvaluationContext`. So we are now spreading the 
> logic outside of where it was originally contained.
> 
> I am wondering if instead inside of `PushExpressionEvaluationContext` we 
> could set `InImmediateFunctionContext` like so:
> 
> ```
> ExprEvalContexts.back().InImmediateFunctionContext =
>       ExprEvalContexts[ExprEvalContexts.size() - 2]
>           .isImmediateFunctionContext() || NewContext == 
> ImmediateFunctionContext;
> ```
> 
> or something along those lines.
Here `isImmediateFunctionContext()` will be true, we want it to be false

If we wanted to do somelink like what you are suggesting, we'd need something 
like a new `EnteringFunctionDefinitionContext` boolean parameter to  
PushExpressionEvaluationContext. so that
InImmediateFunctionContext is only set to the outer context value when 
`EnteringFunctionDefinitionContext`would be false

Given that we should only get in that situation from `ActOnStartOfFunctionDef`, 
I'm not sure that would be a better design


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147531

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to