diff options
author | Birunthan Mohanathas <birunthan@mohanathas.com> | 2015-07-15 19:11:58 +0000 |
---|---|---|
committer | Birunthan Mohanathas <birunthan@mohanathas.com> | 2015-07-15 19:11:58 +0000 |
commit | 6291795332ac706402980c9d4fe9ef68f64cd802 (patch) | |
tree | 9dc0ad80c5cfb191762e81b28e14628dabb65bd7 /unittests | |
parent | 1fe3c89c686a39128fb395442c9285b785067ede (diff) | |
download | clang-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.cpp | 26 |
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. |