================ @@ -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(); - return std::tie(Includes[LHSI].Priority, LHSFilenameLower, - Includes[LHSI].Filename) < - std::tie(Includes[RHSI].Priority, RHSFilenameLower, - Includes[RHSI].Filename); + SmallString<128> LHSStem = Includes[LHSI].Filename; + SmallString<128> RHSStem = Includes[RHSI].Filename; + if (Style.IncludeStyle.IncludeSortKey == + tooling::IncludeStyle::ISK_Stem) { ---------------- owenca wrote:
```suggestion SmallString<128> LHSStem, RHSStem; if (Style.IncludeStyle.IncludeSortKey == tooling::IncludeStyle::ISK_Stem) { LHSStem = Includes[LHSI].Filename; RHSStem = Includes[RHSI].Filename; ``` So that they will be empty for `ISK_Path` for more efficient comparisons. 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