Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
Revise polly-{update|check}-format targets
Browse files Browse the repository at this point in the history
Summary:
Make clang-format run on each file independently using
add_custom_format (instead using a shell script in utils/). The targets
polly-{update|check}-format depend on these.

The primary motivation is to make them work on Windows, but also
improves them generally:
- Each file update/check can run in parallel (Although they do not take
  long to run anyway)
- Implicit dependency on clang-format, so it recompiles if necessary
- polly-check-format shows the formatting difference if failing

Differential Revision: http://reviews.llvm.org/D12837


git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@247581 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Meinersbur committed Sep 14, 2015
1 parent 1766b5e commit 67727f0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 55 deletions.
33 changes: 25 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
31 changes: 0 additions & 31 deletions utils/check_format.sh

This file was deleted.

16 changes: 0 additions & 16 deletions utils/update_format.sh

This file was deleted.

0 comments on commit 67727f0

Please sign in to comment.