[clang-format] Disable AlwaysBreakBeforeMultilineStrings in Google style for Objectiv...
authorBen Hamilton <benhamilton@google.com>
Thu, 14 Jun 2018 17:30:10 +0000 (17:30 +0000)
committerBen Hamilton <benhamilton@google.com>
Thu, 14 Jun 2018 17:30:10 +0000 (17:30 +0000)
Contributed by @stephanemoore.

Reviewers: benhamilton, jolesiak, djasper

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

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

llvm-svn: 334739

clang/lib/Format/Format.cpp
clang/unittests/Format/FormatTestObjC.cpp

index 71fc81a..76dfc81 100644 (file)
@@ -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;
   }
 
index c29bf85..fc1ee25 100644 (file)
@@ -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