[clang] clang-format: Add IncludeSortKey option (PR #137840)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 19 09:29:28 PDT 2025
================
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true, /*IgnoreCase=*/false};
+ LLVMStyle.SortIncludes = {/*Enabled=*/true, /*IgnoreCase=*/false, /*IgnoreExtension=*/false};
----------------
mydeveloperday wrote:
> "currently will always put analyze.h last after all the analyze-xxx.h headers, but putting analyze.h first instead of last is arguable nicer to read"
How come for me its doesn't do this as you say...
seems your example might not be the best for the documentation, seems like this is dependent on the basename length being greater than 1 in length. Ok so thats confusing...the documentation should represent what happens.
```c++
#include "ab-beta.h"
#include "ab-data.h"
#include "ab.h"
```
```c++
#include "a.h"
#include "a-beta.h"
#include "a-data.h"
```
https://github.com/llvm/llvm-project/pull/137840
More information about the cfe-commits
mailing list