Skip to content

Commit 80c0b2c

Browse files
committed
refactor diag code
1 parent 85d3f92 commit 80c0b2c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

clang/lib/Parse/ParseDecl.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3703,17 +3703,17 @@ void Parser::ParseDeclarationSpecifiers(
37033703
// We reject AT_LifetimeBound and AT_AnyX86NoCfCheck, even though they
37043704
// are type attributes, because we historically haven't allowed these
37053705
// to be used as type attributes in C++11 / C23 syntax.
3706-
if (PA.getKind() == ParsedAttr::AT_LifetimeBound) {
3706+
if (PA.isTypeAttr() && PA.getKind() != ParsedAttr::AT_LifetimeBound &&
3707+
PA.getKind() != ParsedAttr::AT_AnyX86NoCfCheck)
3708+
continue;
3709+
3710+
if (PA.getKind() == ParsedAttr::AT_LifetimeBound)
37073711
Diag(PA.getLoc(), diag::err_attribute_wrong_decl_type_str)
37083712
<< PA << PA.isRegularKeywordAttribute()
37093713
<< "parameters and implicit object parameters";
3710-
PA.setInvalid();
3711-
continue;
3712-
}
3713-
if (PA.isTypeAttr() && PA.getKind() != ParsedAttr::AT_AnyX86NoCfCheck)
3714-
continue;
3715-
Diag(PA.getLoc(), diag::err_attribute_not_type_attr)
3716-
<< PA << PA.isRegularKeywordAttribute();
3714+
else
3715+
Diag(PA.getLoc(), diag::err_attribute_not_type_attr)
3716+
<< PA << PA.isRegularKeywordAttribute();
37173717
PA.setInvalid();
37183718
}
37193719

0 commit comments

Comments
 (0)