[cfe-commits] r170377 - in /cfe/trunk: lib/AST/Decl.cpp test/Sema/extern-redecl.c

Rafael Espindola rafael.espindola at gmail.com
Mon Dec 17 14:23:47 PST 2012


Author: rafael
Date: Mon Dec 17 16:23:47 2012
New Revision: 170377

URL: http://llvm.org/viewvc/llvm-project?rev=170377&view=rev
Log:
Fix isThisDeclarationADefinition for extern following tentative.

An extern declaration following a tentative definition should not itself be
considered a tentative definition.
Fixes pr14614.

Modified:
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/test/Sema/extern-redecl.c

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=170377&r1=170376&r2=170377&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon Dec 17 16:23:47 2012
@@ -1220,7 +1220,7 @@
        getStorageClassAsWritten() == SC_PrivateExtern) {
     for (const VarDecl *PrevVar = getPreviousDecl();
          PrevVar; PrevVar = PrevVar->getPreviousDecl()) {
-      if (PrevVar->getLinkage() == InternalLinkage && PrevVar->hasInit())
+      if (PrevVar->getLinkage() == InternalLinkage)
         return DeclarationOnly;
     }
   }

Modified: cfe/trunk/test/Sema/extern-redecl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/extern-redecl.c?rev=170377&r1=170376&r2=170377&view=diff
==============================================================================
--- cfe/trunk/test/Sema/extern-redecl.c (original)
+++ cfe/trunk/test/Sema/extern-redecl.c Mon Dec 17 16:23:47 2012
@@ -20,3 +20,5 @@
   return PR10013_x; // expected-warning{{incompatible pointer to integer conversion}}
 }
 
+static int test1_a[]; // expected-warning {{tentative array definition assumed to have one element}}
+extern int test1_a[];





More information about the cfe-commits mailing list