[PATCH] D103395: PR45879: Keep evaluated expression in LValue object

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 28 08:57:16 PDT 2021


aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.

Trying to help get this review going again as it impacts libc++.



================
Comment at: clang/lib/AST/ExprConstant.cpp:1584-1585
       Designator = SubobjectDesignator(getType(B));
+      if (!LExpr)
+        LExpr = B.dyn_cast<const Expr *>();
       IsNullPtr = false;
----------------
Should we be asserting that `LExpr` is null?


================
Comment at: clang/lib/AST/ExprConstant.cpp:8049
 
+  bool evaluate(const Expr *E) {
+    Result.LExpr = E;
----------------
It's not super clear to me when consumers should call `Evaluate()` instead of calling `Visit()`. Some comments on the function may help make it more clear.


================
Comment at: clang/lib/AST/ExprConstant.cpp:8050
+  bool evaluate(const Expr *E) {
+    Result.LExpr = E;
+    return Visit(E);
----------------
Should we be asserting that `Result.LExpr` is not already set?


================
Comment at: clang/lib/AST/ExprConstant.cpp:8586
 
+  bool evaluate(const Expr *E) { return Visit(E); }
+
----------------
Is there a reason we're not setting `Result.LExpr` here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103395



More information about the cfe-commits mailing list