aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/DeadStores.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Analysis/DeadStores.cpp b/lib/Analysis/DeadStores.cpp
index 2e57757f5c..e64214e694 100644
--- a/lib/Analysis/DeadStores.cpp
+++ b/lib/Analysis/DeadStores.cpp
@@ -54,8 +54,11 @@ public:
else if(DeclStmt* DS = dyn_cast<DeclStmt>(S))
// Iterate through the decls. Warn if any initializers are complex
// expressions that are not live (never used).
- for (VarDecl* V = cast<VarDecl>(DS->getDecl()); V != NULL ;
- V = cast_or_null<VarDecl>(V->getNextDeclarator())) {
+ for (ScopedDecl* SD = DS->getDecl(); SD; SD = SD->getNextDeclarator()) {
+
+ VarDecl* V = dyn_cast<VarDecl>(SD);
+ if (!V) continue;
+
if (V->hasLocalStorage())
if (Expr* E = V->getInit()) {
if (!Live(DS->getDecl(),AD)) {