}
if (CurrentToken->is(tok::r_paren)) {
+ if (CurrentToken->Children.empty() ||
+ !CurrentToken->Children[0].isOneOf(tok::l_paren, tok::l_square))
+ Left->DefinesFunctionType = false;
if (CurrentToken->Parent->closesScope())
CurrentToken->Parent->MatchingParen->NoMoreTokensOnLevel = true;
Left->MatchingParen = CurrentToken;
}
if (CurrentToken->isOneOf(tok::r_square, tok::r_brace))
return false;
- if (Left->Parent &&
- !Left->Parent->isOneOf(tok::kw_sizeof, tok::kw_alignof) &&
- CurrentToken->Parent->Type == TT_PointerOrReference &&
+ if (CurrentToken->Parent->Type == TT_PointerOrReference &&
CurrentToken->Parent->Parent->isOneOf(tok::l_paren, tok::coloncolon))
Left->DefinesFunctionType = true;
updateParameterCount(Left, CurrentToken);
"asm(\"movq\\t%%rbx, %%rsi\\n\\t\"\n"
" \"cpuid\\n\\t\"\n"
" \"xchgq\\t%%rbx, %%rsi\\n\\t\"\n"
- " : \"=a\" (*rEAX), \"=S\" (*rEBX), \"=c\" (*rECX), \"=d\" (*rEDX)\n"
+ " : \"=a\"(*rEAX), \"=S\"(*rEBX), \"=c\"(*rECX), \"=d\"(*rEDX)\n"
" : \"a\"(value));");
}
verifyGoogleFormat("A<void*(int*, SomeType*)>;");
verifyGoogleFormat("void* (*a)(int);");
- // Other constructs can look like function types:
+ // Other constructs can look somewhat like function types:
verifyFormat("A<sizeof(*x)> a;");
- verifyFormat("A<alignof(*x)> a;");
+ verifyFormat("#define DEREF_AND_CALL_F(x) f(*x)");
}
TEST_F(FormatTest, BreaksLongDeclarations) {