================
@@ -839,6 +839,25 @@ TEST_F(FormatTestComments, MultiLineCommentsInDefines) {
                    getLLVMStyleWithColumns(17)));
 }
 
+TEST_F(FormatTestComments, LineCommentsInMacrosDoNotGetEscapedNewlines) {
+  FormatStyle Style = getLLVMStyleWithColumns(0);
+  Style.ReflowComments = FormatStyle::RCS_Never;
+  verifyFormat("#define FOO (1U) // comment\n"
+               "                 // comment",
+               Style);
+
+  Style.ColumnLimit = 32;
+  EXPECT_EQ("#define SOME_MACRO(x) x\n"
+            "#define FOO                    \\\n"
+            "  SOME_MACRO(1) +              \\\n"
+            "      SOME_MACRO(2) // comment\n"
+            "                    // comment",
+            format("#define SOME_MACRO(x) x\n"
+                   "#define FOO SOME_MACRO(1) + SOME_MACRO(2) // comment\n"
+                   "                                          // comment",
+                   Style));
----------------
HazardyKnusperkeks wrote:

```suggestion
  verifyFormat("#define SOME_MACRO(x) x\n"
            "#define FOO                    \\\n"
            "  SOME_MACRO(1) +              \\\n"
            "      SOME_MACRO(2) // comment\n"
            "                    // comment",
            "#define SOME_MACRO(x) x\n"
                   "#define FOO SOME_MACRO(1) + SOME_MACRO(2) // comment\n"
                   "                                          // comment",
                   Style);
```
We have the 3 argument `verifyFormat`, the other tests are from a time where we 
hadn't. See also #164310.

https://github.com/llvm/llvm-project/pull/164300
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to