[clang] clang-format: Add IncludeSortKey option (PR #137840)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Thu May 1 12:28:43 PDT 2025


================
@@ -166,6 +166,16 @@ struct IncludeStyle {
   /// directives that use the specified character are considered.
   /// \version 19
   MainIncludeCharDiscriminator MainIncludeChar;
+
+  enum IncludeSortKeyDiscriminator : int8_t {
+    /// Includes are sorted alphabetically by their full path.
+    ISK_Path,
+    /// Includes are sorted alphabetically by their full path without file
+    /// extension.
+    ISK_Stem,
+  };
+
+  IncludeSortKeyDiscriminator IncludeSortKey;
----------------
HazardyKnusperkeks wrote:

You need to initialize this, in `Format.cpp` around line 1585.

https://github.com/llvm/llvm-project/pull/137840


More information about the cfe-commits mailing list