[all-commits] [llvm/llvm-project] 5aca8b: [clang-format] allow clang-format to be passed a f...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Sun Oct 3 04:11:18 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5aca8bb963a43b62f37305f7eb07476631ea9f2a
      https://github.com/llvm/llvm-project/commit/5aca8bb963a43b62f37305f7eb07476631ea9f2a
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2021-10-03 (Sun, 03 Oct 2021)

  Changed paths:
    A clang/docs/tools/clang-formatted-files.txt
    M clang/docs/tools/generate_formatted_state.py
    M clang/tools/clang-format/ClangFormat.cpp

  Log Message:
  -----------
  [clang-format] allow clang-format to be passed a file of filenames so we can add a regression suite of "clean clang-formatted files" from LLVM

This change now generates that list, and the change to clang-format allows
us to run clang-format quickly over these files via the list of files.

clang-format.exe -verbose -n --files=./clang/docs/tools/clang-formatted-files.txt

```
Clang-formating 7926 files
Formatting [1/7925] clang/bindings/python/tests/cindex/INPUTS/header1.h
..
Formatting [7925/7925] utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
```

This is needed because putting all those files on the command line is too
long, and invoking 7900+ clang-formats is much slower (too slow to be honest)

Using this method it takes on 7.5 minutes (on my machine) to run
`clang-format -n` over all of the files (7925), this should result in us
testing any change quickly and easily.

We should be able to use rerunning this list to ensure that we don't regress
clang-format over a large code base, but also use it to ensure none of the
previous files which were 100% clang-formatted remain so.
(which the LLVM premerge checks should be enforcing)

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D111000




More information about the All-commits mailing list