diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-08 20:03:18 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-08 20:03:18 +0000 |
commit | 2db356d619fbf56e342fbc3fd5301e2e539e51b6 (patch) | |
tree | db36a7a04d63b66bd07bfe5d550a68e76605184a | |
parent | a6d2020412455ec582454811435202eadc037081 (diff) |
Don't break after unary operators.
Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171890 91177308-0d34-0410-b5e6-96231b3b80d8
-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;"); |