@@ -1157,7 +1157,15 @@ void UnwrappedLineParser::parsePPDefine() {
// guard processing above, and changes preprocessing nesting.
FormatTok->Tok.setKind(tok::identifier);
FormatTok->Tok.setIdentifierInfo(Keywords.kw_internal_ident_after_define);
- nextToken();
+
+ if (St
tru wrote:
@owenca What's the things that still needs to be addressed for this to land?
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
tomekpaszek wrote:
> @tomekpaszek Hi Tomek, do you think you will have time to work on this soon?
> Otherwise, I can probably finish it off for you since we also want this
> feature.
Hi tru,
Thanks for reaching out. Unfortunately I'm too busy to work on this at the
moment. Feel free to push
tru wrote:
@tomekpaszek Hi Tomek, do you think you will have time to work on this soon?
Otherwise, I can probably finish it off for you since we also want this feature.
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-c
@@ -1157,7 +1157,15 @@ void UnwrappedLineParser::parsePPDefine() {
// guard processing above, and changes preprocessing nesting.
FormatTok->Tok.setKind(tok::identifier);
FormatTok->Tok.setIdentifierInfo(Keywords.kw_internal_ident_after_define);
- nextToken();
+
+ if (St
https://github.com/tomekpaszek updated
https://github.com/llvm/llvm-project/pull/70338
>From 25ca978ef9caf372997f2ebf227fb2b2ca443aa0 Mon Sep 17 00:00:00 2001
From: Tomek Paszek
Date: Sat, 11 Nov 2023 19:38:00 +0100
Subject: [PATCH 01/15] Added an option to ignore macro definitions.
---
clang
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/15] Added an option to ignore macro definitions.
---
clang
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/15] Added an option to ignore macro definitions.
---
clang
owenca wrote:
> > After giving more thoughts to this, I think what we really want is
> > `SkipMacroDefinitionBody`, which would format the code below:
> > (...)
> > That is, only the body (except comments) of a macro definition is not
> > formatted.
>
> I understand that:
>
> * we do want to
tomekpaszek wrote:
> After giving more thoughts to this, I think what we really want is
> `SkipMacroDefinitionBody`, which would format the code below:
> (...)
> That is, only the body (except comments) of a macro definition is not
> formatted.
I understand that:
- we do want to align the mac
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/12] Added an option to ignore macro definitions.
---
clang
owenca wrote:
After giving more thoughts to this, I think what we really want is
`SkipMacroDefinitionBody`, which would format the code below:
```
# define A a. b //comment
# define A( x , y ) ( ( x ) + ( y ) )
```
To the following:
```
#define A a. b // comment
#define A(x, y)
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
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ v
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ v
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
+ Style.IgnorePPDefinitions = true;
+
+ v
@@ -24153,6 +24153,123 @@ 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/owenca 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
@@ -2443,6 +2443,10 @@ struct FormatStyle {
/// \version 13
std::vector IfMacros;
+ /// Ignore formatting in preprocessor definitions.
owenca wrote:
```suggestion
/// Do not format macro definitions.
```
https://github.com/llvm/llvm-project/pull/70338
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) {
verifyNoChange("FOO(String-ized&Messy+But: :Still=Intentional);", Style);
}
+TEST_F(FormatTest, IgnorePPDefinitions) {
+ FormatStyle Style = getLLVMStyle();
owenca wrote:
```suggesti
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format(
bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
Indent != TheLine.First->OriginalColumn;
bool ShouldFormat = TheLine.Affected || FixIndentation;
+
+if (Style
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
@@ -2443,6 +2443,10 @@ struct FormatStyle {
/// \version 13
std::vector IfMacros;
+ /// Ignore formatting in preprocessor definitions.
+ /// \version 18
+ bool IgnorePPDefinitions;
owenca wrote:
Please rename it to `SkipMacroDefinition` or similar.
ht
https://github.com/owenca commented:
Please update ReleaseNotes.rst.
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 approved this pull request.
LGTM, but wait for either of @owenca or @mydeveloperday .
https://github.com/llvm/llvm-project/pull/70338
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/c
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format(
bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
Indent != TheLine.First->OriginalColumn;
bool ShouldFormat = TheLine.Affected || FixIndentation;
+
+if (Style
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/11] Added an option to ignore macro definitions.
---
clang
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format(
bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
Indent != TheLine.First->OriginalColumn;
bool ShouldFormat = TheLine.Affected || FixIndentation;
+
+if (Style
@@ -1308,6 +1308,13 @@ class OptimizingLineFormatter : public LineFormatter {
} // anonymous namespace
+static bool lineContainsPPDefinition(const AnnotatedLine &Line) {
HazardyKnusperkeks wrote:
```suggestion
static bool LineContainsPPDefinition(const Annot
@@ -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 +1362,10 @@ unsigned UnwrappedLineFormatter::format(
bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
Indent != TheLine.First->OriginalColumn;
bool ShouldFormat = TheLine.Affected || FixIndentation;
+
+if (Style
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
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
33 matches
Mail list logo