[PATCH] D76438: ConstantExpr cached APValues if present for constant evaluation

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 20 14:07:13 PDT 2020


rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/AST/ExprConstant.cpp:7325-7329
+  // Override to perform additional checks to ensure the cached APValue
+  // is actually an LValue.
+  bool VisitConstantExpr(const ConstantExpr *E) {
+    assert(!E->hasAPValueResult() || E->getAPValueResult().isLValue());
+    return ExprEvaluatorBaseTy::VisitConstantExpr(E);
----------------
I think this override is now fully redundant and can be removed: the `isLValue()` assert is reached anyway when `DerivedSuccess` calls `LValueExprEvaluatorBase::Success` which calls `LValue::setFrom`.


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

https://reviews.llvm.org/D76438





More information about the cfe-commits mailing list