Author: owenca Date: 2026-06-23T08:17:12-07:00 New Revision: 0ce76c77c9e0ee15905d76500bfa0235c2ac3741
URL: https://github.com/llvm/llvm-project/commit/0ce76c77c9e0ee15905d76500bfa0235c2ac3741 DIFF: https://github.com/llvm/llvm-project/commit/0ce76c77c9e0ee15905d76500bfa0235c2ac3741.diff LOG: [clang-format] Don't check the format if diff is unavailable (#205036) Added: Modified: clang/lib/Format/CMakeLists.txt Removed: ################################################################################ diff --git a/clang/lib/Format/CMakeLists.txt b/clang/lib/Format/CMakeLists.txt index 3e19151790440..df73212983ab1 100644 --- a/clang/lib/Format/CMakeLists.txt +++ b/clang/lib/Format/CMakeLists.txt @@ -41,21 +41,27 @@ file(GLOB_RECURSE files ${CLANG_SOURCE_DIR}/unittests/Format/*.h ) -set(check_format_depends) -set(i 0) -foreach(file IN LISTS files) - add_custom_command(OUTPUT check_format_depend_${i} - COMMAND clang-format ${file} | diff -u ${file} - && - touch check_format_depend_${i} - VERBATIM - COMMENT "Checking format of ${file}" - DEPENDS clang-format - ${file} - ) - list(APPEND check_format_depends check_format_depend_${i}) - math(EXPR i ${i}+1) -endforeach() -add_custom_target(clang-format-check-format DEPENDS ${check_format_depends}) +find_program(DIFF_EXE diff ) +if(DIFF_EXE) + set(check_format_depends) + set(i 0) + foreach(file IN LISTS files) + add_custom_command(OUTPUT check_format_depend_${i} + COMMAND clang-format ${file} | diff -u ${file} - && + touch check_format_depend_${i} + VERBATIM + COMMENT "Checking format of ${file}" + DEPENDS clang-format + ${file} + ) + list(APPEND check_format_depends check_format_depend_${i}) + math(EXPR i ${i}+1) + endforeach() + add_custom_target(clang-format-check-format DEPENDS ${check_format_depends}) +else() + add_custom_target(clang-format-check-format DEPENDS clang-format) +endif() + set(docs_tools_dir ${CLANG_SOURCE_DIR}/docs/tools) _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
