Fix dereference formatting in for-loops.

Before: for (char **a = b; * a; ++a) {}
After:  for (char **a = b; *a; ++a) {}
llvm-svn: 177037
This commit is contained in:
Daniel Jasper 2013-03-14 10:50:25 +00:00
parent 140cd84155
commit ae9076457e
2 changed files with 2 additions and 1 deletions

View File

@ -661,7 +661,7 @@ private:
return TT_PointerOrReference;
if (PrevToken->isOneOf(tok::l_paren, tok::l_square, tok::l_brace,
tok::comma, tok::kw_return, tok::colon,
tok::comma, tok::semi, tok::kw_return, tok::colon,
tok::equal) ||
PrevToken->Type == TT_BinaryOperator ||
PrevToken->Type == TT_UnaryOperator || PrevToken->Type == TT_CastRParen)

View File

@ -1919,6 +1919,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
"const char *const p = reinterpret_cast<const char *const>(q);");
verifyIndependentOfContext("A<int **, int **> a;");
verifyIndependentOfContext("void f(int *a = d * e, int *b = c * d);");
verifyFormat("for (char **a = b; *a; ++a) {\n}");
verifyFormat(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"