[PATCH] D147531: [clang] Reset track of immediate function context when entering new function

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 09:19:14 PDT 2023


shafik added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:15186
+  // different handling.
+  ExprEvalContexts.back().InImmediateFunctionContext = FD->isConsteval();
+
----------------
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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147531



More information about the cfe-commits mailing list