]> granicus.if.org Git - clang/commitdiff
Fix -Wmissing-variable-declarations regression.
authorEli Friedman <eli.friedman@gmail.com>
Tue, 24 Sep 2013 23:10:08 +0000 (23:10 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Tue, 24 Sep 2013 23:10:08 +0000 (23:10 +0000)
This issue was introduced in r181677.

PR17349.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191339 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/SemaCXX/warn-missing-variable-declarations.cpp

index 92400df00ce2ca51da761663dc0989647c2a721e..fa51aa4c09fd5b2b599915411506145e28de38e6 100644 (file)
@@ -8683,7 +8683,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
   }
 
   if (var->isThisDeclarationADefinition() &&
-      var->isExternallyVisible() &&
+      var->isExternallyVisible() && var->hasLinkage() &&
       getDiagnostics().getDiagnosticLevel(
                        diag::warn_missing_variable_declarations,
                        var->getLocation())) {
index 12af9735d1a9be9627eff065830c712158f267ce..ad23e0429bbdf26a62b8bb70417d1e1ed4b37c16 100644 (file)
@@ -41,3 +41,9 @@ int CGood1::MGood1;
 namespace {
   int mgood4;
 }
+
+class C {
+  void test() {
+    static int x = 0; // no-warn
+  }
+};