@@ -607,23 +607,23 @@ Parser::isCXXConditionDeclarationOrInitStatement(bool CanBeInitStatement,
607
607
return ConditionOrInitStatement::Expression;
608
608
}
609
609
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
+ // /
627
627
bool Parser::isCXXTypeId (TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
628
628
629
629
isAmbiguous = false ;
@@ -665,20 +665,23 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
665
665
if (TPR == TPResult::Ambiguous) {
666
666
// We are supposed to be inside parens, so if after the abstract declarator
667
667
// 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)) {
669
670
TPR = TPResult::True;
670
671
isAmbiguous = true ;
671
672
// We are supposed to be inside the first operand to a _Generic selection
672
673
// expression, so if we find a comma after the declarator, we've found a
673
674
// 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)) {
675
678
TPR = TPResult::True;
676
679
isAmbiguous = true ;
677
680
// We are supposed to be inside a template argument, so if after
678
681
// the abstract declarator we encounter a '>', '>>' (in C++0x), or
679
682
// ','; or, in C++0x, an ellipsis immediately preceding such, this
680
683
// is a type-id. Otherwise, it's an expression.
681
- } else if (Context == TypeIdAsTemplateArgument &&
684
+ } else if (Context == TentativeCXXTypeIdContext::AsTemplateArgument &&
682
685
(Tok.isOneOf (tok::greater, tok::comma) ||
683
686
(getLangOpts ().CPlusPlus11 &&
684
687
(Tok.isOneOf (tok::greatergreater,
@@ -690,7 +693,7 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) {
690
693
TPR = TPResult::True;
691
694
isAmbiguous = true ;
692
695
693
- } else if (Context == TypeIdInTrailingReturnType ) {
696
+ } else if (Context == TentativeCXXTypeIdContext::InTrailingReturnType ) {
694
697
TPR = TPResult::True;
695
698
isAmbiguous = true ;
696
699
} else
@@ -2246,7 +2249,7 @@ Parser::TryParseFunctionDeclarator(bool MayHaveTrailingReturnType) {
2246
2249
if (Tok.is (tok::identifier) && NameAfterArrowIsNonType ()) {
2247
2250
return TPResult::False;
2248
2251
}
2249
- if (isCXXTypeId (TentativeCXXTypeIdContext::TypeIdInTrailingReturnType ))
2252
+ if (isCXXTypeId (TentativeCXXTypeIdContext::InTrailingReturnType ))
2250
2253
return TPResult::True;
2251
2254
}
2252
2255
0 commit comments