summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorBirunthan Mohanathas <birunthan@mohanathas.com>2015-07-15 19:11:58 +0000
committerBirunthan Mohanathas <birunthan@mohanathas.com>2015-07-15 19:11:58 +0000
commit6291795332ac706402980c9d4fe9ef68f64cd802 (patch)
tree9dc0ad80c5cfb191762e81b28e14628dabb65bd7 /unittests
parent1fe3c89c686a39128fb395442c9285b785067ede (diff)
downloadclang-6291795332ac706402980c9d4fe9ef68f64cd802.tar.gz
clang-format: Fix return type breaking with overloaded operator functions
Differential Revision: http://reviews.llvm.org/D11177 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242316 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 886f58093d..1846aa6849 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -4678,6 +4678,32 @@ TEST_F(FormatTest, DefinitionReturnTypeBreakingStyle) {
"}\n"
"template <class T> T *f(T &c);\n", // No break here.
Style);
+ verifyFormat("class C {\n"
+ " int\n"
+ " operator+() {\n"
+ " return 1;\n"
+ " }\n"
+ " int\n"
+ " operator()() {\n"
+ " return 1;\n"
+ " }\n"
+ "};\n",
+ Style);
+ verifyFormat("void\n"
+ "A::operator()() {}\n"
+ "void\n"
+ "A::operator>>() {}\n"
+ "void\n"
+ "A::operator+() {}\n",
+ Style);
+ verifyFormat("void *operator new(std::size_t s);", // No break here.
+ Style);
+ verifyFormat("void *\n"
+ "operator new(std::size_t s) {}",
+ Style);
+ verifyFormat("void *\n"
+ "operator delete[](void *ptr) {}",
+ Style);
Style.BreakBeforeBraces = FormatStyle::BS_Stroustrup;
verifyFormat("const char *\n"
"f(void)\n" // Break here.