Previous->Type = TT_PointerOrReference;
}
}
- } else if (Current.isOneOf(tok::kw_return, tok::kw_throw) ||
- (Current.is(tok::l_paren) && !Line.MustBeDeclaration &&
- !Line.InPPDirective &&
- (!Current.Previous ||
- !Current.Previous->isOneOf(tok::kw_for, tok::kw_catch)))) {
+ } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) {
Contexts.back().IsExpression = true;
+ } else if (Current.is(tok::l_paren) && !Line.MustBeDeclaration &&
+ !Line.InPPDirective) {
+ bool ParametersOfFunctionType =
+ Current.Previous && Current.Previous->is(tok::r_paren) &&
+ Current.Previous->MatchingParen &&
+ Current.Previous->MatchingParen->Type == TT_FunctionTypeLParen;
+ bool IsForOrCatch = Current.Previous &&
+ Current.Previous->isOneOf(tok::kw_for, tok::kw_catch);
+ Contexts.back().IsExpression = !ParametersOfFunctionType && !IsForOrCatch;
} else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) {
for (FormatToken *Previous = Current.Previous;
Previous && Previous->isOneOf(tok::star, tok::amp);
verifyFormat("auto a = [](int **&, int ***) {};");
verifyFormat("auto PointerBinding = [](const char *S) {};");
verifyFormat("typedef typeof(int(int, int)) *MyFunc;");
+ verifyIndependentOfContext("typedef void (*f)(int *a);");
verifyIndependentOfContext("InvalidRegions[*R] = 0;");