@@ -710,7 +710,8 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
710
710
// / apply if either '[' begins a message-send.
711
711
// /
712
712
// / If Disambiguate is true, we try harder to determine whether a '[[' starts
713
- // / an attribute-specifier, and return CAK_InvalidAttributeSpecifier if not.
713
+ // / an attribute-specifier, and return
714
+ // / CXX11AttributeKind::InvalidAttributeSpecifier if not.
714
715
// /
715
716
// / If OuterMightBeMessageSend is true, we assume the outer '[' is either an
716
717
// / Obj-C message send or the start of an attribute. Otherwise, we assume it
@@ -737,26 +738,26 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
737
738
// /
738
739
// / attribute-argument-clause:
739
740
// / '(' balanced-token-seq ')'
740
- Parser:: CXX11AttributeKind
741
+ CXX11AttributeKind
741
742
Parser::isCXX11AttributeSpecifier (bool Disambiguate,
742
743
bool OuterMightBeMessageSend) {
743
744
// alignas is an attribute specifier in C++ but not in C23.
744
745
if (Tok.is (tok::kw_alignas) && !getLangOpts ().C23 )
745
- return CAK_AttributeSpecifier ;
746
+ return CXX11AttributeKind::AttributeSpecifier ;
746
747
747
748
if (Tok.isRegularKeywordAttribute ())
748
- return CAK_AttributeSpecifier ;
749
+ return CXX11AttributeKind::AttributeSpecifier ;
749
750
750
751
if (Tok.isNot (tok::l_square) || NextToken ().isNot (tok::l_square))
751
- return CAK_NotAttributeSpecifier ;
752
+ return CXX11AttributeKind::NotAttributeSpecifier ;
752
753
753
754
// No tentative parsing if we don't need to look for ']]' or a lambda.
754
755
if (!Disambiguate && !getLangOpts ().ObjC )
755
- return CAK_AttributeSpecifier ;
756
+ return CXX11AttributeKind::AttributeSpecifier ;
756
757
757
758
// '[[using ns: ...]]' is an attribute.
758
759
if (GetLookAheadToken (2 ).is (tok::kw_using))
759
- return CAK_AttributeSpecifier ;
760
+ return CXX11AttributeKind::AttributeSpecifier ;
760
761
761
762
RevertingTentativeParsingAction PA (*this );
762
763
@@ -769,7 +770,8 @@ Parser::isCXX11AttributeSpecifier(bool Disambiguate,
769
770
bool IsAttribute = SkipUntil (tok::r_square);
770
771
IsAttribute &= Tok.is (tok::r_square);
771
772
772
- return IsAttribute ? CAK_AttributeSpecifier : CAK_InvalidAttributeSpecifier;
773
+ return IsAttribute ? CXX11AttributeKind::AttributeSpecifier
774
+ : CXX11AttributeKind::InvalidAttributeSpecifier;
773
775
}
774
776
775
777
// In Obj-C++11, we need to distinguish four situations:
@@ -792,28 +794,28 @@ Parser::isCXX11AttributeSpecifier(bool Disambiguate,
792
794
// We hit a hard error after deciding this was not an attribute.
793
795
// FIXME: Don't parse and annotate expressions when disambiguating
794
796
// against an attribute.
795
- return CAK_NotAttributeSpecifier ;
797
+ return CXX11AttributeKind::NotAttributeSpecifier ;
796
798
}
797
799
798
800
switch (Tentative) {
799
801
case LambdaIntroducerTentativeParse::MessageSend:
800
802
// Case 3: The inner construct is definitely a message send, so the
801
803
// outer construct is definitely not an attribute.
802
- return CAK_NotAttributeSpecifier ;
804
+ return CXX11AttributeKind::NotAttributeSpecifier ;
803
805
804
806
case LambdaIntroducerTentativeParse::Success:
805
807
case LambdaIntroducerTentativeParse::Incomplete:
806
808
// This is a lambda-introducer or attribute-specifier.
807
809
if (Tok.is (tok::r_square))
808
810
// Case 1: C++11 attribute.
809
- return CAK_AttributeSpecifier ;
811
+ return CXX11AttributeKind::AttributeSpecifier ;
810
812
811
813
if (OuterMightBeMessageSend)
812
814
// Case 4: Lambda in message send.
813
- return CAK_NotAttributeSpecifier ;
815
+ return CXX11AttributeKind::NotAttributeSpecifier ;
814
816
815
817
// Case 2: Lambda in array size / index.
816
- return CAK_InvalidAttributeSpecifier ;
818
+ return CXX11AttributeKind::InvalidAttributeSpecifier ;
817
819
818
820
case LambdaIntroducerTentativeParse::Invalid:
819
821
// No idea what this is; we couldn't parse it as a lambda-introducer.
@@ -830,7 +832,7 @@ Parser::isCXX11AttributeSpecifier(bool Disambiguate,
830
832
while (Tok.isNot (tok::r_square)) {
831
833
if (Tok.is (tok::comma)) {
832
834
// Case 1: Stray commas can only occur in attributes.
833
- return CAK_AttributeSpecifier ;
835
+ return CXX11AttributeKind::AttributeSpecifier ;
834
836
}
835
837
836
838
// Parse the attribute-token, if present.
@@ -878,10 +880,10 @@ Parser::isCXX11AttributeSpecifier(bool Disambiguate,
878
880
879
881
if (IsAttribute)
880
882
// Case 1: C++11 statement attribute.
881
- return CAK_AttributeSpecifier ;
883
+ return CXX11AttributeKind::AttributeSpecifier ;
882
884
883
885
// Case 3: Message send.
884
- return CAK_NotAttributeSpecifier ;
886
+ return CXX11AttributeKind::NotAttributeSpecifier ;
885
887
}
886
888
887
889
bool Parser::TrySkipAttributes () {
@@ -2092,8 +2094,9 @@ Parser::TPResult Parser::TryParseParameterDeclarationClause(
2092
2094
}
2093
2095
2094
2096
// An attribute-specifier-seq here is a sign of a function declarator.
2095
- if (isCXX11AttributeSpecifier (/* Disambiguate*/ false ,
2096
- /* OuterMightBeMessageSend*/ true ))
2097
+ if (isCXX11AttributeSpecifier (/* Disambiguate*/ false ,
2098
+ /* OuterMightBeMessageSend*/ true ) !=
2099
+ CXX11AttributeKind::NotAttributeSpecifier)
2097
2100
return TPResult::True;
2098
2101
2099
2102
ParsedAttributes attrs (AttrFactory);
0 commit comments