[clang-tools-extra] [clang-doc] Add --asset option to clang-doc (PR #94717)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 20 00:20:37 PDT 2024
https://github.com/PeterChou1 updated https://github.com/llvm/llvm-project/pull/94717
>From eeb334620df72c395a5ad27f44a864a6a0c194a5 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Thu, 6 Jun 2024 23:18:12 -0400
Subject: [PATCH 01/20] [clang][clang-doc] add asset path
---
.../clang-doc/tool/ClangDocMain.cpp | 73 ++++++++++++++-----
1 file changed, 55 insertions(+), 18 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 21b581fa6df2e..df53c46b4a76e 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -81,6 +81,12 @@ static llvm::cl::list<std::string> UserStylesheets(
llvm::cl::desc("CSS stylesheets to extend the default styles."),
llvm::cl::cat(ClangDocCategory));
+static llvm::cl::opt<std::string>
+ UserAssetPath("asset",
+ llvm::cl::desc("User supplied asset path for html output to "
+ "override the default css and js files"),
+ llvm::cl::cat(ClangDocCategory));
+
static llvm::cl::opt<std::string> SourceRoot("source-root", llvm::cl::desc(R"(
Directory where processed files are stored.
Links to definition locations will only be
@@ -131,12 +137,54 @@ std::string GetExecutablePath(const char *Argv0, void *MainAddr) {
return llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
}
+void GetAssetFiles(clang::doc::ClangDocContext CDCtx) {
+ std::error_code Code;
+ for (auto DirIt = llvm::sys::fs::directory_iterator(
+ std::string(UserAssetPath), Code),
+ dir_end = llvm::sys::fs::directory_iterator();
+ !Code && DirIt != dir_end; DirIt.increment(Code)) {
+ llvm::SmallString<128> filePath = llvm::SmallString<128>(DirIt->path());
+ if (llvm::sys::fs::is_regular_file(filePath)) {
+ if (filePath.ends_with(".css")) {
+ CDCtx.UserStylesheets.push_back(std::string(filePath));
+ } else if (filePath.ends_with(".js")) {
+ CDCtx.FilesToCopy.push_back(std::string(filePath));
+ }
+ }
+ }
+}
+
+void GetDefaultAssetFiles(const char *Argv0,
+ clang::doc::ClangDocContext CDCtx) {
+ void *MainAddr = (void *)(intptr_t)GetExecutablePath;
+ std::string ClangDocPath = GetExecutablePath(Argv0, MainAddr);
+ llvm::SmallString<128> NativeClangDocPath;
+ llvm::sys::path::native(ClangDocPath, NativeClangDocPath);
+
+ llvm::SmallString<128> AssetsPath;
+ AssetsPath = llvm::sys::path::parent_path(NativeClangDocPath);
+ llvm::sys::path::append(AssetsPath, "..", "share", "clang");
+ llvm::SmallString<128> DefaultStylesheet;
+ llvm::sys::path::native(AssetsPath, DefaultStylesheet);
+ llvm::sys::path::append(DefaultStylesheet,
+ "clang-doc-default-stylesheet.css");
+ llvm::SmallString<128> IndexJS;
+ llvm::sys::path::native(AssetsPath, IndexJS);
+ llvm::sys::path::append(IndexJS, "index.js");
+ CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
+ std::string(DefaultStylesheet));
+ CDCtx.FilesToCopy.emplace_back(IndexJS.str());
+
+ llvm::outs() << "No default asset path found using default asset path: "
+ << AssetsPath << "\n";
+}
+
int main(int argc, const char **argv) {
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
std::error_code OK;
const char *Overview =
- R"(Generates documentation from source code and comments.
+ R"(Generates documentation from source code and comments.
Example usage for files without flags (default):
@@ -182,23 +230,12 @@ Example usage for a project using a compile commands database:
{"index.js", "index_json.js"}};
if (Format == "html") {
- void *MainAddr = (void *)(intptr_t)GetExecutablePath;
- std::string ClangDocPath = GetExecutablePath(argv[0], MainAddr);
- llvm::SmallString<128> NativeClangDocPath;
- llvm::sys::path::native(ClangDocPath, NativeClangDocPath);
- llvm::SmallString<128> AssetsPath;
- AssetsPath = llvm::sys::path::parent_path(NativeClangDocPath);
- llvm::sys::path::append(AssetsPath, "..", "share", "clang");
- llvm::SmallString<128> DefaultStylesheet;
- llvm::sys::path::native(AssetsPath, DefaultStylesheet);
- llvm::sys::path::append(DefaultStylesheet,
- "clang-doc-default-stylesheet.css");
- llvm::SmallString<128> IndexJS;
- llvm::sys::path::native(AssetsPath, IndexJS);
- llvm::sys::path::append(IndexJS, "index.js");
- CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
- std::string(DefaultStylesheet));
- CDCtx.FilesToCopy.emplace_back(IndexJS.str());
+ if (!UserAssetPath.empty() &&
+ llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
+ GetAssetFiles(CDCtx);
+ } else {
+ GetDefaultAssetFiles(argv[0], CDCtx);
+ }
}
// Mapping phase
>From 85581ed2f05974eac5697f43ab95a34ce17742a0 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Fri, 7 Jun 2024 01:54:43 -0400
Subject: [PATCH 02/20] [clang][clang-doc] fixes bug caused by not passing by
reference
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index df53c46b4a76e..b72767d201073 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -137,7 +137,7 @@ std::string GetExecutablePath(const char *Argv0, void *MainAddr) {
return llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
}
-void GetAssetFiles(clang::doc::ClangDocContext CDCtx) {
+void GetAssetFiles(clang::doc::ClangDocContext &CDCtx) {
std::error_code Code;
for (auto DirIt = llvm::sys::fs::directory_iterator(
std::string(UserAssetPath), Code),
@@ -146,16 +146,17 @@ void GetAssetFiles(clang::doc::ClangDocContext CDCtx) {
llvm::SmallString<128> filePath = llvm::SmallString<128>(DirIt->path());
if (llvm::sys::fs::is_regular_file(filePath)) {
if (filePath.ends_with(".css")) {
- CDCtx.UserStylesheets.push_back(std::string(filePath));
+ CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
+ std::string(filePath));
} else if (filePath.ends_with(".js")) {
- CDCtx.FilesToCopy.push_back(std::string(filePath));
+ CDCtx.FilesToCopy.emplace_back(filePath.str());
}
}
}
}
void GetDefaultAssetFiles(const char *Argv0,
- clang::doc::ClangDocContext CDCtx) {
+ clang::doc::ClangDocContext &CDCtx) {
void *MainAddr = (void *)(intptr_t)GetExecutablePath;
std::string ClangDocPath = GetExecutablePath(Argv0, MainAddr);
llvm::SmallString<128> NativeClangDocPath;
>From 6fee7d067d2923d971186b7e505452abaa2b92f0 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Fri, 7 Jun 2024 17:30:19 -0400
Subject: [PATCH 03/20] [clang][clang-doc] address pr comments about --asset
option
---
.../clang-doc/tool/ClangDocMain.cpp | 66 +++++++++++++------
1 file changed, 45 insertions(+), 21 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index b72767d201073..c2439734960d4 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -83,8 +83,8 @@ static llvm::cl::list<std::string> UserStylesheets(
static llvm::cl::opt<std::string>
UserAssetPath("asset",
- llvm::cl::desc("User supplied asset path for html output to "
- "override the default css and js files"),
+ llvm::cl::desc("User supplied asset path to "
+ "override the default css and js files for html output"),
llvm::cl::cat(ClangDocCategory));
static llvm::cl::opt<std::string> SourceRoot("source-root", llvm::cl::desc(R"(
@@ -137,25 +137,27 @@ std::string GetExecutablePath(const char *Argv0, void *MainAddr) {
return llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
}
-void GetAssetFiles(clang::doc::ClangDocContext &CDCtx) {
+llvm::Error GetAssetFiles(clang::doc::ClangDocContext &CDCtx) {
std::error_code Code;
- for (auto DirIt = llvm::sys::fs::directory_iterator(
- std::string(UserAssetPath), Code),
- dir_end = llvm::sys::fs::directory_iterator();
- !Code && DirIt != dir_end; DirIt.increment(Code)) {
- llvm::SmallString<128> filePath = llvm::SmallString<128>(DirIt->path());
- if (llvm::sys::fs::is_regular_file(filePath)) {
- if (filePath.ends_with(".css")) {
+ for (auto DirIt = llvm::sys::fs::directory_iterator(UserAssetPath, Code),
+ DirEnd = llvm::sys::fs::directory_iterator();
+ !Code && DirIt != DirEnd; DirIt.increment(Code)) {
+ llvm::SmallString<128> FilePath = llvm::SmallString<128>(DirIt->path());
+ if (!Code) {
+ return llvm::createFileError(FilePath, Code);
+ }
+ if (llvm::sys::fs::is_regular_file(FilePath)) {
+ if (llvm::sys::path::extension(FilePath) == ".css") {
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
- std::string(filePath));
- } else if (filePath.ends_with(".js")) {
- CDCtx.FilesToCopy.emplace_back(filePath.str());
+ std::string(FilePath));
+ } else if (llvm::sys::path::extension(FilePath) == ".js") {
+ CDCtx.FilesToCopy.emplace_back(FilePath.str());
}
}
}
}
-void GetDefaultAssetFiles(const char *Argv0,
+llvm::Error GetDefaultAssetFiles(const char *Argv0,
clang::doc::ClangDocContext &CDCtx) {
void *MainAddr = (void *)(intptr_t)GetExecutablePath;
std::string ClangDocPath = GetExecutablePath(Argv0, MainAddr);
@@ -172,12 +174,35 @@ void GetDefaultAssetFiles(const char *Argv0,
llvm::SmallString<128> IndexJS;
llvm::sys::path::native(AssetsPath, IndexJS);
llvm::sys::path::append(IndexJS, "index.js");
+
+ if (!llvm::sys::fs::is_regular_file(IndexJS)) {
+ return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "error default index.js file at " + IndexJS + "\n");
+ }
+
+ if (!llvm::sys::fs::is_regular_file(DefaultStylesheet)) {
+ return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "error default clang-doc-default-stylesheet.css file at " + DefaultStylesheet + "\n");
+ }
+
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
std::string(DefaultStylesheet));
CDCtx.FilesToCopy.emplace_back(IndexJS.str());
- llvm::outs() << "No default asset path found using default asset path: "
+ llvm::outs() << "Using default asset: "
<< AssetsPath << "\n";
+
+ return llvm::Error::success();
+}
+
+llvm::Error GetHTMLAssetFiles(const char *Argv0, clang::doc::ClangDocContext &CDCtx) {
+ if (!UserAssetPath.empty() && !llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
+ llvm::outs() << "Asset path supply is not a directory: " << UserAssetPath << " falling back to default\n";
+ }
+ if (llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
+ return GetAssetFiles(CDCtx);
+ }
+ return GetDefaultAssetFiles(Argv0, CDCtx);
}
int main(int argc, const char **argv) {
@@ -231,12 +256,11 @@ Example usage for a project using a compile commands database:
{"index.js", "index_json.js"}};
if (Format == "html") {
- if (!UserAssetPath.empty() &&
- llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
- GetAssetFiles(CDCtx);
- } else {
- GetDefaultAssetFiles(argv[0], CDCtx);
- }
+ auto Err = GetHTMLAssetFiles(argv[0], CDCtx);
+ if (Err) {
+ llvm::errs() << toString(std::move(Err)) << "\n";
+ return 1;
+ }
}
// Mapping phase
>From a8462150b7fa4f80e5a3db5e9c7edac221781f4f Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Fri, 7 Jun 2024 17:52:44 -0400
Subject: [PATCH 04/20] [clang][clang-doc] add a test case
---
.../clang-doc/tool/ClangDocMain.cpp | 55 ++++++++++---------
.../test/clang-doc/single-source-html.cpp | 14 +++++
2 files changed, 44 insertions(+), 25 deletions(-)
create mode 100644 clang-tools-extra/test/clang-doc/single-source-html.cpp
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index c2439734960d4..f64612f085c30 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -81,11 +81,11 @@ static llvm::cl::list<std::string> UserStylesheets(
llvm::cl::desc("CSS stylesheets to extend the default styles."),
llvm::cl::cat(ClangDocCategory));
-static llvm::cl::opt<std::string>
- UserAssetPath("asset",
- llvm::cl::desc("User supplied asset path to "
- "override the default css and js files for html output"),
- llvm::cl::cat(ClangDocCategory));
+static llvm::cl::opt<std::string> UserAssetPath(
+ "asset",
+ llvm::cl::desc("User supplied asset path to "
+ "override the default css and js files for html output"),
+ llvm::cl::cat(ClangDocCategory));
static llvm::cl::opt<std::string> SourceRoot("source-root", llvm::cl::desc(R"(
Directory where processed files are stored.
@@ -144,7 +144,7 @@ llvm::Error GetAssetFiles(clang::doc::ClangDocContext &CDCtx) {
!Code && DirIt != DirEnd; DirIt.increment(Code)) {
llvm::SmallString<128> FilePath = llvm::SmallString<128>(DirIt->path());
if (!Code) {
- return llvm::createFileError(FilePath, Code);
+ return llvm::createFileError(FilePath, Code);
}
if (llvm::sys::fs::is_regular_file(FilePath)) {
if (llvm::sys::path::extension(FilePath) == ".css") {
@@ -158,7 +158,7 @@ llvm::Error GetAssetFiles(clang::doc::ClangDocContext &CDCtx) {
}
llvm::Error GetDefaultAssetFiles(const char *Argv0,
- clang::doc::ClangDocContext &CDCtx) {
+ clang::doc::ClangDocContext &CDCtx) {
void *MainAddr = (void *)(intptr_t)GetExecutablePath;
std::string ClangDocPath = GetExecutablePath(Argv0, MainAddr);
llvm::SmallString<128> NativeClangDocPath;
@@ -177,32 +177,37 @@ llvm::Error GetDefaultAssetFiles(const char *Argv0,
if (!llvm::sys::fs::is_regular_file(IndexJS)) {
return llvm::createStringError(llvm::inconvertibleErrorCode(),
- "error default index.js file at " + IndexJS + "\n");
+ "error default index.js file at " + IndexJS +
+ "\n");
}
if (!llvm::sys::fs::is_regular_file(DefaultStylesheet)) {
- return llvm::createStringError(llvm::inconvertibleErrorCode(),
- "error default clang-doc-default-stylesheet.css file at " + DefaultStylesheet + "\n");
+ return llvm::createStringError(
+ llvm::inconvertibleErrorCode(),
+ "error default clang-doc-default-stylesheet.css file at " +
+ DefaultStylesheet + "\n");
}
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
std::string(DefaultStylesheet));
CDCtx.FilesToCopy.emplace_back(IndexJS.str());
- llvm::outs() << "Using default asset: "
- << AssetsPath << "\n";
+ llvm::outs() << "Using default asset: " << AssetsPath << "\n";
return llvm::Error::success();
}
-llvm::Error GetHTMLAssetFiles(const char *Argv0, clang::doc::ClangDocContext &CDCtx) {
- if (!UserAssetPath.empty() && !llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
- llvm::outs() << "Asset path supply is not a directory: " << UserAssetPath << " falling back to default\n";
- }
- if (llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
- return GetAssetFiles(CDCtx);
- }
- return GetDefaultAssetFiles(Argv0, CDCtx);
+llvm::Error GetHTMLAssetFiles(const char *Argv0,
+ clang::doc::ClangDocContext &CDCtx) {
+ if (!UserAssetPath.empty() &&
+ !llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
+ llvm::outs() << "Asset path supply is not a directory: " << UserAssetPath
+ << " falling back to default\n";
+ }
+ if (llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
+ return GetAssetFiles(CDCtx);
+ }
+ return GetDefaultAssetFiles(Argv0, CDCtx);
}
int main(int argc, const char **argv) {
@@ -256,11 +261,11 @@ Example usage for a project using a compile commands database:
{"index.js", "index_json.js"}};
if (Format == "html") {
- auto Err = GetHTMLAssetFiles(argv[0], CDCtx);
- if (Err) {
- llvm::errs() << toString(std::move(Err)) << "\n";
- return 1;
- }
+ auto Err = GetHTMLAssetFiles(argv[0], CDCtx);
+ if (Err) {
+ llvm::errs() << toString(std::move(Err)) << "\n";
+ return 1;
+ }
}
// Mapping phase
diff --git a/clang-tools-extra/test/clang-doc/single-source-html.cpp b/clang-tools-extra/test/clang-doc/single-source-html.cpp
new file mode 100644
index 0000000000000..9720acbaae989
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/single-source-html.cpp
@@ -0,0 +1,14 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo "" > %t/compile_flags.txt
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp -output=%t/docs > %t/output.txt
+// RUN: cat %t/output.txt | FileCheck %s --check-prefix=CHECK
+
+// CHECK: Emiting docs in html format.
+// CHECK-NEXT: Using default asset: {{.*}}..\share\clang
+// CHECK-NEXT: Mapping decls...
+// CHECK-NEXT: Collecting infos...
+// CHECK-NEXT: Reducing 0 infos...
+// CHECK-NEXT: Generating docs...
+// CHECK-NEXT: Generating assets for docs...
\ No newline at end of file
>From 39e06472bc2348971dd144a1cc2b3717cde29576 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 11 Jun 2024 15:45:15 -0400
Subject: [PATCH 05/20] [clang][clang-doc] PR comments
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 1 +
clang-tools-extra/test/clang-doc/single-source-html.cpp | 8 +-------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index f64612f085c30..7b01b0b84857a 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -155,6 +155,7 @@ llvm::Error GetAssetFiles(clang::doc::ClangDocContext &CDCtx) {
}
}
}
+ return llvm::Error::success();
}
llvm::Error GetDefaultAssetFiles(const char *Argv0,
diff --git a/clang-tools-extra/test/clang-doc/single-source-html.cpp b/clang-tools-extra/test/clang-doc/single-source-html.cpp
index 9720acbaae989..4f62c45f545fa 100644
--- a/clang-tools-extra/test/clang-doc/single-source-html.cpp
+++ b/clang-tools-extra/test/clang-doc/single-source-html.cpp
@@ -5,10 +5,4 @@
// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp -output=%t/docs > %t/output.txt
// RUN: cat %t/output.txt | FileCheck %s --check-prefix=CHECK
-// CHECK: Emiting docs in html format.
-// CHECK-NEXT: Using default asset: {{.*}}..\share\clang
-// CHECK-NEXT: Mapping decls...
-// CHECK-NEXT: Collecting infos...
-// CHECK-NEXT: Reducing 0 infos...
-// CHECK-NEXT: Generating docs...
-// CHECK-NEXT: Generating assets for docs...
\ No newline at end of file
+// CHECK: Using default asset: {{.*}}..\share\clang
\ No newline at end of file
>From 94b297955aca884a39b3cfc29d6e06c53155ee15 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 11 Jun 2024 16:39:04 -0400
Subject: [PATCH 06/20] [clang][clang-doc] fix asset option
---
.../clang-doc/tool/ClangDocMain.cpp | 33 ++++++++++---------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 7b01b0b84857a..fb3eb51e09a24 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -133,19 +133,17 @@ std::string getFormatString() {
// GetMainExecutable (since some platforms don't support taking the
// address of main, and some platforms can't implement GetMainExecutable
// without being given the address of a function in the main executable).
-std::string GetExecutablePath(const char *Argv0, void *MainAddr) {
+std::string getExecutablePath(const char *Argv0, void *MainAddr) {
return llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
}
-llvm::Error GetAssetFiles(clang::doc::ClangDocContext &CDCtx) {
+llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
std::error_code Code;
+ llvm::SmallString<128> FilePath = llvm::SmallString<128>(UserAssetPath);
for (auto DirIt = llvm::sys::fs::directory_iterator(UserAssetPath, Code),
DirEnd = llvm::sys::fs::directory_iterator();
!Code && DirIt != DirEnd; DirIt.increment(Code)) {
- llvm::SmallString<128> FilePath = llvm::SmallString<128>(DirIt->path());
- if (!Code) {
- return llvm::createFileError(FilePath, Code);
- }
+ FilePath = llvm::SmallString<128>(DirIt->path());
if (llvm::sys::fs::is_regular_file(FilePath)) {
if (llvm::sys::path::extension(FilePath) == ".css") {
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
@@ -155,13 +153,16 @@ llvm::Error GetAssetFiles(clang::doc::ClangDocContext &CDCtx) {
}
}
}
+ if (Code) {
+ return llvm::createFileError(FilePath, Code);
+ }
return llvm::Error::success();
}
-llvm::Error GetDefaultAssetFiles(const char *Argv0,
+llvm::Error getDefaultAssetFiles(const char *Argv0,
clang::doc::ClangDocContext &CDCtx) {
- void *MainAddr = (void *)(intptr_t)GetExecutablePath;
- std::string ClangDocPath = GetExecutablePath(Argv0, MainAddr);
+ void *MainAddr = (void *)(intptr_t)getExecutablePath;
+ std::string ClangDocPath = getExecutablePath(Argv0, MainAddr);
llvm::SmallString<128> NativeClangDocPath;
llvm::sys::path::native(ClangDocPath, NativeClangDocPath);
@@ -178,14 +179,14 @@ llvm::Error GetDefaultAssetFiles(const char *Argv0,
if (!llvm::sys::fs::is_regular_file(IndexJS)) {
return llvm::createStringError(llvm::inconvertibleErrorCode(),
- "error default index.js file at " + IndexJS +
- "\n");
+ "error default index.js file missing at " +
+ IndexJS + "\n");
}
if (!llvm::sys::fs::is_regular_file(DefaultStylesheet)) {
return llvm::createStringError(
llvm::inconvertibleErrorCode(),
- "error default clang-doc-default-stylesheet.css file at " +
+ "error default clang-doc-default-stylesheet.css file missing at " +
DefaultStylesheet + "\n");
}
@@ -198,7 +199,7 @@ llvm::Error GetDefaultAssetFiles(const char *Argv0,
return llvm::Error::success();
}
-llvm::Error GetHTMLAssetFiles(const char *Argv0,
+llvm::Error getHtmlAssetFiles(const char *Argv0,
clang::doc::ClangDocContext &CDCtx) {
if (!UserAssetPath.empty() &&
!llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
@@ -206,9 +207,9 @@ llvm::Error GetHTMLAssetFiles(const char *Argv0,
<< " falling back to default\n";
}
if (llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
- return GetAssetFiles(CDCtx);
+ return getAssetFiles(CDCtx);
}
- return GetDefaultAssetFiles(Argv0, CDCtx);
+ return getDefaultAssetFiles(Argv0, CDCtx);
}
int main(int argc, const char **argv) {
@@ -262,7 +263,7 @@ Example usage for a project using a compile commands database:
{"index.js", "index_json.js"}};
if (Format == "html") {
- auto Err = GetHTMLAssetFiles(argv[0], CDCtx);
+ auto Err = getHtmlAssetFiles(argv[0], CDCtx);
if (Err) {
llvm::errs() << toString(std::move(Err)) << "\n";
return 1;
>From f24609845dd4b28431114db52c01b08bd64d77f8 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 11 Jun 2024 16:53:23 -0400
Subject: [PATCH 07/20] [clang][clang-doc] address PR comments
---
.../clang-doc/tool/ClangDocMain.cpp | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index fb3eb51e09a24..141f5ff80ea87 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -153,9 +153,8 @@ llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
}
}
}
- if (Code) {
+ if (Code)
return llvm::createFileError(FilePath, Code);
- }
return llvm::Error::success();
}
@@ -177,18 +176,16 @@ llvm::Error getDefaultAssetFiles(const char *Argv0,
llvm::sys::path::native(AssetsPath, IndexJS);
llvm::sys::path::append(IndexJS, "index.js");
- if (!llvm::sys::fs::is_regular_file(IndexJS)) {
+ if (!llvm::sys::fs::is_regular_file(IndexJS))
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"error default index.js file missing at " +
IndexJS + "\n");
- }
- if (!llvm::sys::fs::is_regular_file(DefaultStylesheet)) {
+ if (!llvm::sys::fs::is_regular_file(DefaultStylesheet))
return llvm::createStringError(
llvm::inconvertibleErrorCode(),
"error default clang-doc-default-stylesheet.css file missing at " +
DefaultStylesheet + "\n");
- }
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
std::string(DefaultStylesheet));
@@ -202,13 +199,11 @@ llvm::Error getDefaultAssetFiles(const char *Argv0,
llvm::Error getHtmlAssetFiles(const char *Argv0,
clang::doc::ClangDocContext &CDCtx) {
if (!UserAssetPath.empty() &&
- !llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
+ !llvm::sys::fs::is_directory(std::string(UserAssetPath)))
llvm::outs() << "Asset path supply is not a directory: " << UserAssetPath
<< " falling back to default\n";
- }
- if (llvm::sys::fs::is_directory(std::string(UserAssetPath))) {
+ if (llvm::sys::fs::is_directory(std::string(UserAssetPath)))
return getAssetFiles(CDCtx);
- }
return getDefaultAssetFiles(Argv0, CDCtx);
}
@@ -263,8 +258,7 @@ Example usage for a project using a compile commands database:
{"index.js", "index_json.js"}};
if (Format == "html") {
- auto Err = getHtmlAssetFiles(argv[0], CDCtx);
- if (Err) {
+ if (auto Err = getHtmlAssetFiles(argv[0], CDCtx)) {
llvm::errs() << toString(std::move(Err)) << "\n";
return 1;
}
>From 27bfe8da81c34acd8563849ee57dfcea82a8dbd7 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 11 Jun 2024 16:55:52 -0400
Subject: [PATCH 08/20] [clang][clang-doc] address PR comments
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 141f5ff80ea87..ca881b5b35ca0 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -145,12 +145,11 @@ llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
!Code && DirIt != DirEnd; DirIt.increment(Code)) {
FilePath = llvm::SmallString<128>(DirIt->path());
if (llvm::sys::fs::is_regular_file(FilePath)) {
- if (llvm::sys::path::extension(FilePath) == ".css") {
+ if (llvm::sys::path::extension(FilePath) == ".css")
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
std::string(FilePath));
- } else if (llvm::sys::path::extension(FilePath) == ".js") {
+ else if (llvm::sys::path::extension(FilePath) == ".js")
CDCtx.FilesToCopy.emplace_back(FilePath.str());
- }
}
}
if (Code)
>From bacf3d8f62cefc314718f804c49b0e8ff5fb1548 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Fri, 14 Jun 2024 17:33:52 -0400
Subject: [PATCH 09/20] [clang][clang-doc] address pr comments
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index ca881b5b35ca0..5218c4f745071 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -49,6 +49,8 @@
using namespace clang::ast_matchers;
using namespace clang::tooling;
using namespace clang;
+using DirIterator = llvm::sys::fs::directory_iterator;
+
static llvm::cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
static llvm::cl::OptionCategory ClangDocCategory("clang-doc options");
@@ -139,11 +141,11 @@ std::string getExecutablePath(const char *Argv0, void *MainAddr) {
llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
std::error_code Code;
- llvm::SmallString<128> FilePath = llvm::SmallString<128>(UserAssetPath);
- for (auto DirIt = llvm::sys::fs::directory_iterator(UserAssetPath, Code),
- DirEnd = llvm::sys::fs::directory_iterator();
+ llvm::SmallString<128> FilePath(UserAssetPath);
+ for (DirIterator DirIt = DirIterator(UserAssetPath, Code),
+ DirEnd = DirIterator();
!Code && DirIt != DirEnd; DirIt.increment(Code)) {
- FilePath = llvm::SmallString<128>(DirIt->path());
+ FilePath = DirIt->path();
if (llvm::sys::fs::is_regular_file(FilePath)) {
if (llvm::sys::path::extension(FilePath) == ".css")
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
>From 17024cc36de32c9727b4e0c74c70b641dbcb62b5 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 18 Jun 2024 15:03:14 -0400
Subject: [PATCH 10/20] [clang][clang-doc] address pr comments
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 10 +++++-----
.../test/clang-doc/single-source-html.cpp | 3 +--
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 5218c4f745071..ecd3dd7d9d1fc 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -49,7 +49,6 @@
using namespace clang::ast_matchers;
using namespace clang::tooling;
using namespace clang;
-using DirIterator = llvm::sys::fs::directory_iterator;
static llvm::cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
@@ -140,12 +139,13 @@ std::string getExecutablePath(const char *Argv0, void *MainAddr) {
}
llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
+ using DirIt = llvm::sys::fs::directory_iterator;
std::error_code Code;
llvm::SmallString<128> FilePath(UserAssetPath);
- for (DirIterator DirIt = DirIterator(UserAssetPath, Code),
- DirEnd = DirIterator();
- !Code && DirIt != DirEnd; DirIt.increment(Code)) {
- FilePath = DirIt->path();
+ for (DirIt DirStart = DirIt(UserAssetPath, Code),
+ DirEnd;
+ !Code && DirStart != DirEnd; DirStart.increment(Code)) {
+ FilePath = DirStart->path();
if (llvm::sys::fs::is_regular_file(FilePath)) {
if (llvm::sys::path::extension(FilePath) == ".css")
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
diff --git a/clang-tools-extra/test/clang-doc/single-source-html.cpp b/clang-tools-extra/test/clang-doc/single-source-html.cpp
index 4f62c45f545fa..ef90e55ed7d10 100644
--- a/clang-tools-extra/test/clang-doc/single-source-html.cpp
+++ b/clang-tools-extra/test/clang-doc/single-source-html.cpp
@@ -2,7 +2,6 @@
// RUN: mkdir %t
// RUN: echo "" > %t/compile_flags.txt
// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp -output=%t/docs > %t/output.txt
-// RUN: cat %t/output.txt | FileCheck %s --check-prefix=CHECK
+// RUN: clang-doc --format=html --executor=standalone %s -output=%t/docs | FileCheck %s
// CHECK: Using default asset: {{.*}}..\share\clang
\ No newline at end of file
>From 2910383a3a0fabd36f01e62e4c14f29ff58efffa Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 18 Jun 2024 16:10:26 -0400
Subject: [PATCH 11/20] [clang][clang-doc] remove unnecessary commands
---
clang-tools-extra/test/clang-doc/single-source-html.cpp | 5 -----
1 file changed, 5 deletions(-)
diff --git a/clang-tools-extra/test/clang-doc/single-source-html.cpp b/clang-tools-extra/test/clang-doc/single-source-html.cpp
index ef90e55ed7d10..a2bf8aa7f16c5 100644
--- a/clang-tools-extra/test/clang-doc/single-source-html.cpp
+++ b/clang-tools-extra/test/clang-doc/single-source-html.cpp
@@ -1,7 +1,2 @@
-// RUN: rm -rf %t
-// RUN: mkdir %t
-// RUN: echo "" > %t/compile_flags.txt
-// RUN: cp "%s" "%t/test.cpp"
// RUN: clang-doc --format=html --executor=standalone %s -output=%t/docs | FileCheck %s
-
// CHECK: Using default asset: {{.*}}..\share\clang
\ No newline at end of file
>From def242aa832c5a8ef8b7fe49c2f0818bb79efa98 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 18 Jun 2024 16:22:12 -0400
Subject: [PATCH 12/20] [clang][clang-doc] rename err
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index ecd3dd7d9d1fc..3e6e74d416792 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -140,11 +140,11 @@ std::string getExecutablePath(const char *Argv0, void *MainAddr) {
llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
using DirIt = llvm::sys::fs::directory_iterator;
- std::error_code Code;
+ std::error_code Err;
llvm::SmallString<128> FilePath(UserAssetPath);
- for (DirIt DirStart = DirIt(UserAssetPath, Code),
+ for (DirIt DirStart = DirIt(UserAssetPath, Err),
DirEnd;
- !Code && DirStart != DirEnd; DirStart.increment(Code)) {
+ !Err && DirStart != DirEnd; DirStart.increment(Err)) {
FilePath = DirStart->path();
if (llvm::sys::fs::is_regular_file(FilePath)) {
if (llvm::sys::path::extension(FilePath) == ".css")
@@ -154,8 +154,8 @@ llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
CDCtx.FilesToCopy.emplace_back(FilePath.str());
}
}
- if (Code)
- return llvm::createFileError(FilePath, Code);
+ if (Err)
+ return llvm::createFileError(FilePath, Err);
return llvm::Error::success();
}
>From 41bd20411e4913063adf5fb4d638e6c54e10d619 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 18 Jun 2024 16:22:59 -0400
Subject: [PATCH 13/20] [clang][clang-doc] rename err
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 3e6e74d416792..27f52b836ecdf 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -140,11 +140,11 @@ std::string getExecutablePath(const char *Argv0, void *MainAddr) {
llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
using DirIt = llvm::sys::fs::directory_iterator;
- std::error_code Err;
+ std::error_code FileErr;
llvm::SmallString<128> FilePath(UserAssetPath);
- for (DirIt DirStart = DirIt(UserAssetPath, Err),
+ for (DirIt DirStart = DirIt(UserAssetPath, FileErr),
DirEnd;
- !Err && DirStart != DirEnd; DirStart.increment(Err)) {
+ !FileErr && DirStart != DirEnd; DirStart.increment(FileErr)) {
FilePath = DirStart->path();
if (llvm::sys::fs::is_regular_file(FilePath)) {
if (llvm::sys::path::extension(FilePath) == ".css")
@@ -154,8 +154,8 @@ llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
CDCtx.FilesToCopy.emplace_back(FilePath.str());
}
}
- if (Err)
- return llvm::createFileError(FilePath, Err);
+ if (FileErr)
+ return llvm::createFileError(FilePath, FileErr);
return llvm::Error::success();
}
>From 2362931becb3ec0275cc9573a6d83f16e5430422 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 18 Jun 2024 16:26:08 -0400
Subject: [PATCH 14/20] [clang][clang-doc] formatting
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 27f52b836ecdf..d7f232adaba2b 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -50,7 +50,6 @@ using namespace clang::ast_matchers;
using namespace clang::tooling;
using namespace clang;
-
static llvm::cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
static llvm::cl::OptionCategory ClangDocCategory("clang-doc options");
>From 3bded9ed36fe570dcb645cb5a07fbef8a60fa1d6 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 18 Jun 2024 17:20:41 -0400
Subject: [PATCH 15/20] [clang][clang-doc] remove asset error for not
generating asset
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index d7f232adaba2b..9d8068bb3a02b 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -362,8 +362,7 @@ Example usage for a project using a compile commands database:
llvm::outs() << "Generating assets for docs...\n";
Err = G->get()->createResources(CDCtx);
if (Err) {
- llvm::errs() << toString(std::move(Err)) << "\n";
- return 1;
+ llvm::outs() << "warning: " << toString(std::move(Err)) << "\n";
}
return 0;
>From 060c1a3c8e6e8db1e31a0cb517bd4dc098680b83 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 18 Jun 2024 18:24:00 -0400
Subject: [PATCH 16/20] [clang][clang-doc] turn warning into to string
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 9d8068bb3a02b..8b95eabd41f7f 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -178,13 +178,13 @@ llvm::Error getDefaultAssetFiles(const char *Argv0,
if (!llvm::sys::fs::is_regular_file(IndexJS))
return llvm::createStringError(llvm::inconvertibleErrorCode(),
- "error default index.js file missing at " +
+ "default index.js file missing at " +
IndexJS + "\n");
if (!llvm::sys::fs::is_regular_file(DefaultStylesheet))
return llvm::createStringError(
llvm::inconvertibleErrorCode(),
- "error default clang-doc-default-stylesheet.css file missing at " +
+ "default clang-doc-default-stylesheet.css file missing at " +
DefaultStylesheet + "\n");
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
@@ -259,8 +259,7 @@ Example usage for a project using a compile commands database:
if (Format == "html") {
if (auto Err = getHtmlAssetFiles(argv[0], CDCtx)) {
- llvm::errs() << toString(std::move(Err)) << "\n";
- return 1;
+ llvm::outs() << "warning: " << toString(std::move(Err)) << "\n";
}
}
>From 830e1a32fd06d9dfa217f475e234b24ed084c732 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Tue, 18 Jun 2024 19:36:32 -0400
Subject: [PATCH 17/20] [clang][clang-doc] shift messaging
---
clang-tools-extra/clang-doc/tool/ClangDocMain.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index 8b95eabd41f7f..5a43c70a5ebc3 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -176,6 +176,8 @@ llvm::Error getDefaultAssetFiles(const char *Argv0,
llvm::sys::path::native(AssetsPath, IndexJS);
llvm::sys::path::append(IndexJS, "index.js");
+ llvm::outs() << "Using default asset: " << AssetsPath << "\n";
+
if (!llvm::sys::fs::is_regular_file(IndexJS))
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"default index.js file missing at " +
@@ -191,8 +193,6 @@ llvm::Error getDefaultAssetFiles(const char *Argv0,
std::string(DefaultStylesheet));
CDCtx.FilesToCopy.emplace_back(IndexJS.str());
- llvm::outs() << "Using default asset: " << AssetsPath << "\n";
-
return llvm::Error::success();
}
>From 0a02116077caabc8fd5708d7eb238a538cac1538 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Wed, 19 Jun 2024 11:54:20 -0400
Subject: [PATCH 18/20] [clang][clang-doc] accomadate for shared asset
---
clang-tools-extra/test/clang-doc/single-source-html.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang-tools-extra/test/clang-doc/single-source-html.cpp b/clang-tools-extra/test/clang-doc/single-source-html.cpp
index a2bf8aa7f16c5..d8e678c1e744b 100644
--- a/clang-tools-extra/test/clang-doc/single-source-html.cpp
+++ b/clang-tools-extra/test/clang-doc/single-source-html.cpp
@@ -1,2 +1,2 @@
// RUN: clang-doc --format=html --executor=standalone %s -output=%t/docs | FileCheck %s
-// CHECK: Using default asset: {{.*}}..\share\clang
\ No newline at end of file
+// CHECK: Using default asset: {{.*}}{{[\\/]}}share{{[\\/]}}clang
\ No newline at end of file
>From bf76d45a940fb9feab909e9051fa64ba9384c191 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Wed, 19 Jun 2024 17:23:01 -0400
Subject: [PATCH 19/20] [clang][clang-doc] use path seperators
---
clang-tools-extra/test/clang-doc/single-source-html.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang-tools-extra/test/clang-doc/single-source-html.cpp b/clang-tools-extra/test/clang-doc/single-source-html.cpp
index d8e678c1e744b..79928cce0730c 100644
--- a/clang-tools-extra/test/clang-doc/single-source-html.cpp
+++ b/clang-tools-extra/test/clang-doc/single-source-html.cpp
@@ -1,2 +1,2 @@
// RUN: clang-doc --format=html --executor=standalone %s -output=%t/docs | FileCheck %s
-// CHECK: Using default asset: {{.*}}{{[\\/]}}share{{[\\/]}}clang
\ No newline at end of file
+// CHECK: Using default asset: {{.*}}%{pathsep}share%{pathsep}clang
\ No newline at end of file
>From a9c8465321695030a3ee38c572848ce3aa4fe649 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Thu, 20 Jun 2024 03:20:08 -0400
Subject: [PATCH 20/20] [clang][clang-doc] re add path seperator
---
clang-tools-extra/test/clang-doc/single-source-html.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang-tools-extra/test/clang-doc/single-source-html.cpp b/clang-tools-extra/test/clang-doc/single-source-html.cpp
index 79928cce0730c..32f232b9c45a0 100644
--- a/clang-tools-extra/test/clang-doc/single-source-html.cpp
+++ b/clang-tools-extra/test/clang-doc/single-source-html.cpp
@@ -1,2 +1,2 @@
// RUN: clang-doc --format=html --executor=standalone %s -output=%t/docs | FileCheck %s
-// CHECK: Using default asset: {{.*}}%{pathsep}share%{pathsep}clang
\ No newline at end of file
+// CHECK: Using default asset: {{.*}}{{[\/]}}share{{[\/]}}clang
\ No newline at end of file
More information about the cfe-commits
mailing list