[PATCH] D154093: [clang-format] Break long string literals in C#, etc.

sstwcw via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 7 06:49:28 PDT 2023


sstwcw added inline comments.


================
Comment at: clang/unittests/Format/FormatTestCSharp.cpp:221
 TEST_F(FormatTestCSharp, CSharpFatArrows) {
-  verifyFormat("Task serverTask = Task.Run(async() => {");
+  verifyIncompleteFormat("Task serverTask = Task.Run(async() => {");
   verifyFormat("public override string ToString() => \"{Name}\\{Age}\";");
----------------
MyDeveloperDay wrote:
> not sure what changing here and why?
The brace is not paired.  The old `verifyFormat` function didn't care about it.  In `FormatTestBase.h` there is the function `verifyFormat` which requires the code to be complete and `verifyIncompleteFormat` which doesn't.


================
Comment at: clang/unittests/Format/FormatTestJS.cpp:1575
+               "    /xxxxxxxx xxxxxxxx/;",
+               getGoogleJSStyleWithColumns(18));
 }
----------------
MyDeveloperDay wrote:
> out of interest what happens with  `<backtick>xxxxxx ${variable} xxxxxx<backtick>` type strings? can we add a test to show we won't break in the middle of a ${vas} even though the column limit might be reached?
There can be a break inside the braces.  I added a test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154093/new/

https://reviews.llvm.org/D154093



More information about the cfe-commits mailing list