From: Ben Hamilton Date: Thu, 14 Jun 2018 17:30:10 +0000 (+0000) Subject: [clang-format] Disable AlwaysBreakBeforeMultilineStrings in Google style for Objectiv... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8a55f98df6bda77ee2eaa7f7247bd655f79ae0e;p=clang [clang-format] Disable AlwaysBreakBeforeMultilineStrings in Google style for Objective-C 📜 Contributed by @stephanemoore. Reviewers: benhamilton, jolesiak, djasper Reviewed By: benhamilton Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D47393 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334739 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 71fc81ad50..76dfc81950 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -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; } diff --git a/unittests/Format/FormatTestObjC.cpp b/unittests/Format/FormatTestObjC.cpp index c29bf8545a..fc1ee2574c 100644 --- a/unittests/Format/FormatTestObjC.cpp +++ b/unittests/Format/FormatTestObjC.cpp @@ -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