diff options
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 52764552b0d..d2b79e544e3 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1583,6 +1583,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, const FormatToken &Left = *Right.Previous; if (Left.is(tok::at)) return false; + if (Left.Tok.getObjCKeywordID() == tok::objc_interface) + return false; if (Right.Type == TT_StartOfName || Right.is(tok::kw_operator)) return true; if (Right.isTrailingComment()) diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index d18968afd5a..7d5ad9ba14a 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -5848,6 +5848,16 @@ TEST_F(FormatTest, FormatObjCInterface) { "}\n" "+ (id)init;\n" "@end"); + + FormatStyle OnePerLine = getGoogleStyle(); + OnePerLine.BinPackParameters = false; + verifyFormat("@interface aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ()<\n" + " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" + " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" + " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n" + " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> {\n" + "}", + OnePerLine); } TEST_F(FormatTest, FormatObjCImplementation) { |