]> granicus.if.org Git - clang/commitdiff
[clang-format] Disable string literal breaking for text protos
authorKrasimir Georgiev <krasimir@google.com>
Wed, 24 Jan 2018 11:18:39 +0000 (11:18 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Wed, 24 Jan 2018 11:18:39 +0000 (11:18 +0000)
Summary:
Commonly string literals in protos are already multiline, so breaking them
further is undesirable.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323319 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/Format.cpp

index 0da0cea708c32110c4e0c5dc6b5a3a353ffac2f8..b709e9f84a77d7f8c78d5de799d0ebf79df419bd 100644 (file)
@@ -675,6 +675,12 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) {
   if (Language == FormatStyle::LK_TextProto) {
     FormatStyle GoogleStyle = getGoogleStyle(FormatStyle::LK_Proto);
     GoogleStyle.Language = FormatStyle::LK_TextProto;
+
+    // Text protos are currently mostly formatted inside C++ raw string literals
+    // and often the current breaking behavior of string literals is not
+    // beneficial there. Investigate turning this on once proper string reflow
+    // has been implemented.
+    GoogleStyle.BreakStringLiterals = false;
     return GoogleStyle;
   }