[cfe-commits] r106773 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/extern-redecl.c
Fariborz Jahanian
fjahanian at apple.com
Thu Jun 24 11:50:42 PDT 2010
Author: fjahanian
Date: Thu Jun 24 13:50:41 2010
New Revision: 106773
URL: http://llvm.org/viewvc/llvm-project?rev=106773&view=rev
Log:
Fixes a regression when redeclaration of a global satic
is an extern local to a function. Radar 8125274.
Added:
cfe/trunk/test/Sema/extern-redecl.c
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=106773&r1=106772&r2=106773&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Jun 24 13:50:41 2010
@@ -1456,7 +1456,8 @@
}
if (New->hasExternalStorage() &&
- Old->getLinkage() == InternalLinkage)
+ Old->getLinkage() == InternalLinkage &&
+ New->getDeclContext() == Old->getDeclContext())
New->setStorageClass(Old->getStorageClass());
// Keep a chain of previous declarations.
Added: cfe/trunk/test/Sema/extern-redecl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/extern-redecl.c?rev=106773&view=auto
==============================================================================
--- cfe/trunk/test/Sema/extern-redecl.c (added)
+++ cfe/trunk/test/Sema/extern-redecl.c Thu Jun 24 13:50:41 2010
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+
+// rdar: // 8125274
+static int a16[]; // expected-warning {{tentative array definition assumed to have one element}}
+
+void f16(void) {
+ extern int a16[];
+}
+
More information about the cfe-commits
mailing list