[clang-tools-extra] [clang-doc] fix CSS, JS paths for HTML Mustache generation (PR #160360)
    via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Tue Sep 23 11:37:57 PDT 2025
    
    
  
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: Erick Velez (evelez7)
<details>
<summary>Changes</summary>
Resource creation not using the correct path after the patch that placed
HTML files into their own directory.
---
Full diff: https://github.com/llvm/llvm-project/pull/160360.diff
2 Files Affected:
- (modified) clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp (+3-2) 
- (modified) clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp (+2-2) 
``````````diff
diff --git a/clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp b/clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp
index 1ab40aacbfe09..b37dc272ea156 100644
--- a/clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp
@@ -274,11 +274,12 @@ Error MustacheHTMLGenerator::generateDocForInfo(Info *I, raw_ostream &OS,
 }
 
 Error MustacheHTMLGenerator::createResources(ClangDocContext &CDCtx) {
+  std::string ResourcePath(CDCtx.OutDirectory + "/html");
   for (const auto &FilePath : CDCtx.UserStylesheets)
-    if (Error Err = copyFile(FilePath, CDCtx.OutDirectory))
+    if (Error Err = copyFile(FilePath, ResourcePath))
       return Err;
   for (const auto &FilePath : CDCtx.JsScripts)
-    if (Error Err = copyFile(FilePath, CDCtx.OutDirectory))
+    if (Error Err = copyFile(FilePath, ResourcePath))
       return Err;
   return Error::success();
 }
diff --git a/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp b/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
index 602058f5d9eb8..66575d85380f8 100644
--- a/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
+++ b/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
@@ -75,14 +75,14 @@ TEST(HTMLMustacheGeneratorTest, createResources) {
       << "Failed to create resources with valid UserStylesheets and JsScripts";
   {
     SmallString<256> PathBuf;
-    llvm::sys::path::append(PathBuf, RootTestDirectory.path(),
+    llvm::sys::path::append(PathBuf, RootTestDirectory.path(), "html",
                             "clang-doc-mustache.css");
     verifyFileContents(PathBuf, "CSS");
   }
 
   {
     SmallString<256> PathBuf;
-    llvm::sys::path::append(PathBuf, RootTestDirectory.path(), "mustache.js");
+    llvm::sys::path::append(PathBuf, RootTestDirectory.path(), "html", "mustache.js");
     verifyFileContents(PathBuf, "JavaScript");
   }
 }
``````````
</details>
https://github.com/llvm/llvm-project/pull/160360
    
    
More information about the cfe-commits
mailing list