Fix <rdar://problem/5924576> clang -fsyntax-only generates "redefinition" errors when parsing AppKit that gcc does not.
Teach Sema::MergeVarDecl() about __private_extern__.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51005 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 933a361..26fbafd 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -441,8 +441,11 @@
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);
}