Format overloaded operators like other functions.
This fixes llvm.org/PR16328 (at least partially).
Before:
SomeLoooooooooooooooooooooooooooooogType operator<<(
const SomeLooooooooogType &a, const SomeLooooooooogType &b);
After:
SomeLoooooooooooooooooooooooooooooogType
operator<<(const SomeLooooooooogType &a, const SomeLooooooooogType &b);
llvm-svn: 185908
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 2afd91e..6c70ebb 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2456,6 +2456,13 @@
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
" bbbb bbbb);");
+
+ // Treat overloaded operators like other functions.
+ verifyFormat("SomeLoooooooooooooooooooooooooogType\n"
+ "operator>(const SomeLoooooooooooooooooooooooooogType &other);");
+ verifyGoogleFormat(
+ "SomeLoooooooooooooooooooooooooooooogType operator<<(\n"
+ " const SomeLooooooooogType &a, const SomeLooooooooogType &b);");
}
TEST_F(FormatTest, BreaksFunctionDeclarationsWithTrailingTokens) {