Revert "Sema: An extern declaration can't be a redeclaration of a parameter"

This reverts commit r225780, we can't compile line 181 in
sanitizer_platform_limits_posix.cc with this commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225781 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2015-01-13 10:14:57 +00:00
parent 940569b471
commit 29b6ec9d09
2 changed files with 4 additions and 6 deletions

View File

@ -3282,12 +3282,14 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
}
// Check if extern is followed by non-extern and vice-versa.
if (New->hasGlobalStorage() && !Old->hasLinkage() && Old->hasLocalStorage()) {
if (New->hasExternalStorage() &&
!Old->hasLinkage() && Old->isLocalVarDecl()) {
Diag(New->getLocation(), diag::err_extern_non_extern) << New->getDeclName();
Diag(OldLocation, PrevDiag);
return New->setInvalidDecl();
}
if (Old->hasGlobalStorage() && !New->hasLinkage() && New->hasLocalStorage()) {
if (Old->hasLinkage() && New->isLocalVarDecl() &&
!New->hasExternalStorage()) {
Diag(New->getLocation(), diag::err_non_extern_extern) << New->getDeclName();
Diag(OldLocation, PrevDiag);
return New->setInvalidDecl();

View File

@ -83,7 +83,3 @@ __private_extern__ int g19;
int g19 = 0;
__private_extern__ int g20 = 0;
void f10(int g20) { // expected-note{{previous definition is here}}
extern int g20; // expected-error{{extern declaration of 'g20' follows non-extern declaration}}
}