diff options
-rw-r--r-- | lib/Format/Format.cpp | 3 | ||||
-rw-r--r-- | unittests/Format/FormatTest.cpp | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 1205c424b1..a371aa3c4a 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -1049,9 +1049,8 @@ private: if (Left.ClosesTemplateDeclaration) return true; if (Left.Type == TT_PointerOrReference || Left.Type == TT_TemplateCloser || - Right.Type == TT_ConditionalExpr) { + Left.Type == TT_UnaryOperator || Right.Type == TT_ConditionalExpr) return false; - } if (Left.is(tok::equal) && CurrentLineType == LT_VirtualFunctionDecl) return false; diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index d5f74d3daa..339be71530 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -958,7 +958,6 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyFormat("InvalidRegions[*R] = 0;"); - // FIXME: Is this desired for LLVM? Fix if not. verifyFormat("A<int *> a;"); verifyFormat("A<int **> a;"); verifyFormat("A<int *, int *> a;"); @@ -967,6 +966,10 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyFormat("Type *A = (Type *) P;"); verifyFormat("Type *A = (vector<Type *, int *>) P;"); + verifyFormat( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n" + " aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);"); + verifyGoogleFormat("int main(int argc, char** argv) {\n}"); verifyGoogleFormat("A<int*> a;"); verifyGoogleFormat("A<int**> a;"); |