[clang-tools-extra] [clang-doc] switched from using relative to absolute paths (PR #93281)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 24 15:48:33 PDT 2024
https://github.com/PeterChou1 updated https://github.com/llvm/llvm-project/pull/93281
>From f3eec972f66576fdacc578eaea3f158efdf57128 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Fri, 24 May 2024 04:28:08 -0400
Subject: [PATCH 01/10] clang-doc switched from using relative to absolute
paths
---
clang-tools-extra/clang-doc/assets/index.js | 72 ++++++++++-----------
1 file changed, 35 insertions(+), 37 deletions(-)
diff --git a/clang-tools-extra/clang-doc/assets/index.js b/clang-tools-extra/clang-doc/assets/index.js
index 49818763a4393..c1d32d353ea36 100644
--- a/clang-tools-extra/clang-doc/assets/index.js
+++ b/clang-tools-extra/clang-doc/assets/index.js
@@ -1,48 +1,46 @@
-// Append using posix-style a file name or directory to Base
-function append(Base, New) {
- if (!New)
- return Base;
- if (Base)
- Base += "/";
- Base += New;
- return Base;
-}
-
-// Get relative path to access FilePath from CurrentDirectory
-function computeRelativePath(FilePath, CurrentDirectory) {
- var Path = FilePath;
- while (Path) {
- if (CurrentDirectory == Path)
- return FilePath.substring(Path.length + 1);
- Path = Path.substring(0, Path.lastIndexOf("/"));
- }
-
- var Dir = CurrentDirectory;
- var Result = "";
- while (Dir) {
- if (Dir == FilePath)
- break;
- Dir = Dir.substring(0, Dir.lastIndexOf("/"));
- Result = append(Result, "..")
+function genLink(Ref) {
+ var Path = `${window.location.protocol}//${window.location.host}/${Ref.Path}`;
+ if (Ref.RefType !== "namespace") {
+ if (Ref.Path === "") {
+ Path = `${Path}${Ref.Name}.html`;
+ }
+ else {
+ Path = `${Path}/${Ref.Name}.html`;
+ }
}
- Result = append(Result, FilePath.substring(Dir.length))
- return Result;
-}
-
-function genLink(Ref, CurrentDirectory) {
- var Path = computeRelativePath(Ref.Path, CurrentDirectory);
- if (Ref.RefType == "namespace")
- Path = append(Path, "index.html");
- else
- Path = append(Path, Ref.Name + ".html")
- ANode = document.createElement("a");
+ ANode = document.createElement("a");
ANode.setAttribute("href", Path);
var TextNode = document.createTextNode(Ref.Name);
ANode.appendChild(TextNode);
return ANode;
}
+function genHTMLOfIndex(Index, CurrentDirectory, IsOutermostList) {
+ // Out will store the HTML elements that Index requires to be generated
+ var Out = [];
+ if (Index.Name) {
+ var SpanNode = document.createElement("span");
+ var TextNode = document.createTextNode(Index.Name);
+ SpanNode.appendChild(genLink(Index));
+ Out.push(SpanNode);
+ }
+ if (Index.Children.length == 0)
+ return Out;
+ // Only the outermost list should use ol, the others should use ul
+ var ListNodeName = IsOutermostList ? "ol" : "ul";
+ var ListNode = document.createElement(ListNodeName);
+ for (Child of Index.Children) {
+ var LiNode = document.createElement("li");
+ ChildNodes = genHTMLOfIndex(Child, CurrentDirectory, false);
+ for (Node of ChildNodes)
+ LiNode.appendChild(Node);
+ ListNode.appendChild(LiNode);
+ }
+ Out.push(ListNode);
+ return Out;
+}
+
function genHTMLOfIndex(Index, CurrentDirectory, IsOutermostList) {
// Out will store the HTML elements that Index requires to be generated
var Out = [];
>From 4d4197fb0ffc83bfe582fbb212ce3dbdf2cdced0 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Fri, 24 May 2024 05:10:03 -0400
Subject: [PATCH 02/10] remove duplicate function
---
clang-tools-extra/clang-doc/assets/index.js | 24 ---------------------
1 file changed, 24 deletions(-)
diff --git a/clang-tools-extra/clang-doc/assets/index.js b/clang-tools-extra/clang-doc/assets/index.js
index c1d32d353ea36..afc89c7c29ad8 100644
--- a/clang-tools-extra/clang-doc/assets/index.js
+++ b/clang-tools-extra/clang-doc/assets/index.js
@@ -16,30 +16,6 @@ function genLink(Ref) {
return ANode;
}
-function genHTMLOfIndex(Index, CurrentDirectory, IsOutermostList) {
- // Out will store the HTML elements that Index requires to be generated
- var Out = [];
- if (Index.Name) {
- var SpanNode = document.createElement("span");
- var TextNode = document.createTextNode(Index.Name);
- SpanNode.appendChild(genLink(Index));
- Out.push(SpanNode);
- }
- if (Index.Children.length == 0)
- return Out;
- // Only the outermost list should use ol, the others should use ul
- var ListNodeName = IsOutermostList ? "ol" : "ul";
- var ListNode = document.createElement(ListNodeName);
- for (Child of Index.Children) {
- var LiNode = document.createElement("li");
- ChildNodes = genHTMLOfIndex(Child, CurrentDirectory, false);
- for (Node of ChildNodes)
- LiNode.appendChild(Node);
- ListNode.appendChild(LiNode);
- }
- Out.push(ListNode);
- return Out;
-}
function genHTMLOfIndex(Index, CurrentDirectory, IsOutermostList) {
// Out will store the HTML elements that Index requires to be generated
>From 61e9da04203f12515c23803c467b56a8dd5c9189 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Sat, 29 Jun 2024 05:16:41 -0400
Subject: [PATCH 03/10] [clang-doc] modify paths for anchors in js file
---
clang-tools-extra/clang-doc/HTMLGenerator.cpp | 12 ++++++++++++
clang-tools-extra/clang-doc/assets/index.js | 12 +++++++++---
clang-tools-extra/test/clang-doc/basic-project.test | 3 ++-
3 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index f6b5e8926f903..0b2fe8a12dc91 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -16,6 +16,7 @@
#include "llvm/Support/JSON.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
#include <optional>
#include <string>
@@ -979,6 +980,17 @@ static llvm::Error serializeIndex(ClangDocContext &CDCtx) {
"error creating index file: " +
FileErr.message());
}
+ llvm::SmallString<128> RootPath(CDCtx.OutDirectory);
+ if (llvm::sys::path::is_relative(RootPath)) {
+ llvm::sys::fs::make_absolute(RootPath);
+ }
+ // replace escape character with forward slash it shouldn't matter
+ // when viewing from the browser this helps with preventing javascript
+ // from escaping unwanted characters leading to bad paths
+ std::string RootPathEscaped = RootPath.str().str();
+ std::replace(RootPathEscaped.begin(), RootPathEscaped.end(), '\\', '/');
+ OS << "var RootPath = \"" << RootPathEscaped << "\";\n";
+
CDCtx.Idx.sort();
llvm::json::OStream J(OS, 2);
std::function<void(Index)> IndexToJSON = [&](const Index &I) {
diff --git a/clang-tools-extra/clang-doc/assets/index.js b/clang-tools-extra/clang-doc/assets/index.js
index afc89c7c29ad8..3f449479b0833 100644
--- a/clang-tools-extra/clang-doc/assets/index.js
+++ b/clang-tools-extra/clang-doc/assets/index.js
@@ -1,12 +1,19 @@
function genLink(Ref) {
var Path = `${window.location.protocol}//${window.location.host}/${Ref.Path}`;
+ var isFileProtocol = window.location.protocol.startsWith("file");
+ // we treat the file paths different depending on if we're
+ // serving via a http server or viewing from a local
+ if (isFileProtocol) {
+ Path = `${window.location.protocol}//${RootPath}/${Ref.Path}`;
+ }
if (Ref.RefType !== "namespace") {
if (Ref.Path === "") {
Path = `${Path}${Ref.Name}.html`;
- }
- else {
+ } else {
Path = `${Path}/${Ref.Name}.html`;
}
+ } else {
+ Path = `${Path}/index.html`
}
ANode = document.createElement("a");
@@ -16,7 +23,6 @@ function genLink(Ref) {
return ANode;
}
-
function genHTMLOfIndex(Index, CurrentDirectory, IsOutermostList) {
// Out will store the HTML elements that Index requires to be generated
var Out = [];
diff --git a/clang-tools-extra/test/clang-doc/basic-project.test b/clang-tools-extra/test/clang-doc/basic-project.test
index 51d3ac6ce6dcd..80fe2b9b28df3 100644
--- a/clang-tools-extra/test/clang-doc/basic-project.test
+++ b/clang-tools-extra/test/clang-doc/basic-project.test
@@ -7,7 +7,8 @@
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefix=HTML-RECTANGLE
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Circle.html -check-prefix=HTML-CIRCLE
-// JSON-INDEX: async function LoadIndex() {
+// JSON-INDEX: var RootPath = "{{.*}}";
+// JSON-INDEX-NEXT: async function LoadIndex() {
// JSON-INDEX-NEXT: return{
// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
// JSON-INDEX-NEXT: "Name": "",
>From fd3ff81d36894088f71dfd20b51a6e984f7bb007 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Sun, 30 Jun 2024 02:56:43 -0400
Subject: [PATCH 04/10] [clang-doc] add test for asset paths
---
clang-tools-extra/clang-doc/HTMLGenerator.cpp | 7 ++++---
clang-tools-extra/clang-doc/assets/index.js | 19 +++++++------------
.../test/clang-doc/test-path-abs.cpp | 7 +++++++
.../test/clang-doc/test-path-relative.cpp | 8 ++++++++
4 files changed, 26 insertions(+), 15 deletions(-)
create mode 100644 clang-tools-extra/test/clang-doc/test-path-abs.cpp
create mode 100644 clang-tools-extra/test/clang-doc/test-path-relative.cpp
diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index 0b2fe8a12dc91..aef22453035c3 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -984,9 +984,10 @@ static llvm::Error serializeIndex(ClangDocContext &CDCtx) {
if (llvm::sys::path::is_relative(RootPath)) {
llvm::sys::fs::make_absolute(RootPath);
}
- // replace escape character with forward slash it shouldn't matter
- // when viewing from the browser this helps with preventing javascript
- // from escaping unwanted characters leading to bad paths
+ // Replace the escaped characters with a forward slash. It shouldn't matter
+ // when rendering the webpage in a web browser. This helps to prevent the
+ // JavaScript from escaping characters incorrectly, and introducing bad paths
+ // in the URLs.
std::string RootPathEscaped = RootPath.str().str();
std::replace(RootPathEscaped.begin(), RootPathEscaped.end(), '\\', '/');
OS << "var RootPath = \"" << RootPathEscaped << "\";\n";
diff --git a/clang-tools-extra/clang-doc/assets/index.js b/clang-tools-extra/clang-doc/assets/index.js
index 3f449479b0833..6a223de66f84a 100644
--- a/clang-tools-extra/clang-doc/assets/index.js
+++ b/clang-tools-extra/clang-doc/assets/index.js
@@ -1,21 +1,16 @@
function genLink(Ref) {
- var Path = `${window.location.protocol}//${window.location.host}/${Ref.Path}`;
- var isFileProtocol = window.location.protocol.startsWith("file");
// we treat the file paths different depending on if we're
// serving via a http server or viewing from a local
- if (isFileProtocol) {
- Path = `${window.location.protocol}//${RootPath}/${Ref.Path}`;
- }
- if (Ref.RefType !== "namespace") {
- if (Ref.Path === "") {
+ var Path = window.location.protocol.startsWith("file") ?
+ `${window.location.protocol}//${window.location.host}/${Ref.Path}` :
+ `${window.location.protocol}//${RootPath}/${Ref.Path}`;
+ if (Ref.RefType === "namespace") {
+ Path = `${Path}/index.html`
+ } else if (Ref.Path === "") {
Path = `${Path}${Ref.Name}.html`;
- } else {
- Path = `${Path}/${Ref.Name}.html`;
- }
} else {
- Path = `${Path}/index.html`
+ Path = `${Path}/${Ref.Name}.html`;
}
-
ANode = document.createElement("a");
ANode.setAttribute("href", Path);
var TextNode = document.createTextNode(Ref.Name);
diff --git a/clang-tools-extra/test/clang-doc/test-path-abs.cpp b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
new file mode 100644
index 0000000000000..d7320cb024b39
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo "CHECK: var RootPath = \"%t\";" > %t/check.txt
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: clang-doc --doxygen --executor=standalone -p %t %t/test.cpp -output=%t/docs
+// RUN: FileCheck %t/check.txt -input-file=%t/docs/index_json.js
+// RUN: rm -rf %t
\ No newline at end of file
diff --git a/clang-tools-extra/test/clang-doc/test-path-relative.cpp b/clang-tools-extra/test/clang-doc/test-path-relative.cpp
new file mode 100644
index 0000000000000..c62c0078a071d
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/test-path-relative.cpp
@@ -0,0 +1,8 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: clang-doc --doxygen --executor=standalone -p %t %t/test.cpp -output=../docs
+// RUN: FileCheck %s -input-file=%t/docs/index_json.js
+// RUN: rm -rf %t
+
+// CHECK: var RootPath = "{{.*}}../docs";
\ No newline at end of file
>From f7863964e01f79006c37a49c87061620ab0d787f Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Sun, 30 Jun 2024 03:16:20 -0400
Subject: [PATCH 05/10] [clang-doc] fix tests
---
clang-tools-extra/test/clang-doc/test-path-abs.cpp | 2 +-
clang-tools-extra/test/clang-doc/test-path-relative.cpp | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/clang-tools-extra/test/clang-doc/test-path-abs.cpp b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
index d7320cb024b39..cf84e241be83f 100644
--- a/clang-tools-extra/test/clang-doc/test-path-abs.cpp
+++ b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
@@ -2,6 +2,6 @@
// RUN: mkdir %t
// RUN: echo "CHECK: var RootPath = \"%t\";" > %t/check.txt
// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-doc --doxygen --executor=standalone -p %t %t/test.cpp -output=%t/docs
+// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp -output=%t/docs
// RUN: FileCheck %t/check.txt -input-file=%t/docs/index_json.js
// RUN: rm -rf %t
\ No newline at end of file
diff --git a/clang-tools-extra/test/clang-doc/test-path-relative.cpp b/clang-tools-extra/test/clang-doc/test-path-relative.cpp
index c62c0078a071d..c6d8769f238f6 100644
--- a/clang-tools-extra/test/clang-doc/test-path-relative.cpp
+++ b/clang-tools-extra/test/clang-doc/test-path-relative.cpp
@@ -1,8 +1,7 @@
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-doc --doxygen --executor=standalone -p %t %t/test.cpp -output=../docs
-// RUN: FileCheck %s -input-file=%t/docs/index_json.js
-// RUN: rm -rf %t
-
-// CHECK: var RootPath = "{{.*}}../docs";
\ No newline at end of file
+// RUN: echo "CHECK: var RootPath = \"%t/../docs\";" > %t/check.txt
+// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp -output=../docs
+// RUN: FileCheck %t/check.txt -input-file=%t/../docs/index_json.js
+// RUN: rm -rf %t
\ No newline at end of file
>From 40a52e547a3d80f80ffcff4aeb34e93d1cc72e87 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Sun, 30 Jun 2024 03:22:50 -0400
Subject: [PATCH 06/10] [clang-doc] fix missing - in output
---
clang-tools-extra/test/clang-doc/test-path-abs.cpp | 2 +-
clang-tools-extra/test/clang-doc/test-path-relative.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang-tools-extra/test/clang-doc/test-path-abs.cpp b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
index cf84e241be83f..2a8d06bd7be8f 100644
--- a/clang-tools-extra/test/clang-doc/test-path-abs.cpp
+++ b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
@@ -2,6 +2,6 @@
// RUN: mkdir %t
// RUN: echo "CHECK: var RootPath = \"%t\";" > %t/check.txt
// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp -output=%t/docs
+// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp --output=%t/docs
// RUN: FileCheck %t/check.txt -input-file=%t/docs/index_json.js
// RUN: rm -rf %t
\ No newline at end of file
diff --git a/clang-tools-extra/test/clang-doc/test-path-relative.cpp b/clang-tools-extra/test/clang-doc/test-path-relative.cpp
index c6d8769f238f6..7f8d71278f133 100644
--- a/clang-tools-extra/test/clang-doc/test-path-relative.cpp
+++ b/clang-tools-extra/test/clang-doc/test-path-relative.cpp
@@ -2,6 +2,6 @@
// RUN: mkdir %t
// RUN: cp "%s" "%t/test.cpp"
// RUN: echo "CHECK: var RootPath = \"%t/../docs\";" > %t/check.txt
-// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp -output=../docs
+// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp --output=../docs
// RUN: FileCheck %t/check.txt -input-file=%t/../docs/index_json.js
// RUN: rm -rf %t
\ No newline at end of file
>From 6b47fee8c6de012c449a09b2b1d6ae12812c3b05 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Sun, 30 Jun 2024 03:27:59 -0400
Subject: [PATCH 07/10] [clang-doc] fix platform
---
clang-tools-extra/test/clang-doc/test-path-abs.cpp | 2 +-
clang-tools-extra/test/clang-doc/test-path-relative.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang-tools-extra/test/clang-doc/test-path-abs.cpp b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
index 2a8d06bd7be8f..b1ca738147933 100644
--- a/clang-tools-extra/test/clang-doc/test-path-abs.cpp
+++ b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
@@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: mkdir %t
-// RUN: echo "CHECK: var RootPath = \"%t\";" > %t/check.txt
+// RUN: echo "CHECK: var RootPath = \"%/t\";" > %t/check.txt
// RUN: cp "%s" "%t/test.cpp"
// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp --output=%t/docs
// RUN: FileCheck %t/check.txt -input-file=%t/docs/index_json.js
diff --git a/clang-tools-extra/test/clang-doc/test-path-relative.cpp b/clang-tools-extra/test/clang-doc/test-path-relative.cpp
index 7f8d71278f133..de44c8c7b0572 100644
--- a/clang-tools-extra/test/clang-doc/test-path-relative.cpp
+++ b/clang-tools-extra/test/clang-doc/test-path-relative.cpp
@@ -1,7 +1,7 @@
// RUN: rm -rf %t
// RUN: mkdir %t
+// RUN: echo "CHECK: var RootPath = \"%/t/../docs\";" > %t/check.txt
// RUN: cp "%s" "%t/test.cpp"
-// RUN: echo "CHECK: var RootPath = \"%t/../docs\";" > %t/check.txt
// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp --output=../docs
// RUN: FileCheck %t/check.txt -input-file=%t/../docs/index_json.js
// RUN: rm -rf %t
\ No newline at end of file
>From ca1fb336839b5e4da06183a5e16e8f33d1e85b36 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Sun, 30 Jun 2024 03:45:28 -0400
Subject: [PATCH 08/10] [clang-doc] paths
---
clang-tools-extra/test/clang-doc/test-path-abs.cpp | 2 +-
clang-tools-extra/test/clang-doc/test-path-relative.cpp | 7 -------
2 files changed, 1 insertion(+), 8 deletions(-)
delete mode 100644 clang-tools-extra/test/clang-doc/test-path-relative.cpp
diff --git a/clang-tools-extra/test/clang-doc/test-path-abs.cpp b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
index b1ca738147933..a3ac9dc909216 100644
--- a/clang-tools-extra/test/clang-doc/test-path-abs.cpp
+++ b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
@@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: mkdir %t
-// RUN: echo "CHECK: var RootPath = \"%/t\";" > %t/check.txt
+// RUN: echo "CHECK: var RootPath = \"%/t/docs\";" > %t/check.txt
// RUN: cp "%s" "%t/test.cpp"
// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp --output=%t/docs
// RUN: FileCheck %t/check.txt -input-file=%t/docs/index_json.js
diff --git a/clang-tools-extra/test/clang-doc/test-path-relative.cpp b/clang-tools-extra/test/clang-doc/test-path-relative.cpp
deleted file mode 100644
index de44c8c7b0572..0000000000000
--- a/clang-tools-extra/test/clang-doc/test-path-relative.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: rm -rf %t
-// RUN: mkdir %t
-// RUN: echo "CHECK: var RootPath = \"%/t/../docs\";" > %t/check.txt
-// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp --output=../docs
-// RUN: FileCheck %t/check.txt -input-file=%t/../docs/index_json.js
-// RUN: rm -rf %t
\ No newline at end of file
>From 31424453c9428b7a05c2eb33a38c04c803cc1eac Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Fri, 12 Jul 2024 07:22:22 -0400
Subject: [PATCH 09/10] [clang-doc] pr comments
---
clang-tools-extra/test/clang-doc/test-path-abs.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/clang-tools-extra/test/clang-doc/test-path-abs.cpp b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
index a3ac9dc909216..cfcdcbc88f3c3 100644
--- a/clang-tools-extra/test/clang-doc/test-path-abs.cpp
+++ b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
@@ -1,5 +1,4 @@
-// RUN: rm -rf %t
-// RUN: mkdir %t
+// RUN: rm -rf %t && mkdir %t
// RUN: echo "CHECK: var RootPath = \"%/t/docs\";" > %t/check.txt
// RUN: cp "%s" "%t/test.cpp"
// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp --output=%t/docs
>From 02a1c5afed9d87850f93c2a65a31d587a67e89e5 Mon Sep 17 00:00:00 2001
From: PeterChou1 <peter.chou at mail.utoronto.ca>
Date: Wed, 24 Jul 2024 18:47:26 -0400
Subject: [PATCH 10/10] [clang-doc] address pr comments
---
clang-tools-extra/test/clang-doc/test-path-abs.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang-tools-extra/test/clang-doc/test-path-abs.cpp b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
index cfcdcbc88f3c3..6f1f659717f28 100644
--- a/clang-tools-extra/test/clang-doc/test-path-abs.cpp
+++ b/clang-tools-extra/test/clang-doc/test-path-abs.cpp
@@ -1,6 +1,6 @@
// RUN: rm -rf %t && mkdir %t
// RUN: echo "CHECK: var RootPath = \"%/t/docs\";" > %t/check.txt
// RUN: cp "%s" "%t/test.cpp"
-// RUN: clang-doc --format=html --executor=standalone -p %t %t/test.cpp --output=%t/docs
-// RUN: FileCheck %t/check.txt -input-file=%t/docs/index_json.js
+// RUN: clang-doc --format=html --executor=standalone -p %s --output=%t
+// RUN: FileCheck %s -input-file=%t/index_json.js
// RUN: rm -rf %t
\ No newline at end of file
More information about the cfe-commits
mailing list