@@ -2987,14 +2987,13 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
2987
2987
// Normal access control attribute.
2988
2988
AttrRange = Loc;
2989
2989
2990
-
2991
2990
if (!DiscardAttribute) {
2992
2991
Attributes.add (new (Context) AccessControlAttr (AtLoc, Loc, access));
2993
2992
break ;
2994
2993
}
2995
2994
2996
2995
if (access != cast<AccessControlAttr>(*DuplicateAttribute).getAccess ()) {
2997
- // Diagnose if there is already an access control attribute on
2996
+ // Diagnose if there's already an access control attribute on
2998
2997
// this declaration with a different access level.
2999
2998
diagnose (Loc, diag::multiple_access_level_modifiers)
3000
2999
.highlight (AttrRange);
@@ -3036,15 +3035,17 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
3036
3035
return makeParserSuccess ();
3037
3036
}
3038
3037
3038
+ // Check for duplicate setter access control attributes.
3039
3039
DuplicateAttribute = Attributes.getAttribute <SetterAccessAttr>();
3040
-
3041
- if (!DuplicateAttribute) {
3040
+ DiscardAttribute = DuplicateAttribute != nullptr ;
3041
+
3042
+ if (!DiscardAttribute) {
3042
3043
Attributes.add (new (Context) SetterAccessAttr (AtLoc, AttrRange, access));
3043
3044
break ;
3044
3045
}
3045
3046
3046
3047
if (access != cast<SetterAccessAttr>(*DuplicateAttribute).getAccess ()) {
3047
- // Diagnose if there is already an access control attribute on
3048
+ // Diagnose if there's already an access control attribute on
3048
3049
// this declaration with a different access level.
3049
3050
diagnose (Loc, diag::multiple_access_level_modifiers)
3050
3051
.highlight (AttrRange);
0 commit comments