[cfe-commits] r49662 - /cfe/trunk/lib/Analysis/DeadStores.cpp
Ted Kremenek
kremenek at apple.com
Mon Apr 14 10:52:14 PDT 2008
Author: kremenek
Date: Mon Apr 14 12:52:13 2008
New Revision: 49662
URL: http://llvm.org/viewvc/llvm-project?rev=49662&view=rev
Log:
Bug fix in dead-store checker when walking the Decls in a DeclStmt: don't
assume that DeclStmts only have VarDecls; they can have TypedefDecls.
Modified:
cfe/trunk/lib/Analysis/DeadStores.cpp
Modified: cfe/trunk/lib/Analysis/DeadStores.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/DeadStores.cpp?rev=49662&r1=49661&r2=49662&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/DeadStores.cpp (original)
+++ cfe/trunk/lib/Analysis/DeadStores.cpp Mon Apr 14 12:52:13 2008
@@ -54,8 +54,11 @@
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)) {
More information about the cfe-commits
mailing list