MyDeveloperDay added a comment. In D68551#1696598 <https://reviews.llvm.org/D68551#1696598>, @Eugene.Zelenko wrote:
> If clang-format if clang-formatted now completely, I think will be good idea > to add rule to check this during build, like Polly does. This is a great idea... Do you know if is this run as part of the build or as a custom rule they have to remember to run? I guess some additional checking might be needed to allow bootstrapping this, but I really like this idea of once a directory is clean keeping it clean because of its part of a normal build. Keeping code clang-format clean with all the best will in the world is super hard, changes drift in very slowly even with asking people to `git-clang-format` then if one is missing you are asking for what I'm doing here which is making a clang-format only commit and some don't like that. # Add target to check formatting of polly files file( GLOB_RECURSE files *.h lib/*.cpp lib/*.c tools/*.cpp tools/*.c tools/*.h unittests/*.cpp) file( GLOB_RECURSE external lib/External/*.h lib/External/*.c lib/External/*.cpp isl_config.h) list( REMOVE_ITEM files ${external}) 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 -sort-includes -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 -sort-includes -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_target(polly-update-format DEPENDS ${update_format_depends}) set_target_properties(polly-update-format PROPERTIES FOLDER "Polly") Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D68551/new/ https://reviews.llvm.org/D68551 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits