summaryrefslogtreecommitdiff
path: root/polly
diff options
context:
space:
mode:
Diffstat (limited to 'polly')
-rw-r--r--polly/CMakeLists.txt33
-rwxr-xr-xpolly/utils/check_format.sh31
-rwxr-xr-xpolly/utils/update_format.sh16
3 files changed, 25 insertions, 55 deletions
diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt
index a020571f8a44..20209e953f44 100644
--- a/polly/CMakeLists.txt
+++ b/polly/CMakeLists.txt
@@ -188,15 +188,32 @@ file( GLOB_RECURSE islfiles lib/External/isl/*.h lib/External/isl/*.c
lib/External/isl/include/isl/*.h lib/External/isl/imath/*.h
lib/External/isl/imath/*.c)
list( REMOVE_ITEM files ${jsonfiles} ${islfiles})
-add_custom_command( OUTPUT formatting COMMAND
- CLANG_FORMAT=${LLVM_BINARY_DIR}/bin/clang-format
- ${CMAKE_CURRENT_SOURCE_DIR}/utils/check_format.sh ${files})
-add_custom_target(polly-check-format DEPENDS formatting)
+
+set(check_format_depends)
+set(update_format_depends)
+set(i 0)
+foreach (file IN LISTS files)
+ add_custom_command(OUTPUT polly-check-format${i}
+ COMMAND clang-format -style=llvm ${file} | diff -u ${file} -
+ VERBATIM
+ COMMENT "Checking format of ${file}..."
+ )
+ list(APPEND check_format_depends "polly-check-format${i}")
+
+ add_custom_command(OUTPUT polly-update-format${i}
+ COMMAND clang-format -i -style=llvm ${file}
+ VERBATIM
+ COMMENT "Updating format of ${file}..."
+ )
+ list(APPEND update_format_depends "polly-update-format${i}")
+
+ math(EXPR i ${i}+1)
+endforeach ()
+
+add_custom_target(polly-check-format DEPENDS ${check_format_depends})
set_target_properties(polly-check-format PROPERTIES FOLDER "Polly")
-add_custom_command( OUTPUT formatting-update COMMAND
- CLANG_FORMAT=${LLVM_BINARY_DIR}/bin/clang-format
- ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_format.sh ${files})
-add_custom_target(polly-update-format DEPENDS formatting-update)
+
+add_custom_target(polly-update-format DEPENDS ${update_format_depends})
set_target_properties(polly-update-format PROPERTIES FOLDER "Polly")
# Set the variable POLLY_LINK_LIBS in the llvm/tools/ dir.
diff --git a/polly/utils/check_format.sh b/polly/utils/check_format.sh
deleted file mode 100755
index 4d7b033d1a79..000000000000
--- a/polly/utils/check_format.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-CLANG_FORMAT=${CLANG_FORMAT}
-
-if [ "${CLANG_FORMAT}x" = "x" ]; then
- CLANG_FORMAT=`which clang-format`
- if [ "${CLANG_FORMAT}x" = "x" ]; then
- echo "Error: cannot find clang-format in your path"
- exit 1
- fi
-fi
-
-OK=0
-
-for ARG in "$@"
- do
- ${CLANG_FORMAT} -style=llvm $ARG | diff -u $ARG - >&2
-
- if [[ $? -eq 1 ]]; then
- OK=1
- fi
- done
-
-if [[ $OK -eq "1" ]]; then
- echo "Error: clang-format reported formatting differences"
- exit 1
-else
- echo "OK: clang-format reported no formatting differences"
- exit 0
-fi
-
diff --git a/polly/utils/update_format.sh b/polly/utils/update_format.sh
deleted file mode 100755
index 9226fc6af526..000000000000
--- a/polly/utils/update_format.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-CLANG_FORMAT=${CLANG_FORMAT}
-
-if [ "${CLANG_FORMAT}x" = "x" ]; then
- CLANG_FORMAT=`which clang-format`
- if [ "${CLANG_FORMAT}x" = "x" ]; then
- echo "Error: cannot find clang-format in your path"
- exit 1
- fi
-fi
-
-for ARG in "$@"
- do
- ${CLANG_FORMAT} -i $ARG
- done