diff options
-rw-r--r-- | lib/Format/TokenAnnotator.cpp | 3 | ||||
-rw-r--r-- | unittests/Format/FormatTest.cpp | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 427157e332..24e2b1f87e 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -1137,7 +1137,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, if (Right.Type == TT_ConditionalExpr || Right.is(tok::question)) return true; if (Right.Type == TT_RangeBasedForLoopColon || - Right.Type == TT_InheritanceColon) + Right.Type == TT_InheritanceColon || + Right.Type == TT_OverloadedOperatorLParen) return false; if (Left.Type == TT_RangeBasedForLoopColon || Left.Type == TT_InheritanceColon) diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index e01034b09a..54e7381207 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -2226,6 +2226,10 @@ TEST_F(FormatTest, UndestandsOverloadedOperators) { verifyFormat( "ostream &operator<<(ostream &OutputStream,\n" " SomeReallyLongType WithSomeReallyLongValue);"); + verifyFormat("bool operator<(const aaaaaaaaaaaaaaaaaaaaa &left,\n" + " const aaaaaaaaaaaaaaaaaaaaa &right) {\n" + " return left.group < right.group;\n" + "}"); verifyGoogleFormat("operator void*();"); verifyGoogleFormat("operator SomeType<SomeType<int>>();"); |