@@ -562,7 +562,7 @@ class AnnotatingParser {
562562 (CurrentToken->is (tok::l_paren) && CurrentToken->Next &&
563563 CurrentToken->Next ->isOneOf (tok::star, tok::amp, tok::caret));
564564 if ((CurrentToken->Previous ->isOneOf (tok::kw_const, tok::kw_auto) ||
565- CurrentToken->Previous ->isSimpleTypeSpecifier (IsCpp)) &&
565+ CurrentToken->Previous ->isTypeName (IsCpp)) &&
566566 !(CurrentToken->is (tok::l_brace) ||
567567 (CurrentToken->is (tok::l_paren) && !ProbablyFunctionTypeLParen))) {
568568 Contexts.back ().IsExpression = false ;
@@ -2573,7 +2573,7 @@ class AnnotatingParser {
25732573 return true ;
25742574
25752575 // MyClass a;
2576- if (PreviousNotConst->isSimpleTypeSpecifier (IsCpp))
2576+ if (PreviousNotConst->isTypeName (IsCpp))
25772577 return true ;
25782578
25792579 // type[] a in Java
@@ -2706,8 +2706,7 @@ class AnnotatingParser {
27062706 // Heuristically try to determine whether the parentheses contain a type.
27072707 auto IsQualifiedPointerOrReference = [this ](FormatToken *T) {
27082708 // This is used to handle cases such as x = (foo *const)&y;
2709- assert (!T->isSimpleTypeSpecifier (IsCpp) &&
2710- " Should have already been checked" );
2709+ assert (!T->isTypeName (IsCpp) && " Should have already been checked" );
27112710 // Strip trailing qualifiers such as const or volatile when checking
27122711 // whether the parens could be a cast to a pointer/reference type.
27132712 while (T) {
@@ -2739,7 +2738,7 @@ class AnnotatingParser {
27392738 bool ParensAreType =
27402739 !Tok.Previous ||
27412740 Tok.Previous ->isOneOf (TT_TemplateCloser, TT_TypeDeclarationParen) ||
2742- Tok.Previous ->isSimpleTypeSpecifier (IsCpp) ||
2741+ Tok.Previous ->isTypeName (IsCpp) ||
27432742 IsQualifiedPointerOrReference (Tok.Previous );
27442743 bool ParensCouldEndDecl =
27452744 Tok.Next ->isOneOf (tok::equal, tok::semi, tok::l_brace, tok::greater);
@@ -3616,7 +3615,7 @@ static bool isFunctionDeclarationName(bool IsCpp, const FormatToken &Current,
36163615 Next = Next->Next ;
36173616 continue ;
36183617 }
3619- if ((Next->isSimpleTypeSpecifier (IsCpp) || Next->is (tok::identifier)) &&
3618+ if ((Next->isTypeName (IsCpp) || Next->is (tok::identifier)) &&
36203619 Next->Next && Next->Next ->isPointerOrReference ()) {
36213620 // For operator void*(), operator char*(), operator Foo*().
36223621 Next = Next->Next ;
@@ -3714,9 +3713,8 @@ static bool isFunctionDeclarationName(bool IsCpp, const FormatToken &Current,
37143713 Tok = Tok->MatchingParen ;
37153714 continue ;
37163715 }
3717- if (Tok->is (tok::kw_const) || Tok->isSimpleTypeSpecifier (IsCpp) ||
3718- Tok->isOneOf (TT_PointerOrReference, TT_StartOfName, tok::ellipsis,
3719- TT_TypeName)) {
3716+ if (Tok->is (tok::kw_const) || Tok->isTypeName (IsCpp) ||
3717+ Tok->isOneOf (TT_PointerOrReference, TT_StartOfName, tok::ellipsis)) {
37203718 return true ;
37213719 }
37223720 if (Tok->isOneOf (tok::l_brace, TT_ObjCMethodExpr) || Tok->Tok .isLiteral ())
@@ -4460,8 +4458,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
44604458 if (Right.isPointerOrReference ()) {
44614459 const FormatToken *Previous = &Left;
44624460 while (Previous && Previous->isNot (tok::kw_operator)) {
4463- if (Previous->is (tok::identifier) ||
4464- Previous->isSimpleTypeSpecifier (IsCpp)) {
4461+ if (Previous->is (tok::identifier) || Previous->isTypeName (IsCpp)) {
44654462 Previous = Previous->getPreviousNonComment ();
44664463 continue ;
44674464 }
@@ -4650,7 +4647,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
46504647 if (!Style.isVerilog () &&
46514648 (Left.isOneOf (tok::identifier, tok::greater, tok::r_square,
46524649 tok::r_paren) ||
4653- Left.isSimpleTypeSpecifier (IsCpp)) &&
4650+ Left.isTypeName (IsCpp)) &&
46544651 Right.is (tok::l_brace) && Right.getNextNonComment () &&
46554652 Right.isNot (BK_Block)) {
46564653 return false ;
0 commit comments