@@ -710,7 +710,8 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
710710// / apply if either '[' begins a message-send.
711711// /
712712// / 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.
714715// /
715716// / If OuterMightBeMessageSend is true, we assume the outer '[' is either an
716717// / 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) {
737738// /
738739// / attribute-argument-clause:
739740// / '(' balanced-token-seq ')'
740- Parser:: CXX11AttributeKind
741+ CXX11AttributeKind
741742Parser::isCXX11AttributeSpecifier (bool Disambiguate,
742743 bool OuterMightBeMessageSend) {
743744 // alignas is an attribute specifier in C++ but not in C23.
744745 if (Tok.is (tok::kw_alignas) && !getLangOpts ().C23 )
745- return CAK_AttributeSpecifier ;
746+ return CXX11AttributeKind::AttributeSpecifier ;
746747
747748 if (Tok.isRegularKeywordAttribute ())
748- return CAK_AttributeSpecifier ;
749+ return CXX11AttributeKind::AttributeSpecifier ;
749750
750751 if (Tok.isNot (tok::l_square) || NextToken ().isNot (tok::l_square))
751- return CAK_NotAttributeSpecifier ;
752+ return CXX11AttributeKind::NotAttributeSpecifier ;
752753
753754 // No tentative parsing if we don't need to look for ']]' or a lambda.
754755 if (!Disambiguate && !getLangOpts ().ObjC )
755- return CAK_AttributeSpecifier ;
756+ return CXX11AttributeKind::AttributeSpecifier ;
756757
757758 // '[[using ns: ...]]' is an attribute.
758759 if (GetLookAheadToken (2 ).is (tok::kw_using))
759- return CAK_AttributeSpecifier ;
760+ return CXX11AttributeKind::AttributeSpecifier ;
760761
761762 RevertingTentativeParsingAction PA (*this );
762763
@@ -769,7 +770,8 @@ Parser::isCXX11AttributeSpecifier(bool Disambiguate,
769770 bool IsAttribute = SkipUntil (tok::r_square);
770771 IsAttribute &= Tok.is (tok::r_square);
771772
772- return IsAttribute ? CAK_AttributeSpecifier : CAK_InvalidAttributeSpecifier;
773+ return IsAttribute ? CXX11AttributeKind::AttributeSpecifier
774+ : CXX11AttributeKind::InvalidAttributeSpecifier;
773775 }
774776
775777 // In Obj-C++11, we need to distinguish four situations:
@@ -792,28 +794,28 @@ Parser::isCXX11AttributeSpecifier(bool Disambiguate,
792794 // We hit a hard error after deciding this was not an attribute.
793795 // FIXME: Don't parse and annotate expressions when disambiguating
794796 // against an attribute.
795- return CAK_NotAttributeSpecifier ;
797+ return CXX11AttributeKind::NotAttributeSpecifier ;
796798 }
797799
798800 switch (Tentative) {
799801 case LambdaIntroducerTentativeParse::MessageSend:
800802 // Case 3: The inner construct is definitely a message send, so the
801803 // outer construct is definitely not an attribute.
802- return CAK_NotAttributeSpecifier ;
804+ return CXX11AttributeKind::NotAttributeSpecifier ;
803805
804806 case LambdaIntroducerTentativeParse::Success:
805807 case LambdaIntroducerTentativeParse::Incomplete:
806808 // This is a lambda-introducer or attribute-specifier.
807809 if (Tok.is (tok::r_square))
808810 // Case 1: C++11 attribute.
809- return CAK_AttributeSpecifier ;
811+ return CXX11AttributeKind::AttributeSpecifier ;
810812
811813 if (OuterMightBeMessageSend)
812814 // Case 4: Lambda in message send.
813- return CAK_NotAttributeSpecifier ;
815+ return CXX11AttributeKind::NotAttributeSpecifier ;
814816
815817 // Case 2: Lambda in array size / index.
816- return CAK_InvalidAttributeSpecifier ;
818+ return CXX11AttributeKind::InvalidAttributeSpecifier ;
817819
818820 case LambdaIntroducerTentativeParse::Invalid:
819821 // No idea what this is; we couldn't parse it as a lambda-introducer.
@@ -830,7 +832,7 @@ Parser::isCXX11AttributeSpecifier(bool Disambiguate,
830832 while (Tok.isNot (tok::r_square)) {
831833 if (Tok.is (tok::comma)) {
832834 // Case 1: Stray commas can only occur in attributes.
833- return CAK_AttributeSpecifier ;
835+ return CXX11AttributeKind::AttributeSpecifier ;
834836 }
835837
836838 // Parse the attribute-token, if present.
@@ -878,10 +880,10 @@ Parser::isCXX11AttributeSpecifier(bool Disambiguate,
878880
879881 if (IsAttribute)
880882 // Case 1: C++11 statement attribute.
881- return CAK_AttributeSpecifier ;
883+ return CXX11AttributeKind::AttributeSpecifier ;
882884
883885 // Case 3: Message send.
884- return CAK_NotAttributeSpecifier ;
886+ return CXX11AttributeKind::NotAttributeSpecifier ;
885887}
886888
887889bool Parser::TrySkipAttributes () {
@@ -2092,8 +2094,9 @@ Parser::TPResult Parser::TryParseParameterDeclarationClause(
20922094 }
20932095
20942096 // 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)
20972100 return TPResult::True;
20982101
20992102 ParsedAttributes attrs (AttrFactory);
0 commit comments