Author: Owen Pan Date: 2024-12-07T22:41:50-08:00 New Revision: 6b1c357acc312961743bef05f99120e7c68b2e25
URL: https://github.com/llvm/llvm-project/commit/6b1c357acc312961743bef05f99120e7c68b2e25 DIFF: https://github.com/llvm/llvm-project/commit/6b1c357acc312961743bef05f99120e7c68b2e25.diff LOG: [clang-format] Add cmake target clang-format-help to update ClangFormat.rst Added: Modified: clang/lib/Format/CMakeLists.txt Removed: ################################################################################ diff --git a/clang/lib/Format/CMakeLists.txt b/clang/lib/Format/CMakeLists.txt index 7d2db087328e4a..9f4939824fdb8b 100644 --- a/clang/lib/Format/CMakeLists.txt +++ b/clang/lib/Format/CMakeLists.txt @@ -48,18 +48,17 @@ foreach(file IN LISTS files) COMMENT "Checking format of ${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}) -set(style_options_depends ${CMAKE_CURRENT_BINARY_DIR}/dummy_output) set(docs_tools_dir ${CLANG_SOURCE_DIR}/docs/tools) + +set(format_style_depend ${CMAKE_CURRENT_BINARY_DIR}/format_style_depend) +set(dump_style dump_format_style.py) set(style_options_rst ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst) -add_custom_command(OUTPUT ${style_options_depends} - COMMAND ${Python3_EXECUTABLE} dump_format_style.py && - touch ${style_options_depends} +add_custom_command(OUTPUT ${format_style_depend} + COMMAND ${Python3_EXECUTABLE} ${dump_style} && touch ${format_style_depend} WORKING_DIRECTORY ${docs_tools_dir} VERBATIM COMMENT "Updating ${style_options_rst}" @@ -67,7 +66,21 @@ add_custom_command(OUTPUT ${style_options_depends} ${CLANG_SOURCE_DIR}/include/clang/Tooling/Inclusions/IncludeStyle.h ${style_options_rst} ${docs_tools_dir}/plurals.txt - ${docs_tools_dir}/dump_format_style.py + ${docs_tools_dir}/${dump_style} ) +add_custom_target(clang-format-style DEPENDS ${format_style_depend}) -add_custom_target(clang-format-style-options DEPENDS ${style_options_depends}) +set(format_help_depend ${CMAKE_CURRENT_BINARY_DIR}/format_help_depend) +set(dump_help dump_format_help.py) +set(clang_format_rst ${CLANG_SOURCE_DIR}/docs/ClangFormat.rst) +add_custom_command(OUTPUT ${format_help_depend} + COMMAND ${Python3_EXECUTABLE} ${dump_help} -d ${CMAKE_BINARY_DIR}/bin && + touch ${format_help_depend} + WORKING_DIRECTORY ${docs_tools_dir} + VERBATIM + COMMENT "Updating ${clang_format_rst}" + DEPENDS clang-format + ${clang_format_rst} + ${docs_tools_dir}/${dump_help} + ) +add_custom_target(clang-format-help DEPENDS ${format_help_depend}) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits