stephanemoore created this revision.
Herald added subscribers: cfe-commits, klimek.

Repository:
  rC Clang

https://reviews.llvm.org/D47393

Files:
  lib/Format/Format.cpp
  unittests/Format/FormatTestObjC.cpp


Index: unittests/Format/FormatTestObjC.cpp
===================================================================
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -1193,6 +1193,22 @@
                "}");
 }
 
+TEST_F(FormatTestObjC, AlwaysBreakBeforeMultilineStrings) {
+  FormatStyle Style = getGoogleStyle();
+  verifyFormat("aaaa = @\"bbbb\"\n"
+               "       @\"cccc\";",
+               Style);
+  verifyFormat("aaaa(@\"bbbb\"\n"
+               "     @\"cccc\");",
+               Style);
+  verifyFormat("aaaa(qqq, @\"bbbb\"\n"
+               "          @\"cccc\");",
+               Style);
+  verifyFormat("NSString *const kString = @\"aaaa\"\n"
+               "                          @\"bbbb\");",
+               Style);
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: lib/Format/Format.cpp
===================================================================
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -799,6 +799,7 @@
     // has been implemented.
     GoogleStyle.BreakStringLiterals = false;
   } else if (Language == FormatStyle::LK_ObjC) {
+    GoogleStyle.AlwaysBreakBeforeMultilineStrings = false;
     GoogleStyle.ColumnLimit = 100;
   }
 


Index: unittests/Format/FormatTestObjC.cpp
===================================================================
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -1193,6 +1193,22 @@
                "}");
 }
 
+TEST_F(FormatTestObjC, AlwaysBreakBeforeMultilineStrings) {
+  FormatStyle Style = getGoogleStyle();
+  verifyFormat("aaaa = @\"bbbb\"\n"
+               "       @\"cccc\";",
+               Style);
+  verifyFormat("aaaa(@\"bbbb\"\n"
+               "     @\"cccc\");",
+               Style);
+  verifyFormat("aaaa(qqq, @\"bbbb\"\n"
+               "          @\"cccc\");",
+               Style);
+  verifyFormat("NSString *const kString = @\"aaaa\"\n"
+               "                          @\"bbbb\");",
+               Style);
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: lib/Format/Format.cpp
===================================================================
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -799,6 +799,7 @@
     // has been implemented.
     GoogleStyle.BreakStringLiterals = false;
   } else if (Language == FormatStyle::LK_ObjC) {
+    GoogleStyle.AlwaysBreakBeforeMultilineStrings = false;
     GoogleStyle.ColumnLimit = 100;
   }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to