[clang] [clang-format] adds a space after not inside macros (PR #78176)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 04:16:45 PDT 2024


================
@@ -4842,7 +4842,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
     return true;
   }
   if (Left.is(TT_UnaryOperator)) {
-    if (Right.isNot(tok::l_paren)) {
+    if (!Right.isOneOf(tok::r_paren, tok::l_paren, tok::exclaim)) {
----------------
ilya-biryukov wrote:

Adding a space makes total sense in code that **has an argument** to `not`.
But this case seems special because `V(not!)` or `V(not)` clearly can't be a full expression by themselves. So it feels preferable to not add any extra spaces.

https://github.com/llvm/llvm-project/pull/78176


More information about the cfe-commits mailing list