diff options
author | Ben Hamilton <benhamilton@google.com> | 2018-06-14 17:30:10 +0000 |
---|---|---|
committer | Ben Hamilton <benhamilton@google.com> | 2018-06-14 17:30:10 +0000 |
commit | 1ab722ed17d35ebd7de80c8f9facefce819f3f40 (patch) | |
tree | 69e4ea6814d50b9c6b3db67ec1543be811508099 | |
parent | bdb0a58c91d0ff716bba49820d2a7fa007243c09 (diff) | |
download | bcm5719-llvm-1ab722ed17d35ebd7de80c8f9facefce819f3f40.tar.gz bcm5719-llvm-1ab722ed17d35ebd7de80c8f9facefce819f3f40.zip |
[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
llvm-svn: 334739
-rw-r--r-- | clang/lib/Format/Format.cpp | 1 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTestObjC.cpp | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 71fc81ad503..76dfc819507 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 c29bf8545ab..fc1ee2574c0 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 |