Skip to content

Commit b9ef564

Browse files
Address feedback
1 parent 215aa6c commit b9ef564

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

clang/docs/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,17 @@ if (LLVM_ENABLE_SPHINX)
144144
gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td "${docs_targets}")
145145

146146
set (dump_format_style ${CLANG_SOURCE_DIR}/docs/tools/dump_format_style.py)
147-
add_custom_target(clang-format-style-options
148-
COMMAND "${Python3_EXECUTABLE}" "${dump_format_style}"
149-
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
147+
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ClangFormatStyleOptions.rst"
148+
COMMAND "${Python3_EXECUTABLE}" "${dump_format_style}" "${CMAKE_CURRENT_BINARY_DIR}/ClangFormatStyleOptions.rst"
149+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
150150
DEPENDS "${CLANG_SOURCE_DIR}/include/clang/Format/Format.h"
151151
"${CLANG_SOURCE_DIR}/include/clang/Tooling/Inclusions/IncludeStyle.h"
152+
"${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst.template"
152153
"${dump_format_style}"
153-
copy-clang-rst-docs
154+
)
155+
156+
add_custom_target(clang-format-style-options
157+
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ClangFormatStyleOptions.rst"
154158
)
155159

156160
foreach(target ${docs_targets})

clang/docs/tools/dump_format_style.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
INCLUDE_STYLE_FILE = os.path.join(
1616
CLANG_DIR, "include/clang/Tooling/Inclusions/IncludeStyle.h"
1717
)
18-
DOC_FILE = "ClangFormatStyleOptions.rst"
18+
DOC_FILE = "ClangFormatStyleOptions.rst.template"
1919

2020
PLURALS_FILE = os.path.join(os.path.dirname(__file__), "plurals.txt")
2121

@@ -487,5 +487,5 @@ class State:
487487

488488
contents = substitute(contents, "FORMAT_STYLE_OPTIONS", options_text)
489489

490-
with open(DOC_FILE, "wb") as output:
490+
with open(sys.argv[1], "wb") as output:
491491
output.write(contents.encode())

0 commit comments

Comments
 (0)