[all-commits] [llvm/llvm-project] 1653a0: [clang-format] Add IgnoreExtension to SortIncludes...

Daan De Meyer via All-commits all-commits at lists.llvm.org
Thu Jul 17 00:37:14 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1653a093def10543d8f958fe7d4cde9ab1dd8bca
      https://github.com/llvm/llvm-project/commit/1653a093def10543d8f958fe7d4cde9ab1dd8bca
  Author: Daan De Meyer <daan.j.demeyer at gmail.com>
  Date:   2025-07-17 (Thu, 17 Jul 2025)

  Changed paths:
    M clang/docs/ClangFormatStyleOptions.rst
    M clang/include/clang/Format/Format.h
    M clang/lib/Format/Format.cpp
    M clang/unittests/Format/ConfigParseTest.cpp
    M clang/unittests/Format/SortIncludesTest.cpp

  Log Message:
  -----------
  [clang-format] Add IgnoreExtension to SortIncludes (#137840)

Sorting by stem gives nicer results when various header file names are
substrings of other header file names. For example, a CLI application
with a main header named analyze.h and an analyze-xxx.h header for each
subcommand currently will always put analyze.h last after all the
analyze-xxx.h headers, but putting analyze.h first instead is arguably
nicer to read.

TLDR; Instead of
```
#include "analyze-blame.h"
#include "analyze.h"
```
You'd get
```
#include "analyze.h"
#include "analyze-blame.h"
```

Let's allow sorting by stem instead of full path by adding
IgnoreExtension to SortIncludes.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list