[PATCH] D143691: Fix clang-formats IncludeCategory to match the documentation
Fabian Keßler via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 9 16:49:55 PST 2023
Febbe added a comment.
Still some issues with: SortPriorities
The following settings (note the SortPriority of '^<.*' == 1) which will produce an extra group for the attached includes:
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 2
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 1
- Regex: '^<.*'
Priority: 2
SortPriority: 1
- Regex: '.*'
Priority: -1
SortPriority: 1
#include "toolset_febbe.h"
#include "zhello_world.h"
#include <cstddef>
#include <cstdint>
#include <ext/bar.h>
#include <iostream> // <- no group expected
But at least it does what the documentation states and the most users would expect for the default case (Priority == SortPriority).
It seems that the include list is currently first sorted (by SortPriority), and then split into groups, which does not make much sense, since it also rearranges the groups and splits them up, but the sorting before the regroup is at least documented.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143691/new/
https://reviews.llvm.org/D143691
More information about the cfe-commits
mailing list