[polly] r175170 - cmake: add command polly-check-format

Tobias Grosser grosser at fim.uni-passau.de
Thu Feb 14 08:19:16 PST 2013


Author: grosser
Date: Thu Feb 14 10:19:16 2013
New Revision: 175170

URL: http://llvm.org/viewvc/llvm-project?rev=175170&view=rev
Log:
cmake: add command polly-check-format

This command runs clang-format on all files and reports formatting problems

Added:
    polly/trunk/utils/check_format.sh   (with props)
Modified:
    polly/trunk/CMakeLists.txt

Modified: polly/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/CMakeLists.txt?rev=175170&r1=175169&r2=175170&view=diff
==============================================================================
--- polly/trunk/CMakeLists.txt (original)
+++ polly/trunk/CMakeLists.txt Thu Feb 14 10:19:16 2013
@@ -158,3 +158,8 @@ add_subdirectory(tools)
 configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/include/polly/Config/config.h.cmake
                 ${POLLY_BINARY_DIR}/include/polly/Config/config.h )
 
+# Add target to check formatting of polly files
+file( GLOB_RECURSE files *.h *.cpp)
+add_custom_command( OUTPUT formatting COMMAND
+  ${CMAKE_CURRENT_SOURCE_DIR}/utils/check_format.sh ${files})
+add_custom_target(polly-check-format ALL DEPENDS formatting)

Added: polly/trunk/utils/check_format.sh
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/utils/check_format.sh?rev=175170&view=auto
==============================================================================
--- polly/trunk/utils/check_format.sh (added)
+++ polly/trunk/utils/check_format.sh Thu Feb 14 10:19:16 2013
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+OK=0
+
+for ARG in "$@"
+  do
+    clang-format $1 | diff $1 -
+
+    if [[ $? -eq 1 ]]; then
+      OK=1
+    fi
+  done
+
+if [[ $OK -eq "1" ]]; then
+  echo "Error: clang-format reported formatting differences"
+else
+  echo "OK: clang-format reported no formatting differences"
+fi
+

Propchange: polly/trunk/utils/check_format.sh
------------------------------------------------------------------------------
    svn:executable = *





More information about the llvm-commits mailing list