[PATCH] [analyzer] Refactor conditional expression evaluating code
Pavel Labath
labath at google.com
Wed Aug 14 11:41:48 PDT 2013
But I am marking the leaf expressions as "live". See the inline comments. You really recurse down until you reach a non-logical-operator expression.
That said, I can see now how the function name can be misleading. The intended reading was "mark logical expression operands live", but it does sound too much like "mark logical operations". I guess I'll change that into something else.
================
Comment at: lib/Analysis/LiveVariables.cpp:351
@@ -348,3 +350,3 @@
void TransferFunctions::VisitBinaryOperator(BinaryOperator *B) {
if (B->isAssignmentOp()) {
----------------
If I am a binary operator
================
Comment at: lib/Analysis/LiveVariables.cpp:384
@@ +383,3 @@
+ return;
+
+ const Expr *LHS = BO->getLHS()->IgnoreParens();
----------------
I am a logical operator
================
Comment at: lib/Analysis/LiveVariables.cpp:386
@@ +385,3 @@
+ const Expr *LHS = BO->getLHS()->IgnoreParens();
+ const Expr *RHS = BO->getRHS()->IgnoreParens();
+
----------------
Get the left and right hand side operands.
================
Comment at: lib/Analysis/LiveVariables.cpp:389
@@ +388,3 @@
+ val.liveStmts = LV.SSetFact.add(val.liveStmts, LHS);
+ val.liveStmts = LV.SSetFact.add(val.liveStmts, RHS);
+
----------------
Mark them as live.
================
Comment at: lib/Analysis/LiveVariables.cpp:392
@@ +391,3 @@
+ MarkLogicalOpsLive(LHS);
+ MarkLogicalOpsLive(RHS);
+}
----------------
Recurse down to mark their children as well (if LHS and RHS happen to be logical operators again. otherwise the recursion stops.)
http://llvm-reviews.chandlerc.com/D1340
More information about the cfe-commits
mailing list