[clang] [clang-format] Add Natural option for SortIncludes (PR #210788)
Tshaka Lekholoane via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 27 04:47:16 PDT 2026
================
@@ -3632,13 +3641,17 @@ static void sortCppIncludes(const FormatStyle &Style,
if (Style.SortIncludes.Enabled) {
stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
+ if (Includes[LHSI].Priority != Includes[RHSI].Priority)
+ return Includes[LHSI].Priority < Includes[RHSI].Priority;
+
SmallString<128> LHSStem, RHSStem;
if (Style.SortIncludes.IgnoreExtension) {
LHSStem = Includes[LHSI].Filename;
RHSStem = Includes[RHSI].Filename;
llvm::sys::path::replace_extension(LHSStem, "");
llvm::sys::path::replace_extension(RHSStem, "");
}
+
std::string LHSStemLower, RHSStemLower;
std::string LHSFilenameLower, RHSFilenameLower;
if (Style.SortIncludes.IgnoreCase) {
----------------
tshakalekholoane wrote:
Okay. I made the changes.
https://github.com/llvm/llvm-project/pull/210788
More information about the cfe-commits
mailing list