[clang] f7560ee - [clang-format] Add cmake target clang-format-style-options for updating ClangFormatStyleOptions.rst (#111513)

via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 22:50:04 PST 2024


Author: Iuri Chaer
Date: 2024-12-04T22:50:01-08:00
New Revision: f7560ee97b7441eb3f5b2d0744aad857fafa5855

URL: https://github.com/llvm/llvm-project/commit/f7560ee97b7441eb3f5b2d0744aad857fafa5855
DIFF: https://github.com/llvm/llvm-project/commit/f7560ee97b7441eb3f5b2d0744aad857fafa5855.diff

LOG: [clang-format] Add cmake target clang-format-style-options for updating ClangFormatStyleOptions.rst (#111513)

* Create a new `clang-format-style-options` build target which
re-generates ClangFormatStyleOptions.rst from its source header files.

As discussed in
https://github.com/llvm/llvm-project/pull/96804#discussion_r1718407404

---------

Co-authored-by: Owen Pan <owenpiano at gmail.com>

Added: 
    

Modified: 
    clang/lib/Format/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/CMakeLists.txt b/clang/lib/Format/CMakeLists.txt
index ff987cc608fb88..a633a15df3d9aa 100644
--- a/clang/lib/Format/CMakeLists.txt
+++ b/clang/lib/Format/CMakeLists.txt
@@ -53,3 +53,13 @@ foreach (file IN LISTS files)
 endforeach ()
 
 add_custom_target(clang-format-check-format DEPENDS ${check_format_depends})
+
+set(style_options_depends ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst)
+add_custom_command(OUTPUT ${style_options_depends}
+  COMMAND ${Python3_EXECUTABLE} dump_format_style.py
+  WORKING_DIRECTORY ${CLANG_SOURCE_DIR}/docs/tools
+  DEPENDS ${CLANG_SOURCE_DIR}/include/clang/Format/Format.h
+          ${CLANG_SOURCE_DIR}/include/clang/Tooling/Inclusions/IncludeStyle.h
+  )
+add_custom_target(clang-format-style-options DEPENDS ${style_options_depends})
+add_dependencies(clangFormat clang-format-style-options)


        


More information about the cfe-commits mailing list