================ @@ -5339,16 +5339,22 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, TypeSpecType == DeclSpec::TST_interface || TypeSpecType == DeclSpec::TST_union || TypeSpecType == DeclSpec::TST_enum) { - for (const ParsedAttr &AL : DS.getAttributes()) - Diag(AL.getLoc(), AL.isRegularKeywordAttribute() - ? diag::err_declspec_keyword_has_no_effect - : diag::warn_declspec_attribute_ignored) - << AL << GetDiagnosticTypeSpecifierID(DS); - for (const ParsedAttr &AL : DeclAttrs) - Diag(AL.getLoc(), AL.isRegularKeywordAttribute() - ? diag::err_declspec_keyword_has_no_effect - : diag::warn_declspec_attribute_ignored) + + auto EmitAttributeDiagnostic = [this, &DS](const ParsedAttr &AL) { + unsigned DiagnosticId; + if (AL.isAlignas() && !getLangOpts().CPlusPlus) { + DiagnosticId = diag::warn_attribute_ignored; + } else if (AL.isRegularKeywordAttribute()) { + DiagnosticId = diag::err_declspec_keyword_has_no_effect; + } else { + DiagnosticId = diag::warn_declspec_attribute_ignored; + } ---------------- AaronBallman wrote:
```suggestion unsigned DiagnosticId = diag::warn_declspec_attribute_ignored; if (AL.isAlignas() && !getLangOpts().CPlusPlus) DiagnosticId = diag::warn_attribute_ignored; else if (AL.isRegularKeywordAttribute()) DiagnosticId = diag::err_declspec_keyword_has_no_effect; ``` Changes for our odd choice coding style and to be slightly more succinct. https://github.com/llvm/llvm-project/pull/65638 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits