Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6837,8 +6837,10 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
!AL.existsInTarget(S.Context.getTargetInfo())) {
if (AL.isRegularKeywordAttribute() || AL.isDeclspecAttribute()) {
S.Diag(AL.getLoc(), AL.isRegularKeywordAttribute()
? diag::err_keyword_not_supported_on_target
: diag::warn_unhandled_ms_attribute_ignored)
? static_cast<unsigned>(
diag::err_keyword_not_supported_on_target)
: static_cast<unsigned>(
diag::warn_unhandled_ms_attribute_ignored))
<< AL.getAttrName() << AL.getRange();
} else {
S.DiagnoseUnknownAttribute(AL);
Expand Down
6 changes: 4 additions & 2 deletions clang/lib/Sema/SemaStmtAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,10 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const ParsedAttr &A,
A.existsInTarget(*Aux)))) {
if (A.isRegularKeywordAttribute() || A.isDeclspecAttribute()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I agree with corentin, just breaking this up into 2 branches (an if (A.isRegularKeywordAttribute()) and else if (A.isDeclspecAttribute()) is probably better. As it is, we're basically checking the regular keyword 2x.

Else, this patch is fine for me.

S.Diag(A.getLoc(), A.isRegularKeywordAttribute()
? diag::err_keyword_not_supported_on_target
: diag::warn_unhandled_ms_attribute_ignored)
? static_cast<unsigned>(
diag::err_keyword_not_supported_on_target)
: static_cast<unsigned>(
diag::warn_unhandled_ms_attribute_ignored))
<< A << A.getRange();
} else {
S.DiagnoseUnknownAttribute(A);
Expand Down