@@ -1618,7 +1618,7 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
1618
1618
else if (Tok.getText () == " releasenone" )
1619
1619
kind = EffectsKind::ReleaseNone;
1620
1620
else {
1621
- diagnose (Loc, diag::effects_attribute_unknown_option ,
1621
+ diagnose (Loc, diag::attr_unknown_option ,
1622
1622
Tok.getText (), AttrName);
1623
1623
return false ;
1624
1624
}
@@ -1644,8 +1644,7 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
1644
1644
}
1645
1645
1646
1646
if (Tok.isNot (tok::identifier)) {
1647
- diagnose (Loc, diag::optimization_attribute_expect_option, AttrName,
1648
- " none" );
1647
+ diagnose (Loc, diag::attr_expected_option_such_as, AttrName, " none" );
1649
1648
return false ;
1650
1649
}
1651
1650
@@ -1655,8 +1654,7 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
1655
1654
else if (Tok.getText () == " __always" )
1656
1655
kind = InlineKind::Always;
1657
1656
else {
1658
- diagnose (Loc, diag::optimization_attribute_unknown_option,
1659
- Tok.getText (), AttrName);
1657
+ diagnose (Loc, diag::attr_unknown_option, Tok.getText (), AttrName);
1660
1658
return false ;
1661
1659
}
1662
1660
consumeToken (tok::identifier);
@@ -1674,6 +1672,45 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
1674
1672
break ;
1675
1673
}
1676
1674
1675
+ case DAK_ActorIndependent: {
1676
+ // if no option is provided, then it's the 'safe' version.
1677
+ if (!consumeIf (tok::l_paren)) {
1678
+ if (!DiscardAttribute) {
1679
+ AttrRange = SourceRange (Loc, Tok.getRange ().getStart ());
1680
+ Attributes.add (new (Context) ActorIndependentAttr (AtLoc, AttrRange,
1681
+ ActorIndependentKind::Safe));
1682
+ }
1683
+ break ;
1684
+ }
1685
+
1686
+ // otherwise, make sure it looks like an identifier.
1687
+ if (Tok.isNot (tok::identifier)) {
1688
+ diagnose (Loc, diag::attr_expected_option_such_as, AttrName, " unsafe" );
1689
+ return false ;
1690
+ }
1691
+
1692
+ // make sure the identifier is 'unsafe'
1693
+ if (Tok.getText () != " unsafe" ) {
1694
+ diagnose (Loc, diag::attr_unknown_option, Tok.getText (), AttrName);
1695
+ return false ;
1696
+ }
1697
+
1698
+ consumeToken (tok::identifier);
1699
+ AttrRange = SourceRange (Loc, Tok.getRange ().getStart ());
1700
+
1701
+ if (!consumeIf (tok::r_paren)) {
1702
+ diagnose (Loc, diag::attr_expected_rparen, AttrName,
1703
+ DeclAttribute::isDeclModifier (DK));
1704
+ return false ;
1705
+ }
1706
+
1707
+ if (!DiscardAttribute)
1708
+ Attributes.add (new (Context) ActorIndependentAttr (AtLoc, AttrRange,
1709
+ ActorIndependentKind::Unsafe));
1710
+
1711
+ break ;
1712
+ }
1713
+
1677
1714
case DAK_Optimize: {
1678
1715
if (!consumeIf (tok::l_paren)) {
1679
1716
diagnose (Loc, diag::attr_expected_lparen, AttrName,
@@ -1682,8 +1719,7 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
1682
1719
}
1683
1720
1684
1721
if (Tok.isNot (tok::identifier)) {
1685
- diagnose (Loc, diag::optimization_attribute_expect_option, AttrName,
1686
- " speed" );
1722
+ diagnose (Loc, diag::attr_expected_option_such_as, AttrName, " speed" );
1687
1723
return false ;
1688
1724
}
1689
1725
@@ -1695,8 +1731,7 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
1695
1731
else if (Tok.getText () == " size" )
1696
1732
optMode = OptimizationMode::ForSize;
1697
1733
else {
1698
- diagnose (Loc, diag::optimization_attribute_unknown_option,
1699
- Tok.getText (), AttrName);
1734
+ diagnose (Loc, diag::attr_unknown_option, Tok.getText (), AttrName);
1700
1735
return false ;
1701
1736
}
1702
1737
consumeToken (tok::identifier);
0 commit comments