cmake: Add target to reformat with clang-format

Calling 'make polly-update-format' will format all Polly files with
clang-format.

llvm-svn: 181293
This commit is contained in:
Tobias Grosser 2013-05-07 07:30:31 +00:00
parent 75b8cdee19
commit d0fe8371bf
2 changed files with 14 additions and 0 deletions

View File

@ -165,3 +165,6 @@ list( REMOVE_ITEM files ${jsonfiles} )
add_custom_command( OUTPUT formatting COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/utils/check_format.sh ${files})
add_custom_target(polly-check-format DEPENDS formatting)
add_custom_command( OUTPUT formatting-update COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/utils/update_format.sh ${files})
add_custom_target(polly-update-format DEPENDS formatting-update)

11
polly/utils/update_format.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
if ! which clang-format; then
echo "Error: cannot find clang-format in your path"
exit 1
fi
for ARG in "$@"
do
clang-format -i $ARG
done