owenca wrote:

My suggestions:
```diff
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -6509,8 +6509,10 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine 
&Line,
             !(Right.Next &&
               Right.Next->isOneOf(TT_FunctionDeclarationName, tok::kw_const)));
   }
-  if (Left.is(tok::hashhash) || Right.is(tok::hashhash))
+  if (Left.is(tok::hashhash) ||
+      (Right.is(tok::hashhash) && Left.isNot(tok::comma))) {
     return false;
+  }
   if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName,
                     TT_ClassHeadName, TT_QtProperty, tok::kw_operator)) {
     return true;
```
and
```diff
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -5985,8 +5985,16 @@ TEST_F(FormatTest, HashInMacroDefinition) {
                Style);
   verifyFormat("#define A void # ## #", Style);
 
-  Style.ColumnLimit = 60;
+  Style.ColumnLimit = 42;
   Style.AlignEscapedNewlines = FormatStyle::ENAS_DontAlign;
+  verifyFormat("#define M(f, ...) \\\n"
+               "  auto f = call(firstArgument, \\\n"
+               "                ##__VA_ARGS__);",
+               "#define M(f, ...) \\\n"
+               "  auto f = call(firstArgument, ##__VA_ARGS__);",
+               Style);
+
+  Style.ColumnLimit = 60;
   verifyFormat(
       "#define MACRO(Name) \\\n"
       "  struct LongPrefix##Name##LongSuffix< \\\n"
```

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

Reply via email to