[analyzer] Ignore parentheses around block-level expressions when computing liveness. Fixes the other half of PR8962.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132769 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp
index 303dc0f..0fe87e8 100644
--- a/lib/Analysis/LiveVariables.cpp
+++ b/lib/Analysis/LiveVariables.cpp
@@ -142,8 +142,12 @@
if (AD.Observer)
AD.Observer->ObserveStmt(S, currentBlock, AD, LiveState);
- if (getCFG().isBlkExpr(S))
- LiveState(S, AD) = Dead;
+ if (getCFG().isBlkExpr(S)) {
+ if (Expr *E = dyn_cast<Expr>(S))
+ LiveState(E->IgnoreParens(), AD) = Dead;
+ else
+ LiveState(S, AD) = Dead;
+ }
StmtVisitor<TransferFuncs,void>::Visit(S);
}
@@ -157,7 +161,10 @@
}
else {
// For block-level expressions, mark that they are live.
- LiveState(S,AD) = Alive;
+ if (Expr *E = dyn_cast<Expr>(S))
+ LiveState(E->IgnoreParens(), AD) = Alive;
+ else
+ LiveState(S, AD) = Alive;
}
}
@@ -174,6 +181,9 @@
return;
assert (getCFG().isBlkExpr(E));
+
+ if (const Expr *Ex = dyn_cast<Expr>(E))
+ E = Ex->IgnoreParens();
LiveState(E, AD) = Alive;
}