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.

llvm-svn: 49662
This commit is contained in:
Ted Kremenek 2008-04-14 17:52:13 +00:00
parent c22ede25c4
commit 75ff623e2e
1 changed files with 5 additions and 2 deletions

View File

@ -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)) {