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
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
@@ -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-bi
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
`M
@@ -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)) {
zygoloi
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
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
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
@@ -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)) {
zygoloi
@@ -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)");
+
+ veri
@@ -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)");
+
+ veri
@@ -4842,19 +4842,19 @@ bool TokenAnnotator::spaceRequiredBefore(const
AnnotatedLine &Line,
return true;
}
if (Left.is(TT_UnaryOperator)) {
-if (Right.isNot(tok::l_paren)) {
+if (Right.isOneOf(tok::identifier, tok::numeric_constant)) {
// The alternative
@@ -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)");
+
+ veri
@@ -4842,19 +4842,19 @@ bool TokenAnnotator::spaceRequiredBefore(const
AnnotatedLine &Line,
return true;
}
if (Left.is(TT_UnaryOperator)) {
-if (Right.isNot(tok::l_paren)) {
+if (Right.isOneOf(tok::identifier, tok::numeric_constant)) {
// The alternative
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
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 &Line,
if (Left.Finalized)
return Right.hasWhitespaceBefore();
- // Never ever me
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
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.
https://g
@@ -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)) {
owenca
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.
https://github.com/llvm/llv
@@ -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-bi
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: https://github
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 9d29ad06ff71b855a43f57b339990e41f206
23 matches
Mail list logo