[PATCH] D80925: Fix compiler crash when an expression parsed in the tentative parsing and must be claimed in the another evaluation context.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 2 05:31:17 PDT 2020


ABataev marked an inline comment as done.
ABataev added inline comments.


================
Comment at: clang/lib/Parse/ParseExpr.cpp:1009
+              Actions, Sema::ExpressionEvaluationContext::Unevaluated,
+              Sema::ReuseLambdaContextDecl);
+          Res = Actions.TransformToPotentiallyEvaluated(Res.get());
----------------
rjmccall wrote:
> Pushing an unevaluated context here isn't correct.  Here we're parsing the expression for real and should already be in the right context for `TransformToPotentiallyEvaluated`.
`TransformToPotentiallyEvaluated` expects that the innermost context is reevaluated. By the time we approach this branch, we're already out of the original unevaluated context. So, we need to create fake unevaluated context to mimic the original one. Function `TransformToPotentiallyEvaluated` copies the context state from the previous context to this new one and rebuilds the expression correctly. Instead, I can add a new function that transforms the expression in the current context and use it in `TransformToPotentiallyEvaluated`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80925





More information about the cfe-commits mailing list