[PATCH] D113749: [Clang] Fix nesting of discarded and immediate contexts.

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 1 07:58:07 PST 2021


cor3ntin added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:16575-16578
+      ExprEvalContexts[ExprEvalContexts.size() - 2]
+          .isDiscardedStatementContext();
+  ExprEvalContexts.back().InImmediateFunctionContext =
+      ExprEvalContexts[ExprEvalContexts.size() - 2]
----------------
aaron.ballman wrote:
> It took me a moment to understand why `-2` was happening here. However, isn't this going to be UB when we go to push the first expr evaluation context?
No, there is always one root context created during initialization of sema. Because this pattern is used in a few places, I did not add a comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113749



More information about the cfe-commits mailing list