https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From b5ba0b3fde2c6662e19dfdf96a787621ec767460 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Sat, 11 Nov 2023 19:38:00 +0100
Subject: [PATCH 01/10] Added an option to ignore macro definitions.
---
clang
https://github.com/tomekpaszek edited
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1355,8 +1355,11 @@ unsigned UnwrappedLineFormatter::format(
bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
Indent != TheLine.First->OriginalColumn;
bool ShouldFormat = TheLine.Affected || FixIndentation;
-if (Style.I
@@ -24153,6 +24153,113 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ v
@@ -1355,6 +1355,8 @@ unsigned UnwrappedLineFormatter::format(
bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
Indent != TheLine.First->OriginalColumn;
bool ShouldFormat = TheLine.Affected || FixIndentation;
+if (Style.Ig
@@ -1134,6 +1134,14 @@ void UnwrappedLineParser::parsePPDefine() {
return;
}
+ if (Style.IgnorePPDefinitions) {
+do {
+ nextToken();
+} while (!eof());
tomekpaszek wrote:
In this case, `eof` is a marker for the end of the unwrapped line th
@@ -24206,10 +24206,11 @@ TEST_F(FormatTest, IgnorePPDefinitions) {
Style.IndentPPDirectives = FormatStyle::PPDIS_None;
verifyNoChange("#if A\n"
"#define A a\n"
- "#endif",
+ "#endif\n",
tomekpaszek wrote:
https://github.com/tomekpaszek commented:
>Something here doesn't feel right
Could you be more specific?
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/lis
@@ -24153,6 +24153,113 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ v
https://github.com/tomekpaszek created
https://github.com/llvm/llvm-project/pull/70338
None
>From 8404d703d58658593e6112b478533edb124cd0e1 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Thu, 26 Oct 2023 16:19:36 +0200
Subject: [PATCH] Added an option to ignore macro definitions.
---
clang
https://github.com/tomekpaszek edited
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From 8404d703d58658593e6112b478533edb124cd0e1 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Thu, 26 Oct 2023 16:19:36 +0200
Subject: [PATCH 1/2] Added an option to ignore macro definitions.
---
clang/i
https://github.com/tomekpaszek ready_for_review
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/tomekpaszek edited
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/tomekpaszek edited
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From 8404d703d58658593e6112b478533edb124cd0e1 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Thu, 26 Oct 2023 16:19:36 +0200
Subject: [PATCH 1/2] Added an option to ignore macro definitions.
---
clang/i
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff ba11d314a67638454989d4e0aebae64145d1a8ac
228301b783fe365bb01cc8b7ba122ed9845c9a37 --
https://github.com/HazardyKnusperkeks edited
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -24153,6 +24153,23 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
HazardyKnusperkeks wrote:
Add some tests:
* With formatted code a
@@ -4648,6 +4648,10 @@ struct FormatStyle {
/// \version 11
std::vector WhitespaceSensitiveMacros;
+ /// Ignore formatting in preprocessor definitions.
+ /// \version 18
+ bool IgnorePPDefinitions;
HazardyKnusperkeks wrote:
Please sort alphabetically.
@@ -1354,7 +1354,9 @@ unsigned UnwrappedLineFormatter::format(
bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
Indent != TheLine.First->OriginalColumn;
-bool ShouldFormat = TheLine.Affected || FixIndentation;
+bool Shoul
rymiel wrote:
https://github.com/llvm/llvm-project/pull/67911 is a pull request, not an
issue, i'm not sure what you're referring to
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.
@@ -4648,6 +4648,10 @@ struct FormatStyle {
/// \version 11
std::vector WhitespaceSensitiveMacros;
+ /// Ignore formatting in preprocessor definitions.
+ /// \version 18
+ bool IgnorePPDefinitions;
rymiel wrote:
(this applies to not just here, but belo
https://github.com/owenca requested changes to this pull request.
Please refer to the
[policy](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options)
for adding new options.
https://github.com/llvm/llvm-project/pull/70338
_
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
> #67911 is a pull request, not an issue, i'm not sure what you're referring to
I think it was a typo. It should be #67991.
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://l
https://github.com/mydeveloperday edited
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -4648,6 +4648,10 @@ struct FormatStyle {
/// \version 11
std::vector WhitespaceSensitiveMacros;
+ /// Ignore formatting in preprocessor definitions.
mydeveloperday wrote:
If you are changing this you need to regenerate the documentation
https://githu
https://github.com/mydeveloperday requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -24153,6 +24153,23 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ ve
tru wrote:
@tomekpaszek do you plan to finish this PR? we have been testing it internally
on our code and would really like this to land in upstream LLVM.
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.l
tomekpaszek wrote:
Yes, I just couldn't find time for it. I'll try to look into it within the next
few days. Great to hear you there is interest in using it!
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@list
https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From 46a2ad3fd19697ab8b92b7de061346b1471a8eed Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Sat, 11 Nov 2023 19:38:00 +0100
Subject: [PATCH 1/3] Added an option to ignore macro definitions.
---
clang/i
@@ -4648,6 +4648,10 @@ struct FormatStyle {
/// \version 11
std::vector WhitespaceSensitiveMacros;
+ /// Ignore formatting in preprocessor definitions.
+ /// \version 18
+ bool IgnorePPDefinitions;
tomekpaszek wrote:
fixed
https://github.com/llvm/llvm
@@ -1354,7 +1354,9 @@ unsigned UnwrappedLineFormatter::format(
bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
Indent != TheLine.First->OriginalColumn;
-bool ShouldFormat = TheLine.Affected || FixIndentation;
+bool Shoul
@@ -24153,6 +24153,23 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
tomekpaszek wrote:
added more tests now
https://github.com/llvm/
@@ -24153,6 +24153,23 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ ve
https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From cfe5937f53b549fdfbd6e4845a2d0ab91226cad3 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Sat, 11 Nov 2023 19:38:00 +0100
Subject: [PATCH 1/3] Added an option to ignore macro definitions.
---
clang/i
@@ -24153,6 +24153,23 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
HazardyKnusperkeks wrote:
Can you also add some nested `#if` and
@@ -24153,6 +24153,53 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ ve
@@ -1134,6 +1134,14 @@ void UnwrappedLineParser::parsePPDefine() {
return;
}
+ if (Style.IgnorePPDefinitions) {
+do {
+ nextToken();
+} while (!eof());
HazardyKnusperkeks wrote:
I assume you have tested this on real code. Can you explain w
@@ -24153,6 +24153,53 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ ve
@@ -4719,6 +4723,7 @@ struct FormatStyle {
R.IncludeStyle.IncludeIsMainRegex &&
IncludeStyle.IncludeIsMainSourceRegex ==
R.IncludeStyle.IncludeIsMainSourceRegex &&
+ IgnorePPDefinitions == R.IgnorePPDefinitions &&
-
@@ -1355,6 +1355,8 @@ unsigned UnwrappedLineFormatter::format(
bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
Indent != TheLine.First->OriginalColumn;
bool ShouldFormat = TheLine.Affected || FixIndentation;
+if (Style.Ig
@@ -4648,6 +4648,10 @@ struct FormatStyle {
/// \version 11
std::vector WhitespaceSensitiveMacros;
+ /// Ignore formatting in preprocessor definitions.
HazardyKnusperkeks wrote:
Run `clang/docs/tools/dump_format_style.py`.
https://github.com/llvm/llvm-p
@@ -24153,6 +24153,53 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ ve
@@ -24153,6 +24153,53 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ ve
@@ -24153,6 +24153,23 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ ve
@@ -24153,6 +24153,23 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ ve
https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From b5ba0b3fde2c6662e19dfdf96a787621ec767460 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Sat, 11 Nov 2023 19:38:00 +0100
Subject: [PATCH 1/4] Added an option to ignore macro definitions.
---
clang/i
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Tomek (tomekpaszek)
Changes
Sometimes macro definitions contain a layout we don't want to change in any
context. This PR adds a new style option `IgnorePPDefinitions` that prevents
clang-format from touching PP directives.
This PR addres
https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From b5ba0b3fde2c6662e19dfdf96a787621ec767460 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Sat, 11 Nov 2023 19:38:00 +0100
Subject: [PATCH 1/5] Added an option to ignore macro definitions.
---
clang/i
https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From b5ba0b3fde2c6662e19dfdf96a787621ec767460 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Sat, 11 Nov 2023 19:38:00 +0100
Subject: [PATCH 1/7] Added an option to ignore macro definitions.
---
clang/i
@@ -24153,6 +24153,23 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
tomekpaszek wrote:
Good idea. Added cases to cover that
https://
@@ -4648,6 +4648,10 @@ struct FormatStyle {
/// \version 11
std::vector WhitespaceSensitiveMacros;
+ /// Ignore formatting in preprocessor definitions.
tomekpaszek wrote:
thanks for the tip!
https://github.com/llvm/llvm-project/pull/70338
__
https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From b5ba0b3fde2c6662e19dfdf96a787621ec767460 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Sat, 11 Nov 2023 19:38:00 +0100
Subject: [PATCH 1/8] Added an option to ignore macro definitions.
---
clang/i
https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From b5ba0b3fde2c6662e19dfdf96a787621ec767460 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Sat, 11 Nov 2023 19:38:00 +0100
Subject: [PATCH 1/9] Added an option to ignore macro definitions.
---
clang/i
@@ -1355,8 +1355,11 @@ unsigned UnwrappedLineFormatter::format(
bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
Indent != TheLine.First->OriginalColumn;
bool ShouldFormat = TheLine.Affected || FixIndentation;
-if (Style.I
@@ -24206,10 +24206,11 @@ TEST_F(FormatTest, IgnorePPDefinitions) {
Style.IndentPPDirectives = FormatStyle::PPDIS_None;
verifyNoChange("#if A\n"
"#define A a\n"
- "#endif",
+ "#endif\n",
HazardyKnusperkeks w
https://github.com/mydeveloperday edited
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/mydeveloperday commented:
Something here doesn't feel right
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -24153,6 +24153,113 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ v
63 matches
Mail list logo