r191339 - Fix -Wmissing-variable-declarations regression.
Eli Friedman
eli.friedman at gmail.com
Tue Sep 24 16:10:08 PDT 2013
Author: efriedma
Date: Tue Sep 24 18:10:08 2013
New Revision: 191339
URL: http://llvm.org/viewvc/llvm-project?rev=191339&view=rev
Log:
Fix -Wmissing-variable-declarations regression.
This issue was introduced in r181677.
PR17349.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=191339&r1=191338&r2=191339&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Sep 24 18:10:08 2013
@@ -8683,7 +8683,7 @@ void Sema::CheckCompleteVariableDeclarat
}
if (var->isThisDeclarationADefinition() &&
- var->isExternallyVisible() &&
+ var->isExternallyVisible() && var->hasLinkage() &&
getDiagnostics().getDiagnosticLevel(
diag::warn_missing_variable_declarations,
var->getLocation())) {
Modified: cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp?rev=191339&r1=191338&r2=191339&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp Tue Sep 24 18:10:08 2013
@@ -41,3 +41,9 @@ int CGood1::MGood1;
namespace {
int mgood4;
}
+
+class C {
+ void test() {
+ static int x = 0; // no-warn
+ }
+};
More information about the cfe-commits
mailing list