diff options
| author | Steve Naroff <snaroff@apple.com> | 2008-05-12 22:36:43 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2008-05-12 22:36:43 +0000 |
| commit | a98fe19c7e2eb5ddcb30b512417850f53f8168dc (patch) | |
| tree | b1d73b4103d95a5801860ac440357461e567e013 /clang | |
| parent | 6b8bd513d44b317e73d5df3744f600c7d45e584d (diff) | |
| download | bcm5719-llvm-a98fe19c7e2eb5ddcb30b512417850f53f8168dc.tar.gz bcm5719-llvm-a98fe19c7e2eb5ddcb30b512417850f53f8168dc.zip | |
Fix <rdar://problem/5924576> clang -fsyntax-only generates "redefinition" errors when parsing AppKit that gcc does not.
Teach Sema::MergeVarDecl() about __private_extern__.
llvm-svn: 51005
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 5 | ||||
| -rw-r--r-- | clang/test/Sema/tentative-decls.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 933a3618120..26fbafdd408 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -441,8 +441,11 @@ VarDecl *Sema::MergeVarDecl(VarDecl *New, Decl *OldD) { if (NewIsTentative || OldIsTentative) return New; } + // Handle __private_extern__ just like extern. if (Old->getStorageClass() != VarDecl::Extern && - New->getStorageClass() != VarDecl::Extern) { + Old->getStorageClass() != VarDecl::PrivateExtern && + New->getStorageClass() != VarDecl::Extern && + New->getStorageClass() != VarDecl::PrivateExtern) { Diag(New->getLocation(), diag::err_redefinition, New->getName()); Diag(Old->getLocation(), diag::err_previous_definition); } diff --git a/clang/test/Sema/tentative-decls.c b/clang/test/Sema/tentative-decls.c index 0c390fe4144..6e79a0868fd 100644 --- a/clang/test/Sema/tentative-decls.c +++ b/clang/test/Sema/tentative-decls.c @@ -18,6 +18,9 @@ extern int i1; // expected-error{{previous definition is here}} static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}} expected-error{{previous definition is here}} int i1 = 3; // expected-error{{non-static declaration of 'i1' follows static declaration}} +__private_extern__ int pExtern; +int pExtern = 0; + void func() { extern int i1; // expected-error{{previous definition is here}} static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}} |

