diff options
-rw-r--r-- | lib/Format/Format.cpp | 5 | ||||
-rw-r--r-- | unittests/Format/FormatTest.cpp | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 69020c6575..7f40e35e1d 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -878,8 +878,9 @@ private: const FormatToken &PrevToken = Line.Tokens[Index - 1]; const FormatToken &NextToken = Line.Tokens[Index + 1]; - if (PrevToken.Tok.is(tok::l_paren) || PrevToken.Tok.is(tok::comma) || - PrevToken.Tok.is(tok::kw_return) || PrevToken.Tok.is(tok::colon) || + if (PrevToken.Tok.is(tok::l_paren) || PrevToken.Tok.is(tok::l_square) || + PrevToken.Tok.is(tok::comma) || PrevToken.Tok.is(tok::kw_return) || + PrevToken.Tok.is(tok::colon) || Annotations[Index - 1].Type == TokenAnnotation::TT_BinaryOperator) return TokenAnnotation::TT_UnaryOperator; diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 8eadb545f7..c17bc0d76b 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -768,6 +768,8 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyFormat("a * ++b;"); verifyFormat("a * --b;"); + verifyFormat("InvalidRegions[*R] = 0;"); + // FIXME: Is this desired for LLVM? Fix if not. verifyFormat("A<int *> a;"); verifyFormat("A<int **> a;"); |