@@ -290,6 +290,16 @@ TEST_F(FormatTestTableGen, MultiClass) {
"}\n");
}
+TEST_F(FormatTestTableGen, MultiClassesWithPasteOperator) {
+ // This is a sensitive example for the handling of the paste operators in
+ // brace type calculation.
+ verifyFormat("multi
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/87868
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Owen Pan
Date: 2024-04-06T01:51:45-07:00
New Revision: 684f27d37a6f1faf546a71bcb784b48c7fc8b7e0
URL:
https://github.com/llvm/llvm-project/commit/684f27d37a6f1faf546a71bcb784b48c7fc8b7e0
DIFF:
https://github.com/llvm/llvm-project/commit/684f27d37a6f1faf546a71bcb784b48c7fc8b7e0.diff
LOG:
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/87868
>From 5c614fec2b54c146841a9ef3089dee1a63f72543 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Fri, 5 Apr 2024 22:45:47 -0700
Subject: [PATCH 1/2] [clang-format][NFC] Add getNextNonComment() to
FormatTokenSource
-
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/87868
None
>From 5c614fec2b54c146841a9ef3089dee1a63f72543 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Fri, 5 Apr 2024 22:45:47 -0700
Subject: [PATCH] [clang-format][NFC] Add getNextNonComment() to
FormatTokenSource
Author: Owen Pan
Date: 2024-04-05T22:17:50-07:00
New Revision: 770202343ebce1f2bc0745c78e298e251f204bee
URL:
https://github.com/llvm/llvm-project/commit/770202343ebce1f2bc0745c78e298e251f204bee
DIFF:
https://github.com/llvm/llvm-project/commit/770202343ebce1f2bc0745c78e298e251f204bee.diff
LOG:
owenca wrote:
/cherry-pick 8de230093f58
https://github.com/llvm/llvm-project/pull/82097
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/87450
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca dismissed
https://github.com/llvm/llvm-project/pull/87450
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca milestoned
https://github.com/llvm/llvm-project/pull/82097
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
Ping @mydeveloperday @HazardyKnusperkeks @rymiel
https://github.com/llvm/llvm-project/pull/86624
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/87306
Closes #87254.
>From 91edc2bff0ea98e39b5614ae91ab562c1135b6e7 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Mon, 1 Apr 2024 20:08:21 -0700
Subject: [PATCH] [clang-format] Lambda parameter should be passed by cons
https://github.com/owenca milestoned
https://github.com/llvm/llvm-project/pull/86624
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/86776
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/86458
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/86776
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
See #86776.
https://github.com/llvm/llvm-project/pull/70883
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/86776
None
>From 216681ceb6346b56e8013935b2d3938bde5039ea Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Tue, 26 Mar 2024 23:27:51 -0700
Subject: [PATCH] [clang-format] Exit clang-format-diff only after all diffs
are p
@@ -4827,6 +4827,10 @@ bool TokenAnnotator::spaceRequiredBefore(const
AnnotatedLine &Line,
Right.is(TT_TemplateOpener)) {
return true;
}
+if (Left.is(tok::identifier) && Right.is(tok::numeric_constant) &&
+Right.TokenText[0] == '.') {
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/86624
Fixes #86559.
>From 5ba6a0adcf9de7035dd195f0b83ada39019b7e12 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Mon, 25 Mar 2024 21:13:04 -0700
Subject: [PATCH] [clang-format] Fix a regression in annotating
TrailingR
@@ -4827,6 +4827,10 @@ bool TokenAnnotator::spaceRequiredBefore(const
AnnotatedLine &Line,
Right.is(TT_TemplateOpener)) {
return true;
}
+if (Left.is(tok::identifier) && Right.is(tok::numeric_constant) &&
+Right.TokenText[0] == '.') {
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/86458
Fixes #86451.
>From 4149b046f97a4416041e2cd3fe5f134abed2f5d9 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 24 Mar 2024 16:06:14 -0700
Subject: [PATCH] [clang-format] Handle C++ Core Guidelines suppression ta
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/86420
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/86420
>From 2c131e544578072e349ba853543cc60816421a5e Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sat, 23 Mar 2024 22:23:46 -0700
Subject: [PATCH] [clang-format] Fix a crash with AlignArrayOfStructures option
Fixes #8
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/86420
Fixes #86109.
>From 682323acb1007308f55bf023e4d1657f268b55d1 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sat, 23 Mar 2024 22:23:46 -0700
Subject: [PATCH] [clang-format] Fix a crash with AlignArrayOfStructures o
Author: Owen Pan
Date: 2024-03-23T02:24:56-07:00
New Revision: 47423e9827abfdcc6b10ce41618965861b0e69a4
URL:
https://github.com/llvm/llvm-project/commit/47423e9827abfdcc6b10ce41618965861b0e69a4
DIFF:
https://github.com/llvm/llvm-project/commit/47423e9827abfdcc6b10ce41618965861b0e69a4.diff
LOG:
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/86253
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/86253
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/86253
>From d1a3b743b808a64f022897dfd832ce9a25c8f2c0 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Thu, 21 Mar 2024 23:43:23 -0700
Subject: [PATCH 1/2] [clang-forma] Support `PointerAlignment: Left` for
pointer to memb
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/86253
Fixes #85761.
>From d1a3b743b808a64f022897dfd832ce9a25c8f2c0 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Thu, 21 Mar 2024 23:43:23 -0700
Subject: [PATCH] [clang-forma] Support `PointerAlignment: Left` for point
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/84346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/84346
>From e19f49ca2660cbcd64fb81aae0428e899d61cac6 Mon Sep 17 00:00:00 2001
From: Roberto Bampi
Date: Thu, 7 Mar 2024 18:10:56 +0100
Subject: [PATCH 1/3] [clang-format] Add --fail-on-incomplete-format.
At the moment
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/84346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,5 @@
+// RUN: cat %s | not clang-format --fail-on-incomplete-format | FileCheck %s
+// RUN: cat %s | clang-format | FileCheck %s
+int a([) {}
+
+// CHECK: int a([) {}
owenca wrote:
> Done. It took me quite a while but `-style=LLVM` is also required as
@@ -0,0 +1,5 @@
+// RUN: cat %s | not clang-format --fail-on-incomplete-format | FileCheck %s
+// RUN: cat %s | clang-format | FileCheck %s
+int a([) {}
+
+// CHECK: int a([) {}
owenca wrote:
It's missing the EOF. Also, use a single hyphen for the option like oth
Author: Owen Pan
Date: 2024-03-19T18:06:59-07:00
New Revision: 6f31cf51dfdc2c317ba8149d57d2ffb583403833
URL:
https://github.com/llvm/llvm-project/commit/6f31cf51dfdc2c317ba8149d57d2ffb583403833
DIFF:
https://github.com/llvm/llvm-project/commit/6f31cf51dfdc2c317ba8149d57d2ffb583403833.diff
LOG:
https://github.com/owenca converted_to_draft
https://github.com/llvm/llvm-project/pull/85564
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
Can you provide more info about the failed use cases?
https://github.com/llvm/llvm-project/pull/84599
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -11450,6 +11450,11 @@ TEST_F(FormatTest, UnderstandsNewAndDelete) {
"void new (link p);\n"
"void delete (link p);");
+ verifyFormat("{ p->delete(); }\n"
+ "{ p->new(); }",
+ "{ p->delete (); }\n"
+ "{
Author: Owen Pan
Date: 2024-03-18T20:22:42-07:00
New Revision: a2527e06d77766d00e83ecb7988844aae7088bb1
URL:
https://github.com/llvm/llvm-project/commit/a2527e06d77766d00e83ecb7988844aae7088bb1
DIFF:
https://github.com/llvm/llvm-project/commit/a2527e06d77766d00e83ecb7988844aae7088bb1.diff
LOG:
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/85564
>From 3b9e25b8509aa6847838148fd2959569c94c4a0f Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 17 Mar 2024 01:08:07 -0700
Subject: [PATCH 1/3] [clang-format] Fix FormatToken::isSimpleTypeSpecifier()
---
clang
Author: Owen Pan
Date: 2024-03-17T21:37:32-07:00
New Revision: 55a02d10d9819b485f67546c6c1aee856a3cd62c
URL:
https://github.com/llvm/llvm-project/commit/55a02d10d9819b485f67546c6c1aee856a3cd62c
DIFF:
https://github.com/llvm/llvm-project/commit/55a02d10d9819b485f67546c6c1aee856a3cd62c.diff
LOG:
https://github.com/owenca commented:
I forgot to submit my review.
https://github.com/llvm/llvm-project/pull/85470
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -11450,6 +11450,11 @@ TEST_F(FormatTest, UnderstandsNewAndDelete) {
"void new (link p);\n"
"void delete (link p);");
+ verifyFormat("{ p->delete(); }\n"
+ "{ p->new(); }",
+ "{ p->delete (); }\n"
+ "{
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/85470
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/85564
>From 3b9e25b8509aa6847838148fd2959569c94c4a0f Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 17 Mar 2024 01:08:07 -0700
Subject: [PATCH 1/2] [clang-format] Fix FormatToken::isSimpleTypeSpecifier()
---
clang
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/85564
None
>From 3b9e25b8509aa6847838148fd2959569c94c4a0f Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 17 Mar 2024 01:08:07 -0700
Subject: [PATCH] [clang-format] Fix FormatToken::isSimpleTypeSpecifier()
---
cla
Author: Owen Pan
Date: 2024-03-17T00:36:12-07:00
New Revision: f3c5278efa3b783ada9e7a34b751cf4c5b864535
URL:
https://github.com/llvm/llvm-project/commit/f3c5278efa3b783ada9e7a34b751cf4c5b864535
DIFF:
https://github.com/llvm/llvm-project/commit/f3c5278efa3b783ada9e7a34b751cf4c5b864535.diff
LOG:
Author: Owen Pan
Date: 2024-03-16T22:24:11-07:00
New Revision: b92d6dd704d789240685a336ad8b25a9f381b4cc
URL:
https://github.com/llvm/llvm-project/commit/b92d6dd704d789240685a336ad8b25a9f381b4cc
DIFF:
https://github.com/llvm/llvm-project/commit/b92d6dd704d789240685a336ad8b25a9f381b4cc.diff
LOG:
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/85508
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/85498
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Owen Pan
Date: 2024-03-16T02:39:37-07:00
New Revision: 5ac784d1d00ce4733d07c3432ff946497a249e51
URL:
https://github.com/llvm/llvm-project/commit/5ac784d1d00ce4733d07c3432ff946497a249e51
DIFF:
https://github.com/llvm/llvm-project/commit/5ac784d1d00ce4733d07c3432ff946497a249e51.diff
LOG:
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/85508
Fixes #84695.
>From d15f3ddd2f9aef02f1706e7af64e76359a89 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sat, 16 Mar 2024 02:18:33 -0700
Subject: [PATCH] [clang-format] Fix a bug in SpaceInEmptyBlock option
Fi
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/85498
Fixes #85476.
>From 89c06a9acfebffa4f9e65c6d683c3c46774edc88 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Fri, 15 Mar 2024 22:14:01 -0700
Subject: [PATCH] [clang-format] Correctly parse C++11 attributes in enum
owenca wrote:
See e.g. https://lab.llvm.org/buildbot/#/builders/272/builds/11332.
https://github.com/llvm/llvm-project/pull/85353
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Owen Pan
Date: 2024-03-15T20:51:57-07:00
New Revision: 426e6945897afbec01c042bec4771522a2aac176
URL:
https://github.com/llvm/llvm-project/commit/426e6945897afbec01c042bec4771522a2aac176
DIFF:
https://github.com/llvm/llvm-project/commit/426e6945897afbec01c042bec4771522a2aac176.diff
LOG:
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/85361
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/85361
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/85361
A name is not a FunctionDeclarationName if it's preceded by an Objective-C
keyword.
>From fa46932f5f0c0281d75907a3da795b2f343a8e70 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Thu, 14 Mar 2024 20:16:39 -0700
Su
owenca wrote:
Can you add lit test cases?
https://github.com/llvm/llvm-project/pull/84346
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Owen Pan
Date: 2024-03-14T19:44:40-07:00
New Revision: c3a1eb6207d85cb37ea29306481b40c9f6402309
URL:
https://github.com/llvm/llvm-project/commit/c3a1eb6207d85cb37ea29306481b40c9f6402309
DIFF:
https://github.com/llvm/llvm-project/commit/c3a1eb6207d85cb37ea29306481b40c9f6402309.diff
LOG:
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/84599
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/84599
>From 43238d58ff490073c13ff621faddceb89b05b22e Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Fri, 8 Mar 2024 19:47:54 -0800
Subject: [PATCH 1/2] [clang-format][NFC] Eliminate the IsCpp parameter in all
functions
owenca wrote:
> I mean multiple threads in the same process with different languages. maybe
> unlikely, but not impossible.
But libFormat/clang-format are _not_ multithreaded, right?
https://github.com/llvm/llvm-project/pull/84599
___
cfe-commits mai
owenca wrote:
> Then I'd go back to `Style.isCpp()`.
That would still require passing `Style.isCpp()` as the parameter to the
`FormatToken` (and other) functions.
> What happens if you use libFormat concurrently?
Can you elaborate? Doesn't each process get its own copy of the globals of a
sh
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/84599
>From 43238d58ff490073c13ff621faddceb89b05b22e Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Fri, 8 Mar 2024 19:47:54 -0800
Subject: [PATCH 1/2] [clang-format][NFC] Eliminate the IsCpp parameter in all
functions
owenca wrote:
> That's okay for clang-format, but you couldn't use libFormat with different
> languages at once anymore.
I believe we still could because `IsCpp` is set to `Style.isCpp()` every time
new instances of the classes are constructed. I'll add a couple of test cases
to demonstrate t
owenca wrote:
> Thanks for doing this. Does it mean we would have to add every type we use to
> our config? It would be much more convenient if clang-format treated the
> argument list the same way that it treats in definitions. For example
>
> ```shell
> printf "int\niso_time(time_t) { return
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/84599
>From 43238d58ff490073c13ff621faddceb89b05b22e Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Fri, 8 Mar 2024 19:47:54 -0800
Subject: [PATCH] [clang-format][NFC] Eliminate the IsCpp parameter in all
functions
---
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/84599
None
>From bd3e866189ad4c238ea0afbbc30fbe88e0406eb9 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Fri, 8 Mar 2024 19:47:54 -0800
Subject: [PATCH] [clang-format][NFC] Eliminate the IsCpp parameter in all
function
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/83709
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
> Just thinking out loud and maybe not for this patch but for a more general
> solution, what we seem to never do is collect information about types local
> to the file as we go; For example what if a first pass identified types from
> declarations and function argument declarati
owenca wrote:
> Can the TypeNames mechanism be prepopulated with this list of types instead?
I don't see how that would work. Please note that the TypeNames option is not
specific to C/C++/Objective-C. Otherwise, I could simply change
`isTypeName(bool IsCpp)` to `isCppTypeName()`.
https://git
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/83709
>From 91d6e4c6e0ae2e1d79edf496df22978a4e1f3e1a Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sat, 2 Mar 2024 22:08:29 -0800
Subject: [PATCH 1/6] [clang-format] Handle common C++ non-keyword types as
such
Fixes #
@@ -620,6 +620,23 @@ TEST_F(TokenAnnotatorTest, UnderstandsCasts) {
ASSERT_EQ(Tokens.size(), 8u) << Tokens;
EXPECT_TOKEN(Tokens[3], tok::r_paren, TT_Unknown);
EXPECT_TOKEN(Tokens[4], tok::amp, TT_BinaryOperator);
+
+ Tokens = annotate("#define FOO(bar) foo((uint64_t)&bar
@@ -268,20 +268,24 @@ const FormatToken
*LeftRightQualifierAlignmentFixer::analyzeRight(
if (isPossibleMacro(TypeToken))
return Tok;
+ const bool IsCpp = Style.isCpp();
+
// The case `const long long int volatile` -> `long long int const volatile`
// The case `lo
@@ -71,8 +71,21 @@ bool FormatToken::isSimpleTypeSpecifier() const {
}
}
-bool FormatToken::isTypeOrIdentifier() const {
- return isSimpleTypeSpecifier() || Tok.isOneOf(tok::kw_auto, tok::identifier);
+// Sorted common C++ non-keyword types.
+static SmallVector CppNonKeywor
owenca wrote:
> > It does fix the example given.
>
> #83400 has 6 real-world examples. This patch fixes none of them. It also has
> a reduced testcase, which this patch does fix. But fixing the reduced
> testcase without fixing the real-world examples is not fixing the bug.
You took what I sa
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/83415
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/83709
>From 91d6e4c6e0ae2e1d79edf496df22978a4e1f3e1a Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sat, 2 Mar 2024 22:08:29 -0800
Subject: [PATCH 1/5] [clang-format] Handle common C++ non-keyword types as
such
Fixes #
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/83709
>From 91d6e4c6e0ae2e1d79edf496df22978a4e1f3e1a Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sat, 2 Mar 2024 22:08:29 -0800
Subject: [PATCH 1/4] [clang-format] Handle common C++ non-keyword types as
such
Fixes #
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/83709
>From 91d6e4c6e0ae2e1d79edf496df22978a4e1f3e1a Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sat, 2 Mar 2024 22:08:29 -0800
Subject: [PATCH 1/3] [clang-format] Handle common C++ non-keyword types as
such
Fixes #
@@ -34,9 +34,15 @@ const char *getTokenTypeName(TokenType Type) {
return nullptr;
}
+// Sorted common C++ non-keyword types.
+static SmallVector CppNonKeywordTypes = {
+"byte", "int16_t", "int32_t", "int64_t", "int8_t",
+"size_t", "uint16_t", "uint32_t", "uint64
@@ -34,9 +34,15 @@ const char *getTokenTypeName(TokenType Type) {
return nullptr;
}
+// Sorted common C++ non-keyword types.
+static SmallVector CppNonKeywordTypes = {
+"byte", "int16_t", "int32_t", "int64_t", "int8_t",
+"size_t", "uint16_t", "uint32_t", "uint64
owenca wrote:
> But looking for a parenthesized single identifier addresses all of the
> examples in the issue.
I don't think it would work, but you are welcome to submit a patch to prove me
wrong. 🙂
https://github.com/llvm/llvm-project/pull/83709
owenca wrote:
> > This patch does not only fix formatting of C-casting to a C++ standard
> > type. It correctly identifies (most of) such types and might have fixed
> > other kinds of bugs.
>
> Sure, this patch seems like a good change. But it does not fix #83400.
It does fix the example give
@@ -34,9 +34,15 @@ const char *getTokenTypeName(TokenType Type) {
return nullptr;
}
+// Sorted common C++ non-keyword types.
+static SmallVector CppNonKeywordTypes = {
+"byte", "int16_t", "int32_t", "int64_t", "int8_t",
+"size_t", "uint16_t", "uint32_t", "uint64
@@ -34,9 +34,15 @@ const char *getTokenTypeName(TokenType Type) {
return nullptr;
}
+// Sorted common C++ non-keyword types.
+static SmallVector CppNonKeywordTypes = {
+"byte", "int16_t", "int32_t", "int64_t", "int8_t",
owenca wrote:
Good point abo
owenca wrote:
> > > Another possibility to consider for the original bug:
> > > `(single_identifier)` is almost certainly a cast, not redundant
> > > parentheses, unless `single_identifier` names a macro argument. So I
> > > wonder if that would be a better heuristic to use to fix the regressi
@@ -34,9 +34,15 @@ const char *getTokenTypeName(TokenType Type) {
return nullptr;
}
+// Sorted common C++ non-keyword types.
+static SmallVector CppNonKeywordTypes = {
+"byte", "int16_t", "int32_t", "int64_t", "int8_t",
+"size_t", "uint16_t", "uint32_t", "uint64
@@ -34,9 +34,15 @@ const char *getTokenTypeName(TokenType Type) {
return nullptr;
}
+// Sorted common C++ non-keyword types.
+static SmallVector CppNonKeywordTypes = {
+"byte", "int16_t", "int32_t", "int64_t", "int8_t",
+"size_t", "uint16_t", "uint32_t", "uint64
owenca wrote:
> Another possibility to consider for the original bug: `(single_identifier)`
> is almost certainly a cast, not redundant parentheses, unless
> `single_identifier` names a macro argument. So I wonder if that would be a
> better heuristic to use to fix the regression.
I don’t thi
@@ -34,9 +34,15 @@ const char *getTokenTypeName(TokenType Type) {
return nullptr;
}
+// Sorted common C++ non-keyword types.
+static SmallVector CppNonKeywordTypes = {
+"byte", "int16_t", "int32_t", "int64_t", "int8_t",
+"size_t", "uint16_t", "uint32_t", "uint64
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/83709
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -34,9 +34,15 @@ const char *getTokenTypeName(TokenType Type) {
return nullptr;
}
+// Sorted common C++ non-keyword types.
+static SmallVector CppNonKeywordTypes = {
+"byte", "int16_t", "int32_t", "int64_t", "int8_t",
+"size_t", "uint16_t", "uint32_t", "uint64
@@ -66,13 +72,17 @@ bool FormatToken::isSimpleTypeSpecifier() const {
case tok::kw_decltype:
case tok::kw__Atomic:
return true;
+ case tok::identifier:
+return IsCpp && std::binary_search(CppNonKeywordTypes.begin(),
+ CppNonKey
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/83709
>From 91d6e4c6e0ae2e1d79edf496df22978a4e1f3e1a Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sat, 2 Mar 2024 22:08:29 -0800
Subject: [PATCH 1/2] [clang-format] Handle common C++ non-keyword types as
such
Fixes #
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/83415
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
> So I did added a simple search and replace to the generating script so now
> every time [[[NAME]]] is reference it will use the members name.
Nice! Though why `[[[NAME]]]` in particular? Can we use `` instead?
https://github.com/llvm/llvm-project/pull/83415
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/83709
Fixes #83400.
>From 91d6e4c6e0ae2e1d79edf496df22978a4e1f3e1a Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sat, 2 Mar 2024 22:08:29 -0800
Subject: [PATCH] [clang-format] Handle common C++ non-keyword types as suc
801 - 900 of 1796 matches
Mail list logo