forked from OSchip/llvm-project
Revert "Sema: err_after_alias is unreachable, remove it"
This reverts commit r226626. err_after_alias is, in fact, reachable. llvm-svn: 226633
This commit is contained in:
parent
e6556a9cea
commit
290d347471
|
@ -3902,6 +3902,8 @@ def warn_missing_variable_declarations : Warning<
|
|||
def err_static_data_member_reinitialization :
|
||||
Error<"static data member %0 already has an initializer">;
|
||||
def err_redefinition : Error<"redefinition of %0">;
|
||||
def err_alias_after_tentative :
|
||||
Error<"alias definition of %0 after tentative definition">;
|
||||
def err_alias_is_definition :
|
||||
Error<"definition %0 cannot also be an alias">;
|
||||
def err_definition_of_implicitly_declared_member : Error<
|
||||
|
|
|
@ -2223,7 +2223,11 @@ static void checkNewAttributesAfterDef(Sema &S, Decl *New, const Decl *Old) {
|
|||
S.CheckForFunctionRedefinition(FD, cast<FunctionDecl>(Def));
|
||||
else {
|
||||
VarDecl *VD = cast<VarDecl>(New);
|
||||
S.Diag(VD->getLocation(), diag::err_redefinition) << VD->getDeclName();
|
||||
unsigned Diag = cast<VarDecl>(Def)->isThisDeclarationADefinition() ==
|
||||
VarDecl::TentativeDefinition
|
||||
? diag::err_alias_after_tentative
|
||||
: diag::err_redefinition;
|
||||
S.Diag(VD->getLocation(), Diag) << VD->getDeclName();
|
||||
S.Diag(Def->getLocation(), diag::note_previous_definition);
|
||||
VD->setInvalidDecl();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,5 @@ static int var2 __attribute((alias("v2"))) = 2; // expected-error {{definition '
|
|||
extern int var3 __attribute__((alias("C"))); // expected-note{{previous definition is here}}
|
||||
int var3 = 3; // expected-error{{redefinition of 'var3'}}
|
||||
|
||||
int v4;
|
||||
int var4;
|
||||
int var4 __attribute((alias("v4"))); // expected-error {{definition 'var4' cannot also be an alias}}
|
||||
int var4; // expected-note{{previous definition is here}}
|
||||
extern int var4 __attribute__((alias("v4"))); // expected-error{{alias definition of 'var4' after tentative definition}}
|
||||
|
|
Loading…
Reference in New Issue