[clang] [clang][docs] Pass full path of source TD file to gen_rst_from_td. [NFC] (PR #66497)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 04:53:19 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang
            
<details>
<summary>Changes</summary>
This change is needed to be able to refer to TD files that are not stored in ${CMAKE_CURRENT_SOURCE_DIR}.
--
Full diff: https://github.com/llvm/llvm-project/pull/66497.diff

1 Files Affected:

- (modified) clang/docs/CMakeLists.txt (+6-7) 


<pre>
diff --git a/clang/docs/CMakeLists.txt b/clang/docs/CMakeLists.txt
index 4163dd2d90ad5b3..a63823c63428288 100644
--- a/clang/docs/CMakeLists.txt
+++ b/clang/docs/CMakeLists.txt
@@ -91,10 +91,10 @@ endif()
 endif()
 
 function (gen_rst_file_from_td output_file td_option source docs_targets)
-  if (NOT EXISTS &quot;${CMAKE_CURRENT_SOURCE_DIR}/${source}&quot;)
-    message(FATAL_ERROR &quot;Cannot find source file: ${source} in ${CMAKE_CURRENT_SOURCE_DIR}&quot;)
+  if (NOT EXISTS &quot;${source}&quot;)
+    message(FATAL_ERROR &quot;Cannot find source file: ${source}&quot;)
   endif()
-  get_filename_component(TABLEGEN_INCLUDE_DIR &quot;${CMAKE_CURRENT_SOURCE_DIR}/${source}&quot; DIRECTORY)
+  get_filename_component(TABLEGEN_INCLUDE_DIR &quot;${source}&quot; DIRECTORY)
   list(APPEND LLVM_TABLEGEN_FLAGS &quot;-I${TABLEGEN_INCLUDE_DIR}&quot;)
   clang_tablegen(${output_file} ${td_option} SOURCE ${source} TARGET &quot;gen-${output_file}&quot;)
   foreach(target ${docs_targets})
@@ -138,10 +138,9 @@ if (LLVM_ENABLE_SPHINX)
     endif()
 
     # Generated files
-    gen_rst_file_from_td(AttributeReference.rst -gen-attr-docs ../include/clang/Basic/Attr.td &quot;${docs_targets}&quot;)
-    gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td &quot;${docs_targets}&quot;)
-    gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td &quot;${docs_targets}&quot;)
-
+    gen_rst_file_from_td(AttributeReference.rst -gen-attr-docs ${CMAKE_CURRENT_SOURCE_DIR}/../include/clang/Basic/Attr.td &quot;${docs_targets}&quot;)
+    gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ${CMAKE_CURRENT_SOURCE_DIR}/../include/clang/Basic/Diagnostic.td &quot;${docs_targets}&quot;)
+    gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ${CMAKE_CURRENT_SOURCE_DIR}/../include/clang/Driver/ClangOptionDocs.td &quot;${docs_targets}&quot;)
     foreach(target ${docs_targets})
       add_dependencies(${target} copy-clang-rst-docs)
     endforeach()
</pre>
</details>


https://github.com/llvm/llvm-project/pull/66497


More information about the cfe-commits mailing list