@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
>From 607b938f548fcb734893e4082ce135e986353759 Mon Sep 17 00:00:00 2001
From: Daan De Meyer
Date: Tue, 29 Apr 2025 18:26:36 +0200
Subject: [PATCH] clang-format: Add IgnoreExtension option to
SortIncludesOpt
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
>From 0827e9c4152485a280dc9e65ca8a0eaa3a9a385f Mon Sep 17 00:00:00 2001
From: Daan De Meyer
Date: Tue, 29 Apr 2025 18:26:36 +0200
Subject: [PATCH] clang-format: Add IgnoreExtension option to
SortIncludesOpt
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
@@ -4382,8 +4382,18 @@ struct FormatStyle {
///#include "B/a.h" #include "a/b.h"
/// \endcode
bool IgnoreCase;
+/// When sorting includes in each block, Only take file extensions into
HazardyKnusperkeks wrote:
```suggestion
//
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
DaanDeMeyer wrote:
Ping? Would love to get this over the finish line
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
>From 3cf3ada4cfe78d943815e59f8df9ea74212e76e3 Mon Sep 17 00:00:00 2001
From: Daan De Meyer
Date: Tue, 29 Apr 2025 18:26:36 +0200
Subject: [PATCH] clang-format: Add IgnoreExtension option to
SortIncludesOpt
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
>From 6a3e7f091fbb8bc7117f5ef1d2803e73b8c6f061 Mon Sep 17 00:00:00 2001
From: Daan De Meyer
Date: Tue, 29 Apr 2025 18:26:36 +0200
Subject: [PATCH] clang-format: Add IgnoreExtension option to
SortIncludesOpt
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
>From bb5eb380a0f71cac0c734443b4fbfa4441f441b2 Mon Sep 17 00:00:00 2001
From: Daan De Meyer
Date: Tue, 29 Apr 2025 18:26:36 +0200
Subject: [PATCH] clang-format: Add IgnoreExtension option to
SortIncludesOpt
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
https://github.com/mydeveloperday edited
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
https://github.com/mydeveloperday requested changes to this pull request.
Do we have the correct current default
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mai
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
>From beab0ecdeda1454de56cf1851dc03dda6d02673e Mon Sep 17 00:00:00 2001
From: Daan De Meyer
Date: Tue, 29 Apr 2025 18:26:36 +0200
Subject: [PATCH] clang-format: Add IgnoreExtension option to
SortIncludesOpt
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
>From 33f84b217caab01a5ebbf93e4e5ac2182810c8db Mon Sep 17 00:00:00 2001
From: Daan De Meyer
Date: Tue, 29 Apr 2025 18:26:36 +0200
Subject: [PATCH] clang-format: Add IgnoreExtension option to
SortIncludesOpt
@@ -152,6 +152,10 @@ struct IncludeStyle {
/// \version 10
std::string IncludeIsMainSourceRegex;
+ /// When sorting includes in each block, ignore file extensions.
DaanDeMeyer wrote:
I added more explanation and added an example
https://github.com/llvm/
DaanDeMeyer wrote:
@owenca @HazardyKnusperkeks Rebased onto latest main to take advantage of
@owenca's rework and addressed comments.
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://list
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
>From ab2206d22a9d71df807753f193f4110b191ab77b Mon Sep 17 00:00:00 2001
From: Daan De Meyer
Date: Tue, 29 Apr 2025 18:26:36 +0200
Subject: [PATCH] clang-format: Add IgnoreExtension option to
SortIncludesOpt
@@ -152,6 +152,10 @@ struct IncludeStyle {
/// \version 10
std::string IncludeIsMainSourceRegex;
+ /// When sorting includes in each block, ignore file extensions.
HazardyKnusperkeks wrote:
I currently don't have a better name, but this isn't correct. Yo
@@ -5368,6 +5368,8 @@ struct FormatStyle {
IncludeStyle.IncludeIsMainSourceRegex ==
R.IncludeStyle.IncludeIsMainSourceRegex &&
IncludeStyle.MainIncludeChar == R.IncludeStyle.MainIncludeChar &&
+ IncludeStyle.IncludeSortIgnoreExtens
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,sa
DaanDeMeyer wrote:
@owenca Thanks for the detailed review. Changed the name to
IncludeSortIgnoreExtension, let me know if you have a better idea for the name.
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@li
@@ -3221,15 +3223,33 @@ static void sortCppIncludes(const FormatStyle &Style,
stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
const auto LHSFilenameLower = Includes[LHSI].Filename.lower();
const auto RHSFilenameLower = Includes[RHSI].Filename.lower();
-
@@ -3221,15 +3223,33 @@ static void sortCppIncludes(const FormatStyle &Style,
stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
const auto LHSFilenameLower = Includes[LHSI].Filename.lower();
const auto RHSFilenameLower = Includes[RHSI].Filename.lower();
-
@@ -3221,15 +3223,33 @@ static void sortCppIncludes(const FormatStyle &Style,
stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
const auto LHSFilenameLower = Includes[LHSI].Filename.lower();
const auto RHSFilenameLower = Includes[RHSI].Filename.lower();
-
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``).
``ClassImpl.hpp`` would not have the main include file put on top
before any other include.
+.. _IncludeSortKey:
+
+**IncludeSortKey** (``IncludeSortKeyDiscriminator``)
:versionbadge:`clang-format 20`
DaanDeMeyer wrote:
> I would expect that file extensions be sorted regardless. For example:
>
> ```
> #include "a.h"
> #include "a.inc"
> #include "a-util.def"
> #include "a-util.h"
> ```
Addressed
https://github.com/llvm/llvm-project/pull/137840
___
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,sa
owenca wrote:
I would expect that file extensions be sorted regardless. For example:
```
#include "a.h"
#include "a.inc"
#include "a-util.def"
#include "a-util.h"
```
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-com
DaanDeMeyer wrote:
Ping @owenca @HazardyKnusperkeks
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``).
``ClassImpl.hpp`` would not have the main include file put on top
before any other include.
+.. _IncludeSortKey:
+
+**IncludeSortKey** (``IncludeSortKeyDiscriminator``)
:versionbadge:`clang-format 20`
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
>From 7e2463f6fb9a3d64b1be25f2ea6ea91de2d4e982 Mon Sep 17 00:00:00 2001
From: Daan De Meyer
Date: Tue, 29 Apr 2025 18:26:36 +0200
Subject: [PATCH] clang-format: Add IncludeSortKey option
Sorting by stem giv
@@ -166,6 +166,16 @@ struct IncludeStyle {
/// directives that use the specified character are considered.
/// \version 19
MainIncludeCharDiscriminator MainIncludeChar;
+
+ enum IncludeSortKeyDiscriminator : int8_t {
+/// Includes are sorted alphabetically by their f
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``).
``ClassImpl.hpp`` would not have the main include file put on top
before any other include.
+.. _IncludeSortKey:
+
+**IncludeSortKey** (``IncludeSortKeyDiscriminator``)
:versionbadge:`clang-format 20`
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``).
``ClassImpl.hpp`` would not have the main include file put on top
before any other include.
+.. _IncludeSortKey:
HazardyKnusperkeks wrote:
Did you write this on your own? You need to d
@@ -166,6 +166,16 @@ struct IncludeStyle {
/// directives that use the specified character are considered.
/// \version 19
MainIncludeCharDiscriminator MainIncludeChar;
+
+ enum IncludeSortKeyDiscriminator : int8_t {
HazardyKnusperkeks wrote:
Can you so
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``).
``ClassImpl.hpp`` would not have the main include file put on top
before any other include.
+.. _IncludeSortKey:
+
+**IncludeSortKey** (``IncludeSortKeyDiscriminator``)
:versionbadge:`clang-format 20`
https://github.com/DaanDeMeyer updated
https://github.com/llvm/llvm-project/pull/137840
>From 73a18a033e0d978d1662a391fedf731dbad7de27 Mon Sep 17 00:00:00 2001
From: Daan De Meyer
Date: Tue, 29 Apr 2025 18:26:36 +0200
Subject: [PATCH] clang-format: Add IncludeSortKey option
Sorting by stem giv
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 HEAD~1 HEAD --extensions cpp,h --
clang/include/clang/Format/Format.h
clang/include/
DaanDeMeyer wrote:
@HazardyKnusperkeks @owenca Updated PR to introduce a new option
`IncludeSortKey`, PTAL!
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman
https://github.com/DaanDeMeyer edited
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
51 matches
Mail list logo