forked from OSchip/llvm-project
Removed an unnecessary %select from the alignas diagnostics. The attribute already knows how it was spelled.
llvm-svn: 198375
This commit is contained in:
parent
eba457c2f8
commit
3d216a579c
|
@ -1815,14 +1815,11 @@ def err_attribute_unsupported : Error<
|
||||||
def err_aligned_attribute_argument_not_int : Error<
|
def err_aligned_attribute_argument_not_int : Error<
|
||||||
"'aligned' attribute requires integer constant">;
|
"'aligned' attribute requires integer constant">;
|
||||||
def err_alignas_attribute_wrong_decl_type : Error<
|
def err_alignas_attribute_wrong_decl_type : Error<
|
||||||
"'%select{alignas|_Alignas}0' attribute cannot be applied to a %select{"
|
"%0 attribute cannot be applied to a %select{function parameter|"
|
||||||
"function parameter|variable with 'register' storage class|"
|
"variable with 'register' storage class|'catch' variable|bit-field}1">;
|
||||||
"'catch' variable|bit-field}1">;
|
|
||||||
def err_alignas_missing_on_definition : Error<
|
def err_alignas_missing_on_definition : Error<
|
||||||
"'%select{alignas|_Alignas}0' must be specified on definition if it is "
|
"%0 must be specified on definition if it is specified on any declaration">;
|
||||||
"specified on any declaration">;
|
def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
|
||||||
def note_alignas_on_declaration : Note<
|
|
||||||
"declared with '%select{alignas|_Alignas}0' attribute here">;
|
|
||||||
def err_alignas_mismatch : Error<
|
def err_alignas_mismatch : Error<
|
||||||
"redeclaration has different alignment requirement (%1 vs %0)">;
|
"redeclaration has different alignment requirement (%1 vs %0)">;
|
||||||
def err_alignas_underaligned : Error<
|
def err_alignas_underaligned : Error<
|
||||||
|
|
|
@ -1937,9 +1937,9 @@ static bool mergeAlignedAttrs(Sema &S, NamedDecl *New, Decl *Old) {
|
||||||
// specifier, any other declaration of that object shall also
|
// specifier, any other declaration of that object shall also
|
||||||
// have no alignment specifier.
|
// have no alignment specifier.
|
||||||
S.Diag(New->getLocation(), diag::err_alignas_missing_on_definition)
|
S.Diag(New->getLocation(), diag::err_alignas_missing_on_definition)
|
||||||
<< OldAlignasAttr->isC11();
|
<< OldAlignasAttr;
|
||||||
S.Diag(OldAlignasAttr->getLocation(), diag::note_alignas_on_declaration)
|
S.Diag(OldAlignasAttr->getLocation(), diag::note_alignas_on_declaration)
|
||||||
<< OldAlignasAttr->isC11();
|
<< OldAlignasAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AnyAdded = false;
|
bool AnyAdded = false;
|
||||||
|
@ -2095,9 +2095,9 @@ static void checkNewAttributesAfterDef(Sema &S, Decl *New, const Decl *Old) {
|
||||||
// specifier, any other declaration of that object shall also
|
// specifier, any other declaration of that object shall also
|
||||||
// have no alignment specifier.
|
// have no alignment specifier.
|
||||||
S.Diag(Def->getLocation(), diag::err_alignas_missing_on_definition)
|
S.Diag(Def->getLocation(), diag::err_alignas_missing_on_definition)
|
||||||
<< AA->isC11();
|
<< AA;
|
||||||
S.Diag(NewAttribute->getLocation(), diag::note_alignas_on_declaration)
|
S.Diag(NewAttribute->getLocation(), diag::note_alignas_on_declaration)
|
||||||
<< AA->isC11();
|
<< AA;
|
||||||
NewAttributes.erase(NewAttributes.begin() + I);
|
NewAttributes.erase(NewAttributes.begin() + I);
|
||||||
--E;
|
--E;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -2793,15 +2793,14 @@ void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E,
|
||||||
if (FD->isBitField())
|
if (FD->isBitField())
|
||||||
DiagKind = 3;
|
DiagKind = 3;
|
||||||
} else if (!isa<TagDecl>(D)) {
|
} else if (!isa<TagDecl>(D)) {
|
||||||
Diag(AttrLoc, diag::err_attribute_wrong_decl_type)
|
Diag(AttrLoc, diag::err_attribute_wrong_decl_type) << &TmpAttr
|
||||||
<< (TmpAttr.isC11() ? "'_Alignas'" : "'alignas'")
|
|
||||||
<< (TmpAttr.isC11() ? ExpectedVariableOrField
|
<< (TmpAttr.isC11() ? ExpectedVariableOrField
|
||||||
: ExpectedVariableFieldOrTag);
|
: ExpectedVariableFieldOrTag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (DiagKind != -1) {
|
if (DiagKind != -1) {
|
||||||
Diag(AttrLoc, diag::err_alignas_attribute_wrong_decl_type)
|
Diag(AttrLoc, diag::err_alignas_attribute_wrong_decl_type)
|
||||||
<< TmpAttr.isC11() << DiagKind;
|
<< &TmpAttr << DiagKind;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue