summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedvariablecheck.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx
index b6b867dec89c..3d9ca3de0513 100644
--- a/compilerplugins/clang/unusedvariablecheck.cxx
+++ b/compilerplugins/clang/unusedvariablecheck.cxx
@@ -47,6 +47,8 @@ bool UnusedVariableCheck::VisitNamedDecl( NamedDecl* declaration )
const VarDecl* var = cast< VarDecl >( declaration );
if( var->isReferenced() || var->isUsed())
return true;
+ if( var->isDefinedOutsideFunctionOrMethod())
+ return true;
if( CXXRecordDecl* type = var->getType()->getAsCXXRecordDecl())
{
bool warn_unused = false;