r323319 - [clang-format] Disable string literal breaking for text protos

Krasimir Georgiev via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 24 03:18:39 PST 2018


Author: krasimir
Date: Wed Jan 24 03:18:39 2018
New Revision: 323319

URL: http://llvm.org/viewvc/llvm-project?rev=323319&view=rev
Log:
[clang-format] Disable string literal breaking for text protos

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

Modified:
    cfe/trunk/lib/Format/Format.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=323319&r1=323318&r2=323319&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Jan 24 03:18:39 2018
@@ -675,6 +675,12 @@ FormatStyle getGoogleStyle(FormatStyle::
   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;
   }
 




More information about the cfe-commits mailing list