diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index c5119f79583b..a55f41647425 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -1815,14 +1815,11 @@ def err_attribute_unsupported : Error< def err_aligned_attribute_argument_not_int : Error< "'aligned' attribute requires integer constant">; def err_alignas_attribute_wrong_decl_type : Error< - "'%select{alignas|_Alignas}0' attribute cannot be applied to a %select{" - "function parameter|variable with 'register' storage class|" - "'catch' variable|bit-field}1">; + "%0 attribute cannot be applied to a %select{function parameter|" + "variable with 'register' storage class|'catch' variable|bit-field}1">; def err_alignas_missing_on_definition : Error< - "'%select{alignas|_Alignas}0' must be specified on definition if it is " - "specified on any declaration">; -def note_alignas_on_declaration : Note< - "declared with '%select{alignas|_Alignas}0' attribute here">; + "%0 must be specified on definition if it is specified on any declaration">; +def note_alignas_on_declaration : Note<"declared with %0 attribute here">; def err_alignas_mismatch : Error< "redeclaration has different alignment requirement (%1 vs %0)">; def err_alignas_underaligned : Error< diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 493b9be11670..b89ccce832de 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1937,9 +1937,9 @@ static bool mergeAlignedAttrs(Sema &S, NamedDecl *New, Decl *Old) { // specifier, any other declaration of that object shall also // have no alignment specifier. S.Diag(New->getLocation(), diag::err_alignas_missing_on_definition) - << OldAlignasAttr->isC11(); + << OldAlignasAttr; S.Diag(OldAlignasAttr->getLocation(), diag::note_alignas_on_declaration) - << OldAlignasAttr->isC11(); + << OldAlignasAttr; } 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 // have no alignment specifier. S.Diag(Def->getLocation(), diag::err_alignas_missing_on_definition) - << AA->isC11(); + << AA; S.Diag(NewAttribute->getLocation(), diag::note_alignas_on_declaration) - << AA->isC11(); + << AA; NewAttributes.erase(NewAttributes.begin() + I); --E; continue; diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index ff9134624025..dbbd4a16248d 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2793,15 +2793,14 @@ void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, if (FD->isBitField()) DiagKind = 3; } else if (!isa(D)) { - Diag(AttrLoc, diag::err_attribute_wrong_decl_type) - << (TmpAttr.isC11() ? "'_Alignas'" : "'alignas'") + Diag(AttrLoc, diag::err_attribute_wrong_decl_type) << &TmpAttr << (TmpAttr.isC11() ? ExpectedVariableOrField : ExpectedVariableFieldOrTag); return; } if (DiagKind != -1) { Diag(AttrLoc, diag::err_alignas_attribute_wrong_decl_type) - << TmpAttr.isC11() << DiagKind; + << &TmpAttr << DiagKind; return; } }