[PATCH] D42373: [clang-format] Disable string literal breaking for text protos

2018-01-24 Thread Krasimir Georgiev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323319: [clang-format] Disable string literal breaking for 
text protos (authored by krasimir, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D42373

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


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -675,6 +675,12 @@
   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;
   }
 


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -675,6 +675,12 @@
   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;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42373: [clang-format] Disable string literal breaking for text protos

2018-01-24 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir updated this revision to Diff 131216.
krasimir added a comment.

- Update comment


Repository:
  rC Clang

https://reviews.llvm.org/D42373

Files:
  lib/Format/Format.cpp


Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -675,6 +675,12 @@
   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;
   }
 


Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -675,6 +675,12 @@
   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;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42373: [clang-format] Disable string literal breaking for text protos

2018-01-24 Thread Daniel Jasper via Phabricator via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Change the comment and possibly also the patch description along the lines of 
what I have suggested. Other than that, looks good to me.




Comment at: lib/Format/Format.cpp:679
+
+// In protos, string literals are commonly multiline and already broken-up.
+// Don't break them up even further, especially since we don't support

Make this comment:

  // 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.


Repository:
  rC Clang

https://reviews.llvm.org/D42373



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42373: [clang-format] Disable string literal breaking for text protos

2018-01-24 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added a comment.

So, we found out other cases where this is especially painful:

- breaking long URLs into multiple lines
- updating the text of a paragraph and breaking again with combination of 
no-reflow

We could disable it for now and enable it when we have string literal reflow.


Repository:
  rC Clang

https://reviews.llvm.org/D42373



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42373: [clang-format] Disable string literal breaking for text protos

2018-01-23 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added a comment.

Let's not do this then. For reflowing string literals, it could take a 
two-three months.


Repository:
  rC Clang

https://reviews.llvm.org/D42373



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42373: [clang-format] Disable string literal breaking for text protos

2018-01-23 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added a comment.

I am not sure we should actually do this. I agree that badly reflowing 
multiline string literals is not ideal, but neither is violating the column 
limit. In any case, proper reflowing would probably the best solution. How hard 
would it be to implement that (for proto as well as C++)?


Repository:
  rC Clang

https://reviews.llvm.org/D42373



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42373: [clang-format] Disable string literal breaking for text protos

2018-01-22 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir created this revision.
krasimir added a reviewer: djasper.
Herald added subscribers: cfe-commits, klimek.

Commonly string literals in protos are already multiline, so breaking them
further is undesirable.


Repository:
  rC Clang

https://reviews.llvm.org/D42373

Files:
  lib/Format/Format.cpp


Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -675,6 +675,11 @@
   if (Language == FormatStyle::LK_TextProto) {
 FormatStyle GoogleStyle = getGoogleStyle(FormatStyle::LK_Proto);
 GoogleStyle.Language = FormatStyle::LK_TextProto;
+
+// In protos, string literals are commonly multiline and already broken-up.
+// Don't break them up even further, especially since we don't support
+// reflowing them.
+GoogleStyle.BreakStringLiterals = false;
 return GoogleStyle;
   }
 


Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -675,6 +675,11 @@
   if (Language == FormatStyle::LK_TextProto) {
 FormatStyle GoogleStyle = getGoogleStyle(FormatStyle::LK_Proto);
 GoogleStyle.Language = FormatStyle::LK_TextProto;
+
+// In protos, string literals are commonly multiline and already broken-up.
+// Don't break them up even further, especially since we don't support
+// reflowing them.
+GoogleStyle.BreakStringLiterals = false;
 return GoogleStyle;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits