@@ -562,7 +562,7 @@ class AnnotatingParser {
562
562
(CurrentToken->is(tok::l_paren) && CurrentToken->Next &&
563
563
CurrentToken->Next->isOneOf(tok::star, tok::amp, tok::caret));
564
564
if ((CurrentToken->Previous->isOneOf(tok::kw_const, tok::kw_auto) ||
565
- CurrentToken->Previous->isSimpleTypeSpecifier (IsCpp)) &&
565
+ CurrentToken->Previous->isTypeName (IsCpp)) &&
566
566
!(CurrentToken->is(tok::l_brace) ||
567
567
(CurrentToken->is(tok::l_paren) && !ProbablyFunctionTypeLParen))) {
568
568
Contexts.back().IsExpression = false;
@@ -2573,7 +2573,7 @@ class AnnotatingParser {
2573
2573
return true;
2574
2574
2575
2575
// MyClass a;
2576
- if (PreviousNotConst->isSimpleTypeSpecifier (IsCpp))
2576
+ if (PreviousNotConst->isTypeName (IsCpp))
2577
2577
return true;
2578
2578
2579
2579
// type[] a in Java
@@ -2706,8 +2706,7 @@ class AnnotatingParser {
2706
2706
// Heuristically try to determine whether the parentheses contain a type.
2707
2707
auto IsQualifiedPointerOrReference = [this](FormatToken *T) {
2708
2708
// 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");
2711
2710
// Strip trailing qualifiers such as const or volatile when checking
2712
2711
// whether the parens could be a cast to a pointer/reference type.
2713
2712
while (T) {
@@ -2739,7 +2738,7 @@ class AnnotatingParser {
2739
2738
bool ParensAreType =
2740
2739
!Tok.Previous ||
2741
2740
Tok.Previous->isOneOf(TT_TemplateCloser, TT_TypeDeclarationParen) ||
2742
- Tok.Previous->isSimpleTypeSpecifier (IsCpp) ||
2741
+ Tok.Previous->isTypeName (IsCpp) ||
2743
2742
IsQualifiedPointerOrReference(Tok.Previous);
2744
2743
bool ParensCouldEndDecl =
2745
2744
Tok.Next->isOneOf(tok::equal, tok::semi, tok::l_brace, tok::greater);
@@ -3616,7 +3615,7 @@ static bool isFunctionDeclarationName(bool IsCpp, const FormatToken &Current,
3616
3615
Next = Next->Next;
3617
3616
continue;
3618
3617
}
3619
- if ((Next->isSimpleTypeSpecifier (IsCpp) || Next->is(tok::identifier)) &&
3618
+ if ((Next->isTypeName (IsCpp) || Next->is(tok::identifier)) &&
3620
3619
Next->Next && Next->Next->isPointerOrReference()) {
3621
3620
// For operator void*(), operator char*(), operator Foo*().
3622
3621
Next = Next->Next;
@@ -3714,9 +3713,8 @@ static bool isFunctionDeclarationName(bool IsCpp, const FormatToken &Current,
3714
3713
Tok = Tok->MatchingParen;
3715
3714
continue;
3716
3715
}
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)) {
3720
3718
return true;
3721
3719
}
3722
3720
if (Tok->isOneOf(tok::l_brace, TT_ObjCMethodExpr) || Tok->Tok.isLiteral())
@@ -4460,8 +4458,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
4460
4458
if (Right.isPointerOrReference()) {
4461
4459
const FormatToken *Previous = &Left;
4462
4460
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)) {
4465
4462
Previous = Previous->getPreviousNonComment();
4466
4463
continue;
4467
4464
}
@@ -4650,7 +4647,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
4650
4647
if (!Style.isVerilog() &&
4651
4648
(Left.isOneOf(tok::identifier, tok::greater, tok::r_square,
4652
4649
tok::r_paren) ||
4653
- Left.isSimpleTypeSpecifier (IsCpp)) &&
4650
+ Left.isTypeName (IsCpp)) &&
4654
4651
Right.is(tok::l_brace) && Right.getNextNonComment() &&
4655
4652
Right.isNot(BK_Block)) {
4656
4653
return false;
0 commit comments