================
@@ -3647,10 +3660,25 @@ static void sortCppIncludes(const FormatStyle &Style,
LHSFilenameLower = Includes[LHSI].Filename.lower();
RHSFilenameLower = Includes[RHSI].Filename.lower();
}
- return std::tie(Includes[LHSI].Priority, LHSStemLower, LHSStem,
- LHSFilenameLower, Includes[LHSI].Filename) <
- std::tie(Includes[RHSI].Priority, RHSStemLower, RHSStem,
- RHSFilenameLower, Includes[RHSI].Filename);
+
+ const auto Compare = Style.SortIncludes.Natural
+ ? &StringRef::compare_numeric
+ : &StringRef::compare;
+
+ if (Style.SortIncludes.IgnoreCase) {
+ if (int Cmp = (StringRef(LHSStemLower).*Compare)(RHSStemLower))
----------------
HazardyKnusperkeks wrote:
```suggestion
if (int Cmp = std::apply(Compare, StringRef(LHSStemLower),
RHSStemLower); Cmp != 0)
```
* `std::apply` is much nicer to read than the member to function pointer syntax.
* I'd be explicit for the comparison, when initializing the variable in the if.
https://github.com/llvm/llvm-project/pull/210788
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits