https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/74235
>From 7323d9261fe8c876fe3a656a98e186af3dd0b2a0 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 3 Dec 2023 01:41:57 -0800
Subject: [PATCH 1/2] [clang-format] Remove duplicates in @property using
std::set
Re-im
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/74293
This is a rework of #74176.
>From fddf15404c0f5de2d9b264413b94d45a4a73edde Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Mon, 4 Dec 2023 01:03:18 -0800
Subject: [PATCH] [clang-format] Fix a bug in `git-clang-form
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/74293
>From a394ac020c1045705fb2898d32754bdf12fac4bd Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Mon, 4 Dec 2023 01:03:18 -0800
Subject: [PATCH] [clang-format] Fix a bug in `git-clang-format --binary`
This is a rewor
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/74293
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -153,8 +157,13 @@ def main():
else:
if len(commits) > 2:
die('at most two commits allowed; %d given' % len(commits))
+ if len(commits) < 2 and opts.diff_from_common_commit:
+die('--diff_from_common_commit is only allowed when two commits are given')
@@ -328,6 +337,10 @@ def compute_diff(commits, files, staged):
git_tool = 'diff-tree'
elif staged:
extra_args += ['--cached']
+
+ if len(commits) > 1 and diff_common_commit:
+commits = [f'{commits[0]}...{commits[1]}']
owenca wrote:
```suggestion
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76021
>From d3c7a45cfcd16974cdfd88d1f5381fc0f96184a1 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Tue, 19 Dec 2023 23:25:57 -0800
Subject: [PATCH] [clang-format] Add an fnmatch-like function for
.clang-format-ignore
owenca wrote:
> I avoid this by using clang-format binary from main branch in my local. What
> should I do with this failure?
You can ignore it if running the in-tree clang-format is clean, e.g.:
```
$ clang/tools/clang-format/git-clang-format --binary build/bin/clang-format
HEAD~
clang-format
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76021
>From ea6418158c00b7b4ceb7a3192917ed009550ed11 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Tue, 19 Dec 2023 23:25:57 -0800
Subject: [PATCH] [clang-format] Add an fnmatch-like function for
.clang-format-ignore
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76021
>From 4954f52278ca41652be79318843d3538a2eb1205 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Tue, 19 Dec 2023 23:25:57 -0800
Subject: [PATCH] [clang-format] Add an fnmatch-like function for
.clang-format-ignore
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/76206
Annotates function declaration names having unnamed parameters.
>From 170d2e573904286ae6ee8fad9df6ea467eb54eb8 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Thu, 21 Dec 2023 21:27:47 -0800
Subject: [PATCH] [clang
owenca wrote:
See
[here](https://discourse.llvm.org/t/why-are-the-breaks-sometimes-removed-when-alwaysbreakafterreturntype-is-all/75780/4?u=owenpan)
for background info.
https://github.com/llvm/llvm-project/pull/76206
___
cfe-commits mailing list
cfe
@@ -583,20 +583,26 @@ bool ContinuationIndenter::mustBreak(const LineState
&State) {
return true;
}
- // If the return type spans multiple lines, wrap before the function name.
- if (((Current.is(TT_FunctionDeclarationName) &&
-!State.Line->ReturnTypeWrapped
@@ -0,0 +1,169 @@
+//===- unittest/Format/MatchFilePathTest.cpp
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76021
>From 4954f52278ca41652be79318843d3538a2eb1205 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Tue, 19 Dec 2023 23:25:57 -0800
Subject: [PATCH 1/2] [clang-format] Add an fnmatch-like function for
.clang-format-igno
owenca wrote:
> Are we going to use this specific implementation on all platforms for parity?
Yes, similar to
[this](https://github.com/owenca/llvm-project/commit/52866dcfe31cf5a43d86b27ec1f0420077034780#diff-0cfce704bac218438436bd4388319d112780509ea474d5b3253d45746a62713aR123).
> The logic on
@@ -26451,6 +26451,20 @@ TEST_F(FormatTest, BreakAfterAttributes) {
"{\n"
"}",
CtorDtorCode, Style);
+
+ Style.BreakBeforeBraces = FormatStyle::BS_Attach;
+ Style.ReferenceAlignment = FormatStyle::ReferenceAlignmentStyle::RAS_Left;
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/74943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
> `GUARDED_BY` and `ABSL_GUARDED_BY` are very commoon in Google codebases so it
> is reasonable to include them by default to avoid the need for extra
> configuration in every Google repository.
I don't feel comfortable with this as it might impact users of the Google style
with
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/76206
___
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/74943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
> This regressions was introduced in
> [70d7ea0](https://github.com/llvm/llvm-project/commit/70d7ea0cebcf363cd0ddcfb76375fb5fada87dd5).
> The commit moved some code and correctly picked up an explicit check for not
> running on Verilog. However, the moved code also never ran for
@@ -0,0 +1,121 @@
+//===--- MatchFilePath.cpp - Match file path with pattern ---*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76021
>From 4954f52278ca41652be79318843d3538a2eb1205 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Tue, 19 Dec 2023 23:25:57 -0800
Subject: [PATCH 1/3] [clang-format] Add an fnmatch-like function for
.clang-format-igno
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/76021
___
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/76327
Closes #52975.
>From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 24 Dec 2023 01:18:55 -0800
Subject: [PATCH] [clang-format] Add .clang-format.ignore for ignoring fi
@@ -131,6 +131,24 @@ An easy way to create the ``.clang-format`` file is:
Available style options are described in :doc:`ClangFormatStyleOptions`.
+You can create ``.clang-format-ignore`` files to make ``clang-format`` ignore
+certain files. A ``.clang-format-ignore`` file co
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76327
>From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 24 Dec 2023 01:18:55 -0800
Subject: [PATCH 1/2] [clang-format] Add .clang-format.ignore for ignoring
files
Closes
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76327
>From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 24 Dec 2023 01:18:55 -0800
Subject: [PATCH 1/3] [clang-format] Add .clang-format.ignore for ignoring
files
Closes
@@ -0,0 +1,31 @@
+// RUN: rm -rf %t.dir
+// RUN: mkdir -p %t.dir/level1/level2
+
+// RUN: cd %t.dir
+// RUN: printf "%%s\n" "\*" "level*/*.c*" "*/*2/foo.*" > .clang-format-ignore
+// RUN: touch foo.cc
+// RUN: clang-format -verbose .clang-format-ignore foo.cc 2> %t.stderr
+// RUN:
@@ -0,0 +1,31 @@
+// RUN: rm -rf %t.dir
+// RUN: mkdir -p %t.dir/level1/level2
+
+// RUN: cd %t.dir
+// RUN: printf "%%s\n" "\*" "level*/*.c*" "*/*2/foo.*" > .clang-format-ignore
owenca wrote:
```suggestion
// RUN: echo "*" > .clang-format-ignore
// RUN: echo "le
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76327
>From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 24 Dec 2023 01:18:55 -0800
Subject: [PATCH 1/4] [clang-format] Add .clang-format.ignore for ignoring
files
Closes
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76327
>From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 24 Dec 2023 01:18:55 -0800
Subject: [PATCH 1/5] [clang-format] Add .clang-format.ignore for ignoring
files
Closes
@@ -570,6 +571,74 @@ static int dumpConfig(bool IsSTDIN) {
return 0;
}
+// Check whether `FilePath` is ignored according to the nearest
+// .clang-format-ignore file based on the rules below:
+// - A blank line is skipped.
+// - Leading and trailing spaces of a line are trim
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76327
>From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 24 Dec 2023 01:18:55 -0800
Subject: [PATCH 1/6] [clang-format] Add .clang-format.ignore for ignoring
files
Closes
@@ -570,6 +571,74 @@ static int dumpConfig(bool IsSTDIN) {
return 0;
}
+// Check whether `FilePath` is ignored according to the nearest
+// .clang-format-ignore file based on the rules below:
+// - A blank line is skipped.
+// - Leading and trailing spaces of a line are trim
@@ -570,6 +571,74 @@ static int dumpConfig(bool IsSTDIN) {
return 0;
}
+// Check whether `FilePath` is ignored according to the nearest
+// .clang-format-ignore file based on the rules below:
+// - A blank line is skipped.
+// - Leading and trailing spaces of a line are trim
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/76327
___
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/76327
>From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 24 Dec 2023 01:18:55 -0800
Subject: [PATCH 1/7] [clang-format] Add .clang-format.ignore for ignoring
files
Closes
@@ -26492,6 +26492,10 @@ TEST_F(FormatTest, BreakAfterAttributes) {
verifyFormat("[[nodiscard]]\n"
"Foo& operator-(Foo&);",
Style);
+
+ verifyFormat("[[maybe_unused]]\n"
+ "foo f;",
+ Style);
owenca w
@@ -26492,6 +26492,10 @@ TEST_F(FormatTest, BreakAfterAttributes) {
verifyFormat("[[nodiscard]]\n"
"Foo& operator-(Foo&);",
Style);
+
+ verifyFormat("[[maybe_unused]]\n"
+ "foo f;",
owenca wrote:
```suggestion
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/76336
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -570,6 +571,70 @@ static int dumpConfig(bool IsSTDIN) {
return 0;
}
+// Check whether `FilePath` is ignored according to the nearest
+// .clang-format-ignore file based on the rules below:
+// - A blank line is skipped.
+// - Leading and trailing spaces of a line are trim
@@ -570,6 +571,70 @@ static int dumpConfig(bool IsSTDIN) {
return 0;
}
+// Check whether `FilePath` is ignored according to the nearest
+// .clang-format-ignore file based on the rules below:
+// - A blank line is skipped.
+// - Leading and trailing spaces of a line are trim
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76327
>From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 24 Dec 2023 01:18:55 -0800
Subject: [PATCH 1/8] [clang-format] Add .clang-format.ignore for ignoring
files
Closes
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/76327
>From 4afd12db61528b40d842a7fbee9af37c2235822c Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 24 Dec 2023 01:18:55 -0800
Subject: [PATCH 1/9] [clang-format] Add .clang-format.ignore for ignoring
files
Closes
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/76327
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Owen Pan
Date: 2023-12-29T19:47:08-08:00
New Revision: ca8441d6dbd36003288ef412295e7b946a8bb893
URL:
https://github.com/llvm/llvm-project/commit/ca8441d6dbd36003288ef412295e7b946a8bb893
DIFF:
https://github.com/llvm/llvm-project/commit/ca8441d6dbd36003288ef412295e7b946a8bb893.diff
LOG:
Author: Owen Pan
Date: 2023-12-29T22:52:07-08:00
New Revision: 3507959e441ed9470818e7c6ef16d9bbcfe6a999
URL:
https://github.com/llvm/llvm-project/commit/3507959e441ed9470818e7c6ef16d9bbcfe6a999
DIFF:
https://github.com/llvm/llvm-project/commit/3507959e441ed9470818e7c6ef16d9bbcfe6a999.diff
LOG:
Author: Owen Pan
Date: 2023-12-29T23:12:16-08:00
New Revision: fe2e677aa7aebedd316b1a688db8410855a213c1
URL:
https://github.com/llvm/llvm-project/commit/fe2e677aa7aebedd316b1a688db8410855a213c1
DIFF:
https://github.com/llvm/llvm-project/commit/fe2e677aa7aebedd316b1a688db8410855a213c1.diff
LOG:
Author: Owen Pan
Date: 2023-12-30T01:32:10-08:00
New Revision: bd3d358ec68f686a280ae628f9074fdff1f10fe9
URL:
https://github.com/llvm/llvm-project/commit/bd3d358ec68f686a280ae628f9074fdff1f10fe9
DIFF:
https://github.com/llvm/llvm-project/commit/bd3d358ec68f686a280ae628f9074fdff1f10fe9.diff
LOG:
@@ -416,10 +421,15 @@ struct FormatToken {
/// to another one please use overwriteFixedType, or even better remove the
/// need to reassign the type.
void setFinalizedType(TokenType T) {
+if (MacroCtx && MacroCtx->Role == MR_UnexpandedArg)
+ return;
+
---
@@ -255,6 +255,44 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.Macros.push_back("ASSIGN_OR_RETURN(a, b, c)=a=(b); if(x) c");
+ verifyFormat(R"(ASSI
@@ -255,6 +255,44 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.Macros.push_back("ASSIGN_OR_RETURN(a, b, c)=a=(b); if(x) c");
+ verifyFormat(R"(ASSI
@@ -2919,6 +2912,12 @@ class ExpressionParser {
void addFakeParenthesis(FormatToken *Start, prec::Level Precedence,
FormatToken *End = nullptr) {
+// Do not assign fake parenthesis to tokens that are part of an
+// unexpanded macro call. The
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/76733
Reuse the patterns governing the previous input file being formatted if the the
current input file is from the same directory.
>From 7f8da18dc59706df8f1ee15d22076b4794881579 Mon Sep 17 00:00:00 2001
From: Owen Pa
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/76733
___
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/76733
>From 7f8da18dc59706df8f1ee15d22076b4794881579 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Mon, 1 Jan 2024 19:10:30 -0800
Subject: [PATCH 1/2] [clang-format] Optimize processing .clang-format-ignore
files
Reus
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/76733
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
It had passed my local tests (x64 Native Tools Command Prompt for VS 2022) and
the buildkite win build, so I wonder if it has something to do with the grep in
the failed buildbot (only
https://lab.llvm.org/buildbot/#/builders/123/builds/23808 so far) as I only
used the POSIX opt
owenca wrote:
Actually, it's commit 42ec976184ac. Please see
[here](https://github.com/llvm/llvm-project/pull/76733#issuecomment-1876707005).
https://github.com/llvm/llvm-project/pull/76327
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https
@@ -21084,6 +21084,12 @@ TEST_F(FormatTest,
CatchAlignArrayOfStructuresLeftAlignment) {
"};",
Style);
+ verifyNoCrash("Foo f[] = {\n"
+"[0] = { 1, },\n"
+"[1] { 1, },\n"
+"};",
+Style);
-
@@ -1444,7 +1444,8 @@ WhitespaceManager::CellDescriptions
WhitespaceManager::getCells(unsigned Start,
} else if (C.Tok->is(tok::comma)) {
if (!Cells.empty())
Cells.back().EndIndex = i;
-if (C.Tok->getNextNonComment()->isNot(tok::r_brace)) // dan
@@ -5151,6 +5151,14 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine
&Line,
return true;
if (Left.IsUnterminatedLiteral)
return true;
+ // FIXME: Breaking after newlines seems useful in general. Turn this into an
+ // option and Recognize more cases like
@@ -2499,6 +2499,15 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
EXPECT_BRACE_KIND(Tokens[6], BK_Block);
}
+TEST_F(TokenAnnotatorTest, StreamOperator) {
+ auto Tokens = annotate("\"foo\\n\" << aux << \"foo\\n\" << \"foo\";");
+ ASSERT_EQ(Tokens.size(), 9u) << Tokens;
+ EXPE
@@ -5151,6 +5151,14 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine
&Line,
return true;
if (Left.IsUnterminatedLiteral)
return true;
+ // FIXME: Breaking after newlines seems useful in general. Turn this into an
+ // option and recognize more cases like
@@ -2499,6 +2499,15 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
EXPECT_BRACE_KIND(Tokens[6], BK_Block);
}
+TEST_F(TokenAnnotatorTest, StreamOperator) {
+ auto Tokens = annotate("\"foo\\n\" << aux << \"foo\\n\" << \"foo\";");
+ ASSERT_EQ(Tokens.size(), 9u) << Tokens;
+ EXPE
owenca wrote:
> @owenca this waits for re-review
Can you rebase the patch?
https://github.com/llvm/llvm-project/pull/69340
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca commented:
Please also update the release notes. LGTM otherwise.
https://github.com/llvm/llvm-project/pull/69340
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi
@@ -76,40 +76,49 @@ template <> struct
MappingTraits {
FormatStyle::AlignConsecutiveStyle(
{/*Enabled=*/false, /*AcrossEmptyLines=*/false,
/*AcrossComments=*/false, /*AlignCompound=*/false,
+ /*AlignF
@@ -76,40 +76,49 @@ template <> struct
MappingTraits {
FormatStyle::AlignConsecutiveStyle(
{/*Enabled=*/false, /*AcrossEmptyLines=*/false,
/*AcrossComments=*/false, /*AlignCompound=*/false,
+ /*AlignF
@@ -76,40 +76,49 @@ template <> struct
MappingTraits {
FormatStyle::AlignConsecutiveStyle(
{/*Enabled=*/false, /*AcrossEmptyLines=*/false,
/*AcrossComments=*/false, /*AlignCompound=*/false,
+ /*AlignF
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/69340
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -76,40 +76,49 @@ template <> struct
MappingTraits {
FormatStyle::AlignConsecutiveStyle(
{/*Enabled=*/false, /*AcrossEmptyLines=*/false,
/*AcrossComments=*/false, /*AlignCompound=*/false,
+ /*AlignF
@@ -225,6 +225,22 @@ struct FormatStyle {
/// bbb = 2;
/// \endcode
bool AlignCompound;
+/// Only for ``AlignConsecutiveDeclarations``. Whether function pointers
+/// are aligned.
owenca wrote:
```suggestion
/// Only for ``AlignConsec
@@ -978,7 +978,14 @@ void WhitespaceManager::alignConsecutiveDeclarations() {
AlignTokens(
Style,
- [](Change const &C) {
+ [&](Change const &C) {
+if (Style.AlignConsecutiveDeclarations.AlignFunctionPointers) {
+ for (FormatToken *Prev = C.T
@@ -76,40 +76,49 @@ template <> struct
MappingTraits {
FormatStyle::AlignConsecutiveStyle(
{/*Enabled=*/false, /*AcrossEmptyLines=*/false,
/*AcrossComments=*/false, /*AlignCompound=*/false,
+ /*AlignF
owenca wrote:
@darkfeline I'm ok with adding the Version comment in
clang/tools/clang-format/clang-format.el, but you may have to explicitly
request others to review the rest of the patch.
https://github.com/llvm/llvm-project/pull/76110
___
cfe-commi
@@ -2499,6 +2499,15 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
EXPECT_BRACE_KIND(Tokens[6], BK_Block);
}
+TEST_F(TokenAnnotatorTest, StreamOperator) {
+ auto Tokens = annotate("\"foo\\n\" << aux << \"foo\\n\" << \"foo\";");
+ ASSERT_EQ(Tokens.size(), 9u) << Tokens;
+ EXPE
@@ -1444,16 +1444,26 @@ WhitespaceManager::CellDescriptions
WhitespaceManager::getCells(unsigned Start,
} else if (C.Tok->is(tok::comma)) {
if (!Cells.empty())
Cells.back().EndIndex = i;
-if (C.Tok->getNextNonComment()->isNot(tok::r_brace)) // d
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/76795
___
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/76804
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
> > can you also add a test to clang/unittests/Format/TokenAnnotatorTest.cpp
> > that ensures trailing attribute-like macros receive `StartOfName`
> > annotation to make sure we don't regress the signal in the future?
>
> ok, that opened a whole can of worms.
>
> ```
> Tokens =
@@ -2209,7 +2209,8 @@ class AnnotatingParser {
(!NextNonComment && !Line.InMacroBody) ||
(NextNonComment &&
(NextNonComment->isPointerOrReference() ||
- NextNonComment->isOneOf(tok::identifier, tok::string_literal {
+ (Line.InPragm
@@ -8498,9 +8498,6 @@ TEST_F(FormatTest,
BreaksFunctionDeclarationsWithTrailingTokens) {
"__attribute__((unused));");
Style = getGoogleStyle();
- ASSERT_THAT(Style.AttributeMacros,
owenca wrote:
Please also delete line 10:
```
#include
@@ -1444,16 +1444,26 @@ WhitespaceManager::CellDescriptions
WhitespaceManager::getCells(unsigned Start,
} else if (C.Tok->is(tok::comma)) {
if (!Cells.empty())
Cells.back().EndIndex = i;
-if (C.Tok->getNextNonComment()->isNot(tok::r_brace)) // d
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/76675
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2315,6 +2315,8 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() {
if (Next->is(tok::greater))
return false;
}
+ if (tok::isLiteral(FormatTok->Tok.getKind()))
+return false;
owenca wrote:
```suggestion
```
Instead, I would change l
owenca wrote:
Please add an assertion in `WhitespaceManager.h`:
```
--- a/clang/lib/Format/WhitespaceManager.h
+++ b/clang/lib/Format/WhitespaceManager.h
@@ -282,6 +282,7 @@ private:
for (auto PrevIter = Start; PrevIter != End; ++PrevIter) {
// If we broke the line the initial spaces
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.ColumnLimit = 42;
owenca wrote:
```suggestion
FormatStyle Style =
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.ColumnLimit = 42;
+ Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c");
+ veri
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.ColumnLimit = 42;
+ Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c");
+ veri
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.ColumnLimit = 42;
+ Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c");
+ veri
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.ColumnLimit = 42;
+ Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c");
+ veri
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/69340
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1079,6 +1079,7 @@ clang-format
- Add ``ObjCPropertyAttributeOrder`` which can be used to sort ObjC property
attributes (like ``nonatomic, strong, nullable``).
- Add ``.clang-format-ignore`` files.
+- Add ``AlignFunctionPointers`` sub-option for
``AlignConsecutiveDeclarat
@@ -2315,6 +2315,8 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() {
if (Next->is(tok::greater))
return false;
}
+ if (tok::isLiteral(FormatTok->Tok.getKind()))
+return false;
owenca wrote:
You are right! Then how about the following
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/77045
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Owen Pan
Date: 2024-01-09T21:34:21-08:00
New Revision: b53628a52d1947c51e250d6fa4ff5dd12b737aa0
URL:
https://github.com/llvm/llvm-project/commit/b53628a52d1947c51e250d6fa4ff5dd12b737aa0
DIFF:
https://github.com/llvm/llvm-project/commit/b53628a52d1947c51e250d6fa4ff5dd12b737aa0.diff
LOG:
owenca wrote:
Relanded as b53628a52d19. (See
[here](https://github.com/llvm/llvm-project/commit/42ec976184acd40436acd7104ad715c60ca3e7ed#commitcomment-136674701)).
https://github.com/llvm/llvm-project/pull/76733
___
cfe-commits mailing list
cfe-commit
201 - 300 of 2500 matches
Mail list logo