Skip to content

Commit

Permalink
[clang-format] Disable AlwaysBreakBeforeMultilineStrings in Google st…
Browse files Browse the repository at this point in the history
…yle for Objective-C 📜

Contributed by @stephanemoore.

Reviewers: benhamilton, jolesiak, djasper

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D47393

llvm-svn: 334739
  • Loading branch information
bhamiltoncx committed Jun 14, 2018
1 parent bdb0a58 commit 1ab722e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions clang/lib/Format/Format.cpp
Expand Up @@ -823,6 +823,7 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) {
// has been implemented.
GoogleStyle.BreakStringLiterals = false;
} else if (Language == FormatStyle::LK_ObjC) {
GoogleStyle.AlwaysBreakBeforeMultilineStrings = false;
GoogleStyle.ColumnLimit = 100;
}

Expand Down
11 changes: 11 additions & 0 deletions clang/unittests/Format/FormatTestObjC.cpp
Expand Up @@ -1218,6 +1218,17 @@ TEST_F(FormatTestObjC, BreaksCallStatementWhereSemiJustOverTheLimit) {
"}");
}

TEST_F(FormatTestObjC, AlwaysBreakBeforeMultilineStrings) {
Style = getGoogleStyle(FormatStyle::LK_ObjC);
Style.ColumnLimit = 40;
verifyFormat("aaaa = @\"bbbb\"\n"
" @\"cccc\";");
verifyFormat("aaaa(@\"bbbb\"\n"
" @\"cccc\");");
verifyFormat("aaaa(qqq, @\"bbbb\"\n"
" @\"cccc\");");
}

} // end namespace
} // end namespace format
} // end namespace clang

0 comments on commit 1ab722e

Please sign in to comment.