Commit 240e0f8a by Jim Stichnoth

Subzero: Add "make format-diff" target.

This invokes clang-format-diff.py so you can easily reformat just the code you touched. (Caution, this may not apply to new files.) BUG= none R=jvoung@chromium.org Review URL: https://codereview.chromium.org/372133002
parent 45a06236
...@@ -76,9 +76,23 @@ check: llvm2ice ...@@ -76,9 +76,23 @@ check: llvm2ice
(cd crosstest; LLVM_BIN_PATH=$(LLVM_BIN_PATH) ./runtests.sh) (cd crosstest; LLVM_BIN_PATH=$(LLVM_BIN_PATH) ./runtests.sh)
# TODO: Fix the use of wildcards. # TODO: Fix the use of wildcards.
# Assumes clang-format is within $PATH.
format: format:
$(LLVM_BIN_PATH)/clang-format -style=LLVM -i \ clang-format -style=LLVM -i src/*.h src/*.cpp
src/Ice*.h src/Ice*.cpp src/llvm2ice.cpp
# Assumes clang-format-diff.py is within $PATH, and that the
# clang-format it calls is also within $PATH. This may require adding
# a component to $PATH, or creating symlinks within some existing
# $PATH component. Uses the one in /usr/lib/clang-format/ if it
# exists.
ifeq (,$(wildcard /usr/lib/clang-format/clang-format-diff.py))
CLANG_FORMAT_DIFF = clang-format-diff.py
else
CLANG_FORMAT_DIFF = /usr/lib/clang-format/clang-format-diff.py
endif
format-diff:
git diff -U0 HEAD^ | \
$(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i
clean: clean:
rm -rf llvm2ice *.o build/ rm -rf llvm2ice *.o build/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment