[PATCH] D76438: ConstantExpr cached APValues if present for constant evaluation
Wyatt Childers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 19 11:27:19 PDT 2020
wchilders added inline comments.
================
Comment at: clang/lib/AST/Expr.cpp:2875
- else if (auto *CE = dyn_cast<ConstantExpr>(E))
- return CE->getSubExpr();
-
return E;
}
----------------
`IgnoreParensSingleStep` for some reason has been unwrapping `ConstantExpr`s. This results in the constant evaluator, removing the ConstantExpr, and reevaluating the expression. There are no observed downsides to removing this condition, in the test suite, however, it's strange enough to note.
================
Comment at: clang/lib/AST/ExprConstant.cpp:7329
+ if (Result.isLValue())
+ return Success(Result, E);
+ }
----------------
This doesn't seem to be the right answer, and `ConstantExpr`s don't have `LValue` `APValue`s, at least, not that are reaching this case. We had a previous implementation that also, kind of punted on this issue with an override in `TemporaryExprEvaluator`: https://gitlab.com/lock3/clang/-/blob/9fbaeea06fc567ac472264bec2a72661a1e06c73/clang/lib/AST/ExprConstant.cpp#L9753
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76438/new/
https://reviews.llvm.org/D76438
More information about the cfe-commits
mailing list