[clang] [clang-format] Add FilesBeforeFolders option to SortIncludes (PR #208954)
Savvas Shiakas via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 19 11:45:20 PDT 2026
================
@@ -6821,6 +6821,19 @@ the configuration (without a prefix: ``Auto``).
# include "A.inc" # include "A.h"
# include "A-util.h" # include "A.inc"
+ * ``bool FilesBeforeFolders`` When ``true``, sort includes so that files in a directory appear
----------------
Shiakaron wrote:
> what does it do when its false? does it leave it alone or is it FoldersBeforeFiles?
The default is `false` which keeps the existing logic intact, i.e. simple alphabetical sorting. When setting to `true` the files are sorted in the proposed way:
1. sort files in the folder sort alphabetically
2. If there are subfolders:
a. sort subfolders alphabetically
b. iterate on each subfolder
> How does it work with "" and <>?
They are treated the same, so `<boost/cast.hpp>` would be before `<boost/align/align.hpp>`
https://github.com/llvm/llvm-project/pull/208954
More information about the cfe-commits
mailing list