[PATCH] D65918: [clang-doc] Generate an HTML index file

Diego Astiazarán via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 9 13:54:12 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL368484: [clang-doc] Generate an HTML index file (authored by DiegoAstiazaran, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65918?vs=214050&id=214445#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65918/new/

https://reviews.llvm.org/D65918

Files:
  clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp


Index: clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp
===================================================================
--- clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp
+++ clang-tools-extra/trunk/clang-doc/HTMLGenerator.cpp
@@ -813,6 +813,24 @@
   return true;
 }
 
+static bool GenIndex(const ClangDocContext &CDCtx) {
+  std::error_code FileErr, OK;
+  llvm::SmallString<128> IndexPath;
+  llvm::sys::path::native(CDCtx.OutDirectory, IndexPath);
+  llvm::sys::path::append(IndexPath, "index.html");
+  llvm::raw_fd_ostream IndexOS(IndexPath, FileErr, llvm::sys::fs::F_None);
+  if (FileErr != OK) {
+    llvm::errs() << "Error creating main index: " << FileErr.message() << "\n";
+    return false;
+  }
+  HTMLFile F;
+  std::vector<std::unique_ptr<TagNode>> BasicNodes =
+      genCommonFileNodes("Index", "", CDCtx);
+  AppendVector(std::move(BasicNodes), F.Children);
+  F.Render(IndexOS);
+  return true;
+}
+
 static bool CopyFile(StringRef FilePath, StringRef OutDirectory) {
   llvm::SmallString<128> PathWrite;
   llvm::sys::path::native(OutDirectory, PathWrite);
@@ -831,7 +849,7 @@
 }
 
 bool HTMLGenerator::createResources(ClangDocContext &CDCtx) {
-  if (!SerializeIndex(CDCtx))
+  if (!SerializeIndex(CDCtx) || !GenIndex(CDCtx))
     return false;
   for (const auto &FilePath : CDCtx.UserStylesheets)
     if (!CopyFile(FilePath, CDCtx.OutDirectory))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65918.214445.patch
Type: text/x-patch
Size: 1383 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190809/fa0ab771/attachment.bin>


More information about the cfe-commits mailing list