summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorVassil Vassilev <v.g.vassilev@gmail.com>2017-05-09 11:25:41 +0000
committerVassil Vassilev <v.g.vassilev@gmail.com>2017-05-09 11:25:41 +0000
commit64e1e1ea0a2758ac1e7667a52ef18dd9623a63c9 (patch)
tree18d7dd839deca6b99643a49f245d25da6c42a04d /clang/lib/Sema/SemaDecl.cpp
parent5a741dd8a6bcb97151c8ba4bc74118ecb019929b (diff)
downloadbcm5719-llvm-64e1e1ea0a2758ac1e7667a52ef18dd9623a63c9.tar.gz
bcm5719-llvm-64e1e1ea0a2758ac1e7667a52ef18dd9623a63c9.zip
Reland "Warn about unused static file scope function template declarations."
This patch reinstates r299930, reverted in r299956, as a separate diagnostic option (-Wunused-template). llvm-svn: 302518
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 2612023f59d..2d15c75f48f 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -8923,6 +8923,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
if (FunctionTemplate) {
if (NewFD->isInvalidDecl())
FunctionTemplate->setInvalidDecl();
+ MarkUnusedFileScopedDecl(NewFD);
return FunctionTemplate;
}
}
@@ -11023,8 +11024,7 @@ static bool hasDependentAlignment(VarDecl *VD) {
/// FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to perform
/// any semantic actions necessary after any initializer has been attached.
-void
-Sema::FinalizeDeclaration(Decl *ThisDecl) {
+void Sema::FinalizeDeclaration(Decl *ThisDecl) {
// Note that we are no longer parsing the initializer for this declaration.
ParsingInitForAutoVars.erase(ThisDecl);
@@ -11189,9 +11189,8 @@ Sema::FinalizeDeclaration(Decl *ThisDecl) {
if (DC->getRedeclContext()->isFileContext() && VD->isExternallyVisible())
AddPushedVisibilityAttribute(VD);
- // FIXME: Warn on unused templates.
- if (VD->isFileVarDecl() && !VD->getDescribedVarTemplate() &&
- !isa<VarTemplatePartialSpecializationDecl>(VD))
+ // FIXME: Warn on unused var template partial specializations.
+ if (VD->isFileVarDecl() && !isa<VarTemplatePartialSpecializationDecl>(VD))
MarkUnusedFileScopedDecl(VD);
// Now we have parsed the initializer and can update the table of magic
OpenPOWER on IntegriCloud