[llvm] [clang-tools-extra] [clang] [clang-format] Option to ignore macro definitions (PR #70338)

2024-01-22 Thread via cfe-commits
@@ -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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2024-01-18 Thread Tobias Hieta via cfe-commits
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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2024-01-18 Thread via 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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2024-01-18 Thread Tobias Hieta via cfe-commits
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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-29 Thread Owen Pan via cfe-commits
@@ -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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-28 Thread via cfe-commits
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] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-28 Thread via cfe-commits
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] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-28 Thread via cfe-commits
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] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-27 Thread Owen Pan via cfe-commits
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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-27 Thread via cfe-commits
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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-23 Thread via cfe-commits
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] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
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,

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via 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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + +

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + +

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + +

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + +

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via 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. ```

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -24153,6 +24153,123 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); owenca wrote: ```suggestion

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format( bool FixIndentation = (FixBadIndentation || ContinueFormatting) && Indent != TheLine.First->OriginalColumn; bool ShouldFormat = TheLine.Affected || FixIndentation; + +if

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via 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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via 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.

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Owen Pan via cfe-commits
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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Björn Schäpers via 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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread Björn Schäpers via cfe-commits
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format( bool FixIndentation = (FixBadIndentation || ContinueFormatting) && Indent != TheLine.First->OriginalColumn; bool ShouldFormat = TheLine.Affected || FixIndentation; + +if

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread via cfe-commits
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] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-22 Thread via cfe-commits
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format( bool FixIndentation = (FixBadIndentation || ContinueFormatting) && Indent != TheLine.First->OriginalColumn; bool ShouldFormat = TheLine.Affected || FixIndentation; + +if

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-19 Thread Björn Schäpers via cfe-commits
@@ -1308,6 +1308,13 @@ class OptimizingLineFormatter : public LineFormatter { } // anonymous namespace +static bool lineContainsPPDefinition(const AnnotatedLine ) { HazardyKnusperkeks wrote: ```suggestion static bool LineContainsPPDefinition(const

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-19 Thread Björn Schäpers via cfe-commits
@@ -24153,6 +24153,113 @@ TEST_F(FormatTest, WhitespaceSensitiveMacros) { verifyNoChange("FOO(String-ized+But: :Still=Intentional);", Style); } +TEST_F(FormatTest, IgnorePPDefinitions) { + FormatStyle Style = getLLVMStyle(); + Style.IgnorePPDefinitions = true; + +

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-19 Thread Björn Schäpers via cfe-commits
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format( bool FixIndentation = (FixBadIndentation || ContinueFormatting) && Indent != TheLine.First->OriginalColumn; bool ShouldFormat = TheLine.Affected || FixIndentation; + +if

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-18 Thread Owen Pan via 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

[clang] [clang-format] Option to ignore macro definitions (PR #70338)

2023-11-18 Thread Owen Pan via 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