[polly] r195507 - cmake: Provide path to installed clang-format

Tobias Grosser tobias at grosser.es
Fri Nov 22 14:42:14 PST 2013


Author: grosser
Date: Fri Nov 22 16:42:13 2013
New Revision: 195507

URL: http://llvm.org/viewvc/llvm-project?rev=195507&view=rev
Log:
cmake: Provide path to installed clang-format

This will now also enable the automatic formatting checks in the Polly buildbot.

Modified:
    polly/trunk/CMakeLists.txt
    polly/trunk/utils/check_format.sh
    polly/trunk/utils/update_format.sh

Modified: polly/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/CMakeLists.txt?rev=195507&r1=195506&r2=195507&view=diff
==============================================================================
--- polly/trunk/CMakeLists.txt (original)
+++ polly/trunk/CMakeLists.txt Fri Nov 22 16:42:13 2013
@@ -168,8 +168,10 @@ file( GLOB_RECURSE files *.h *.cpp)
 file( GLOB_RECURSE jsonfiles lib/JSON/*.h lib/JSON/*.cpp)
 list( REMOVE_ITEM files ${jsonfiles} )
 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)
 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)

Modified: polly/trunk/utils/check_format.sh
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/utils/check_format.sh?rev=195507&r1=195506&r2=195507&view=diff
==============================================================================
--- polly/trunk/utils/check_format.sh (original)
+++ polly/trunk/utils/check_format.sh Fri Nov 22 16:42:13 2013
@@ -1,16 +1,20 @@
 #!/bin/bash
 
-if ! which clang-format; then
-    echo "Error: cannot find clang-format in your path"
-    # Do not fail. This is a temporary fix to silence buildbots.
-    exit 0
+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 $ARG | diff -u $ARG -
+    ${CLANG_FORMAT} $ARG | diff -u $ARG -
 
     if [[ $? -eq 1 ]]; then
       OK=1

Modified: polly/trunk/utils/update_format.sh
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/utils/update_format.sh?rev=195507&r1=195506&r2=195507&view=diff
==============================================================================
--- polly/trunk/utils/update_format.sh (original)
+++ polly/trunk/utils/update_format.sh Fri Nov 22 16:42:13 2013
@@ -1,11 +1,16 @@
 #!/bin/bash
 
-if ! which clang-format; then
-    echo "Error: cannot find clang-format in your path"
-    exit 1
+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
+    ${CLANG_FORMAT} -i $ARG
   done





More information about the llvm-commits mailing list