aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-04-28 07:34:48 +0000
committerDaniel Jasper <djasper@google.com>2014-04-28 07:34:48 +0000
commit4145db1ccb327a39726edbbb1069d5585aec4d65 (patch)
tree54b09eb61877065ed198a92dffe5e3e1c3061838
parentd53fa2e0646e4f1182d4fa47f9934756ba2d8b73 (diff)
downloadclang_35a-4145db1ccb327a39726edbbb1069d5585aec4d65.tar.gz
clang-format: Don't wrap after @interface.
This fixes llvm.org/PR19450. Before: @interface BookmarkHomeHandsetViewController ()<BookmarkAllCollectionViewDelegate, BookmarkFolderCollectionViewDelegate, BookmarkMenuViewControllerDelegate, BookmarkSearchViewControllerDelegate> { } After: @interface aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ()< aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> { } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207400 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Format/TokenAnnotator.cpp2
-rw-r--r--unittests/Format/FormatTest.cpp10
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 52764552b0..d2b79e544e 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/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/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index d18968afd5..7d5ad9ba14 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/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) {