diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 71fc81ad503f930bda79397d816abe7ed2b3c4be..76dfc819507f2784272589a826f05ed8633e35cb 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/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/clang/unittests/Format/FormatTestObjC.cpp b/clang/unittests/Format/FormatTestObjC.cpp index c29bf8545ab11da9bfd5055a7b729446aa5ec1e5..fc1ee2574c0103bc81f940ef224f0dc9e7777bd5 100644 --- a/clang/unittests/Format/FormatTestObjC.cpp +++ b/clang/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