[PATCH] D80925: Fix compiler crash when trying to parse alignment argument as a constant expression.
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 1 19:30:17 PDT 2020
rjmccall added inline comments.
================
Comment at: clang/lib/Parse/ParseExpr.cpp:1009
+ Actions, Sema::ExpressionEvaluationContext::Unevaluated,
+ Sema::ReuseLambdaContextDecl);
+ Res = Actions.TransformToPotentiallyEvaluated(Res.get());
----------------
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`.
================
Comment at: clang/lib/Parse/ParseTentative.cpp:1279
+ // Enter unevaluated context to prevent propagation of the odr-use data to
+ // outer context in case of unsuccesful tentative parsing.
+ EnterExpressionEvaluationContext Unevaluated(
----------------
Suggestion:
```
// Tentative parsing may not be done in the right evaluation context
// for the ultimate expression. Enter an unevaluated context to prevent
// Sema from immediately e.g. treating this lookup as a potential ODR-use.
// If we generate an expression annotation token and the parser actually
// claims it as an expression, we'll transform the expression to a
// potentially-evaluated one then.
```
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