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

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Wed May 14 07:00:59 PDT 2025


================
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``).
   ``ClassImpl.hpp`` would not have the main include file put on top
   before any other include.
 
+.. _IncludeSortKey:
+
+**IncludeSortKey** (``IncludeSortKeyDiscriminator``) :versionbadge:`clang-format 20` :ref:`ΒΆ <IncludeSortKey>`
+  When sorting includes in each block, sort by the specified sort key
+
+  Possible values:
+
+  * ``ISK_Path`` (in configuration: ``Path``)
----------------
owenca wrote:

I think "stem" means the filename (excluding the parent path part) without the last extension. For example, the stem of `foo/bar/a.hpp.in` is `a.hpp`, not `foo/bar/a.hpp`, which is what this new option is about. We should come up with a better name for the option, and I prefer a boolean to an `enum`.

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


More information about the cfe-commits mailing list