diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-01-03 04:29:20 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-01-03 04:29:20 +0000 |
| commit | d2ecc139f2b2e687cf4a56bb1c789fb6e4f4a65e (patch) | |
| tree | c3ec4b691593d4c1f76e0d1b743acc3b4e534fb9 /clang/lib | |
| parent | 60470f1194f850eab764be952416ef915d24e564 (diff) | |
| download | bcm5719-llvm-d2ecc139f2b2e687cf4a56bb1c789fb6e4f4a65e.tar.gz bcm5719-llvm-d2ecc139f2b2e687cf4a56bb1c789fb6e4f4a65e.zip | |
Warn on unused auto variables.
To do so we have to wait until we know that the type of a variable has been
deduced. Sema::FinalizeDeclaration is the first callback that is used for
decl with or without initializers.
llvm-svn: 171458
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 624f40582b2..61791b2aa58 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -4537,8 +4537,6 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, // member, set the visibility of this variable. if (NewVD->getLinkage() == ExternalLinkage && !DC->isRecord()) AddPushedVisibilityAttribute(NewVD); - - MarkUnusedFileScopedDecl(NewVD); return NewVD; } @@ -7348,6 +7346,9 @@ Sema::FinalizeDeclaration(Decl *ThisDecl) { if (!VD) return; + if (VD->isFileVarDecl()) + MarkUnusedFileScopedDecl(VD); + // Now we have parsed the initializer and can update the table of magic // tag values. if (!VD->hasAttr<TypeTagForDatatypeAttr>() || |

