diff options
author | Tobias Markmann <tm@ayena.de> | 2018-07-30 13:38:23 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2018-07-30 14:13:53 (GMT) |
commit | 9d88d2c7130ebccdec12abf6420843d0f5e08e8e (patch) | |
tree | 140caa05f646906e91399e2d9d0b319a59ce8e16 /Makefile | |
parent | 798f8ec3331043a92f6ca3bc810b9477c3f8261e (diff) | |
download | swift-9d88d2c7130ebccdec12abf6420843d0f5e08e8e.zip swift-9d88d2c7130ebccdec12abf6420843d0f5e08e8e.tar.bz2 |
Add clang-tidy-fix target to Makefile
This has clang-tidy write changes out to YAML files in
parallel and finally runs clang-apply-replacements which
merges, deduplicates and applies the changes in serial.
Uses Python to determine the number of parallel jobs to run.
Test-Information:
Tested by adding new checks and running clang-tidy-fix. Works
as described above and is much faster compared to a serial
`clang-tidy -fix` run.
Change-Id: Idb357e63edeba75ef9a4fb53f5ddef2a7c3c23ee
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -1,10 +1,18 @@ + +NUM_CPU := $(shell python -c 'import multiprocessing; print(multiprocessing.cpu_count())') + .PHONY: all all: build.ninja ninja .PHONY: clang-tidy clang-tidy: compile_commands.json - ninja -t targets all | grep cxx | grep -v 3rdParty | sed -e's/\.o: cxx/.cpp/' | xargs -n 1 clang-tidy + ninja -t targets all | grep cxx | grep -v 3rdParty | sed -e's/\.o: cxx/.cpp/' | xargs -t -P ${NUM_CPU} -n 1 clang-tidy -warnings-as-errors=* + +.PHONY: clang-tidy-fix +clang-tidy-fix: compile_commands.json + ninja -t targets all | grep cxx | grep -v 3rdParty | sed -e's/\.o: cxx/.cpp/' | xargs -t -P ${NUM_CPU} -n 1 -I{} clang-tidy -p=${PWD} -export-fixes={}.clang-tidy-changes.yaml {} + clang-apply-replacements -remove-change-desc-files ${PWD} compile_commands.json: build.ninja ninja -t compdb cxx > compile_commands.json |