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

2024-04-25 Thread Owen Pan via cfe-commits
https://github.com/owenca unassigned https://github.com/llvm/llvm-project/pull/78176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-04-23 Thread via cfe-commits
https://github.com/mydeveloperday closed https://github.com/llvm/llvm-project/pull/78176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-11 Thread Ilya Biryukov via cfe-commits
@@ -4842,7 +4842,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine , return true; } if (Left.is(TT_UnaryOperator)) { -if (Right.isNot(tok::l_paren)) { +if (!Right.isOneOf(tok::r_paren, tok::l_paren, tok::exclaim)) {

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

2024-03-11 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: I just wanted to bring up that using `WhitespaceSensitiveMacros` here is a little tricky because the macro name one would need to put there is `V` (the name is taken directly from the code that hit this). Having a more sophisticated option to say "parameter `V` of macro

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

2024-02-04 Thread Richard Smith via cfe-commits
@@ -4842,7 +4842,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine , return true; } if (Left.is(TT_UnaryOperator)) { -if (Right.isNot(tok::l_paren)) { +if (!Right.isOneOf(tok::r_paren, tok::l_paren, tok::exclaim)) { zygoloid

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

2024-02-04 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/78176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-02-04 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/78176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-02-04 Thread Richard Smith via cfe-commits
https://github.com/zygoloid edited https://github.com/llvm/llvm-project/pull/78176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-02-04 Thread Richard Smith via cfe-commits
@@ -4842,7 +4842,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine , return true; } if (Left.is(TT_UnaryOperator)) { -if (Right.isNot(tok::l_paren)) { +if (!Right.isOneOf(tok::r_paren, tok::l_paren, tok::exclaim)) { zygoloid

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

2024-02-04 Thread Owen Pan via cfe-commits
@@ -24160,6 +24160,14 @@ TEST_F(FormatTest, AlternativeOperators) { verifyFormat("int a compl(5);"); verifyFormat("int a not(5);"); + verifyFormat("v(not)"); + verifyFormat("v(not!)"); + verifyFormat("Symbol(not, None)"); + verifyFormat("Symbol(not!, None)"); + +

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

2024-02-04 Thread via cfe-commits
@@ -24160,6 +24160,14 @@ TEST_F(FormatTest, AlternativeOperators) { verifyFormat("int a compl(5);"); verifyFormat("int a not(5);"); + verifyFormat("v(not)"); + verifyFormat("v(not!)"); + verifyFormat("Symbol(not, None)"); + verifyFormat("Symbol(not!, None)"); + +

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

2024-01-22 Thread Owen Pan via cfe-commits
@@ -4842,19 +4842,19 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine , return true; } if (Left.is(TT_UnaryOperator)) { -if (Right.isNot(tok::l_paren)) { +if (Right.isOneOf(tok::identifier, tok::numeric_constant)) { // The alternative

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

2024-01-22 Thread Owen Pan via cfe-commits
@@ -24160,6 +24160,14 @@ TEST_F(FormatTest, AlternativeOperators) { verifyFormat("int a compl(5);"); verifyFormat("int a not(5);"); + verifyFormat("v(not)"); + verifyFormat("v(not!)"); + verifyFormat("Symbol(not, None)"); + verifyFormat("Symbol(not!, None)"); + +

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

2024-01-22 Thread Owen Pan via cfe-commits
@@ -4842,19 +4842,19 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine , return true; } if (Left.is(TT_UnaryOperator)) { -if (Right.isNot(tok::l_paren)) { +if (Right.isOneOf(tok::identifier, tok::numeric_constant)) { // The alternative

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

2024-01-16 Thread via cfe-commits
https://github.com/mydeveloperday updated https://github.com/llvm/llvm-project/pull/78176 >From 9d29ad06ff71b855a43f57b339990e41f206ac8d Mon Sep 17 00:00:00 2001 From: mydeveloperday Date: Mon, 15 Jan 2024 15:42:59 + Subject: [PATCH 1/2] [clang-format] adds a space after not inside macros

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

2024-01-16 Thread Owen Pan via cfe-commits
owenca wrote: This should work: ``` --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -4402,9 +4402,17 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine , if (Left.Finalized) return Right.hasWhitespaceBefore(); - // Never ever merge

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

2024-01-16 Thread via cfe-commits
mydeveloperday wrote: > > I think this is kind of too specific. > > +1. > > > Also I agree with [#78166 > > (comment)](https://github.com/llvm/llvm-project/issues/78166#issuecomment-1892311219) > > that `WhitespaceSensitiveMacros` should be used. > > I don't think we should require that the

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

2024-01-15 Thread Owen Pan via cfe-commits
owenca wrote: > I think this is kind of too specific. +1. > Also I agree with [#78166 > (comment)](https://github.com/llvm/llvm-project/issues/78166#issuecomment-1892311219) > that `WhitespaceSensitiveMacros` should be used. I don't think we should require that the option be used.

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

2024-01-15 Thread Owen Pan via cfe-commits
@@ -4842,7 +4842,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine , return true; } if (Left.is(TT_UnaryOperator)) { -if (Right.isNot(tok::l_paren)) { +if (!Right.isOneOf(tok::r_paren, tok::l_paren, tok::exclaim)) { owenca

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

2024-01-15 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: I think this is kind of too specific. Whoever uses `not` will most likely not combine it with `!`. Also I agree with https://github.com/llvm/llvm-project/issues/78166#issuecomment-1892311219 that `WhitespaceSensitiveMacros` should be used.

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

2024-01-15 Thread Ilya Biryukov via cfe-commits
@@ -4842,7 +4842,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine , return true; } if (Left.is(TT_UnaryOperator)) { -if (Right.isNot(tok::l_paren)) { +if (!Right.isOneOf(tok::r_paren, tok::l_paren, tok::exclaim)) {

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

2024-01-15 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: MyDeveloperDay (mydeveloperday) Changes No need to add an extract space if merging the characters doesn't cause a problem, hence ) and ! as well as ( do not require the extraneous space. Fixes #78166 --- Full diff:

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

2024-01-15 Thread via cfe-commits
https://github.com/mydeveloperday created https://github.com/llvm/llvm-project/pull/78176 No need to add an extract space if merging the characters doesn't cause a problem, hence ) and ! as well as ( do not require the extraneous space. Fixes #78166 >From