summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-01-03 19:27:19 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-01-03 19:27:19 +0000
commit8e666510f6f9fa832aa8393be5331ba4456ab63a (patch)
tree4f9b623cd4b90d1eefb2dac0b5db4f94c8bf3dc0 /clang/lib/Sema/SemaDecl.cpp
parent9a7d57d57f50357f138d46f9aa36e29609205d40 (diff)
downloadbcm5719-llvm-8e666510f6f9fa832aa8393be5331ba4456ab63a.tar.gz
bcm5719-llvm-8e666510f6f9fa832aa8393be5331ba4456ab63a.zip
Fix PR8841 by checking for both semantic and lecical dependent
contexts. This prevents -Wunused-function from firing on friend function definitions inside of class templates for example. llvm-svn: 122763
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 32791f9f983..dc851a3e836 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -557,7 +557,8 @@ bool Sema::ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const {
return false;
// Ignore class templates.
- if (D->getDeclContext()->isDependentContext())
+ if (D->getDeclContext()->isDependentContext() ||
+ D->getLexicalDeclContext()->isDependentContext())
return false;
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
OpenPOWER on IntegriCloud