@@ -607,23 +607,23 @@ Parser::isCXXConditionDeclarationOrInitStatement(bool CanBeInitStatement,
607607 return ConditionOrInitStatement::Expression;
608608}
609609
610- // / Determine whether the next set of tokens contains a type-id.
611- // /
612- // / The context parameter states what context we're parsing right
613- // / now, which affects how this routine copes with the token
614- // / following the type-id. If the context is TypeIdInParens, we have
615- // / already parsed the '(' and we will cease lookahead when we hit
616- // / the corresponding ')'. If the context is
617- // / TypeIdAsTemplateArgument , we've already parsed the '<' or ', '
618- // / before this template argument, and will cease lookahead when we
619- // / hit a '>', '>>' (in C++0x), or ','; or, in C++0x, an ellipsis immediately
620- // / preceding such. Returns true for a type-id and false for an expression.
621- // / If during the disambiguation process a parsing error is encountered,
622- // / the function returns true to let the declaration parsing code handle it.
623- // /
624- // / type-id:
625- // / type-specifier-seq abstract-declarator[opt]
626- // /
610+ // / Determine whether the next set of tokens contains a type-id.
611+ // /
612+ // / The context parameter states what context we're parsing right
613+ // / now, which affects how this routine copes with the token
614+ // / following the type-id. If the context is
615+ // / TentativeCXXTypeIdContext::InParens, we have already parsed the '(' and we
616+ // / will cease lookahead when we hit the corresponding ')'. If the context is
617+ // / TentativeCXXTypeIdContext::AsTemplateArgument , we've already parsed the '<'
618+ // / or ',' before this template argument, and will cease lookahead when we hit a
619+ // / '>', '>>' (in C++0x), or ','; or, in C++0x, an ellipsis immediately
620+ // / preceding such. Returns true for a type-id and false for an expression.
621+ // / If during the disambiguation process a parsing error is encountered,
622+ // / the function returns true to let the declaration parsing code handle it.
623+ // /
624+ // / type-id:
625+ // / type-specifier-seq abstract-declarator[opt]
626+ // /
627627bool Parser::isCXXTypeId (TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
628628
629629 isAmbiguous = false ;
@@ -665,20 +665,23 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
665665 if (TPR == TPResult::Ambiguous) {
666666 // We are supposed to be inside parens, so if after the abstract declarator
667667 // we encounter a ')' this is a type-id, otherwise it's an expression.
668- if (Context == TypeIdInParens && Tok.is (tok::r_paren)) {
668+ if (Context == TentativeCXXTypeIdContext::InParens &&
669+ Tok.is (tok::r_paren)) {
669670 TPR = TPResult::True;
670671 isAmbiguous = true ;
671672 // We are supposed to be inside the first operand to a _Generic selection
672673 // expression, so if we find a comma after the declarator, we've found a
673674 // type and not an expression.
674- } else if (Context == TypeIdAsGenericSelectionArgument && Tok.is (tok::comma)) {
675+ } else if (Context ==
676+ TentativeCXXTypeIdContext::AsGenericSelectionArgument &&
677+ Tok.is (tok::comma)) {
675678 TPR = TPResult::True;
676679 isAmbiguous = true ;
677680 // We are supposed to be inside a template argument, so if after
678681 // the abstract declarator we encounter a '>', '>>' (in C++0x), or
679682 // ','; or, in C++0x, an ellipsis immediately preceding such, this
680683 // is a type-id. Otherwise, it's an expression.
681- } else if (Context == TypeIdAsTemplateArgument &&
684+ } else if (Context == TentativeCXXTypeIdContext::AsTemplateArgument &&
682685 (Tok.isOneOf (tok::greater, tok::comma) ||
683686 (getLangOpts ().CPlusPlus11 &&
684687 (Tok.isOneOf (tok::greatergreater,
@@ -690,7 +693,7 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
690693 TPR = TPResult::True;
691694 isAmbiguous = true ;
692695
693- } else if (Context == TypeIdInTrailingReturnType ) {
696+ } else if (Context == TentativeCXXTypeIdContext::InTrailingReturnType ) {
694697 TPR = TPResult::True;
695698 isAmbiguous = true ;
696699 } else
@@ -2246,7 +2249,7 @@ Parser::TryParseFunctionDeclarator(bool MayHaveTrailingReturnType) {
22462249 if (Tok.is (tok::identifier) && NameAfterArrowIsNonType ()) {
22472250 return TPResult::False;
22482251 }
2249- if (isCXXTypeId (TentativeCXXTypeIdContext::TypeIdInTrailingReturnType ))
2252+ if (isCXXTypeId (TentativeCXXTypeIdContext::InTrailingReturnType ))
22502253 return TPResult::True;
22512254 }
22522255
0 commit comments