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> {
  }

llvm-svn: 207400
This commit is contained in:
Daniel Jasper 2014-04-28 07:34:48 +00:00
parent 9a342778b9
commit 437c3f5188
2 changed files with 12 additions and 0 deletions

View File

@ -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())

View File

@ -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) {