Fix the formatting of pointer/reference types in range-based for loops.
Before: for (int & a : Values) {} After: for (int &a : Values) {} llvm-svn: 173259
This commit is contained in:
parent
4766fe6f10
commit
420d7d333e
|
@ -1262,7 +1262,8 @@ private:
|
|||
}
|
||||
}
|
||||
if (Current.is(tok::kw_return) || Current.is(tok::kw_throw) ||
|
||||
(Current.is(tok::l_paren) && !Line.MustBeDeclaration))
|
||||
(Current.is(tok::l_paren) && !Line.MustBeDeclaration &&
|
||||
(Current.Parent == NULL || Current.Parent->isNot(tok::kw_for))))
|
||||
IsExpression = true;
|
||||
|
||||
if (Current.Type == TT_Unknown) {
|
||||
|
|
|
@ -1356,6 +1356,10 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
|
|||
verifyIndependentOfContext("if (*b[i])");
|
||||
verifyIndependentOfContext("if (int *a = (&b))");
|
||||
verifyIndependentOfContext("while (int *a = &b)");
|
||||
verifyFormat("void f() {\n"
|
||||
" for (const int &v : Values) {\n"
|
||||
" }\n"
|
||||
"}");
|
||||
|
||||
verifyIndependentOfContext("A = new SomeType *[Length]();");
|
||||
verifyGoogleFormat("A = new SomeType* [Length]();");
|
||||
|
|
Loading…
Reference in New Issue