Skip to content

Commit 69f3788

Browse files
committedSep 14, 2015
Revise polly-{update|check}-format targets
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 llvm-svn: 247581
1 parent 64aa388 commit 69f3788

File tree

3 files changed

+25
-55
lines changed

3 files changed

+25
-55
lines changed
 

‎polly/CMakeLists.txt

+25-8
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,32 @@ file( GLOB_RECURSE islfiles lib/External/isl/*.h lib/External/isl/*.c
188188
lib/External/isl/include/isl/*.h lib/External/isl/imath/*.h
189189
lib/External/isl/imath/*.c)
190190
list( REMOVE_ITEM files ${jsonfiles} ${islfiles})
191-
add_custom_command( OUTPUT formatting COMMAND
192-
CLANG_FORMAT=${LLVM_BINARY_DIR}/bin/clang-format
193-
${CMAKE_CURRENT_SOURCE_DIR}/utils/check_format.sh ${files})
194-
add_custom_target(polly-check-format DEPENDS formatting)
191+
192+
set(check_format_depends)
193+
set(update_format_depends)
194+
set(i 0)
195+
foreach (file IN LISTS files)
196+
add_custom_command(OUTPUT polly-check-format${i}
197+
COMMAND clang-format -style=llvm ${file} | diff -u ${file} -
198+
VERBATIM
199+
COMMENT "Checking format of ${file}..."
200+
)
201+
list(APPEND check_format_depends "polly-check-format${i}")
202+
203+
add_custom_command(OUTPUT polly-update-format${i}
204+
COMMAND clang-format -i -style=llvm ${file}
205+
VERBATIM
206+
COMMENT "Updating format of ${file}..."
207+
)
208+
list(APPEND update_format_depends "polly-update-format${i}")
209+
210+
math(EXPR i ${i}+1)
211+
endforeach ()
212+
213+
add_custom_target(polly-check-format DEPENDS ${check_format_depends})
195214
set_target_properties(polly-check-format PROPERTIES FOLDER "Polly")
196-
add_custom_command( OUTPUT formatting-update COMMAND
197-
CLANG_FORMAT=${LLVM_BINARY_DIR}/bin/clang-format
198-
${CMAKE_CURRENT_SOURCE_DIR}/utils/update_format.sh ${files})
199-
add_custom_target(polly-update-format DEPENDS formatting-update)
215+
216+
add_custom_target(polly-update-format DEPENDS ${update_format_depends})
200217
set_target_properties(polly-update-format PROPERTIES FOLDER "Polly")
201218

202219
# Set the variable POLLY_LINK_LIBS in the llvm/tools/ dir.

‎polly/utils/check_format.sh

-31
This file was deleted.

‎polly/utils/update_format.sh

-16
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.