Skip to content

Commit 22cdeaf

Browse files
[clang-format][CMake] Generate formatting options docs during build
This patch changes up the CMake configuration so that ClangFormatStyleOptions.rst has the format style options section generated by the dump_format_style.py python script during the build rather than manually. This allows us to remove ~6000 lines of automatically generated documentation from the repository. If the context of the options is needed while generating the docs, it is easy enough to open up the generated file with the options from within the build directory after the clang-format-style-options target has been built.
1 parent eb9f475 commit 22cdeaf

File tree

3 files changed

+13
-6651
lines changed

3 files changed

+13
-6651
lines changed

clang/docs/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,17 @@ if (LLVM_ENABLE_SPHINX)
143143
gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td "${docs_targets}")
144144
gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td "${docs_targets}")
145145

146+
add_custom_target(clang-format-style-options
147+
COMMAND "${Python3_EXECUTABLE}" "${CLANG_SOURCE_DIR}/docs/tools/dump_format_style.py"
148+
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
149+
DEPENDS "${CLANG_SOURCE_DIR}/include/clang/Format/Format.h"
150+
"${CLANG_SOURCE_DIR}/include/clang/Tooling/Inclusions/IncludeStyle.h"
151+
"${CLANG_SOURCE_DIR}/docs/tools/dump_format_style.py"
152+
copy-clang-rst-docs
153+
)
154+
146155
foreach(target ${docs_targets})
147-
add_dependencies(${target} copy-clang-rst-docs)
156+
add_dependencies(${target} copy-clang-rst-docs clang-format-style-options)
148157
endforeach()
149158
endif()
150159
endif()

0 commit comments

Comments
 (0)