[clang-tools-extra] [clang-doc] Test more language constructs (PR #205585)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 09:03:50 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: Paul Kirth (ilovepi)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/205585.diff
15 Files Affected:
- (added) clang-tools-extra/test/clang-doc/Inputs/array-type.cpp (+1)
- (added) clang-tools-extra/test/clang-doc/Inputs/class-partial-specialization.cpp (+2)
- (added) clang-tools-extra/test/clang-doc/Inputs/function-pointer-type.cpp (+1)
- (added) clang-tools-extra/test/clang-doc/Inputs/member-function-pointer-type.cpp (+2)
- (added) clang-tools-extra/test/clang-doc/Inputs/nested-pointer-qualifiers.cpp (+1)
- (added) clang-tools-extra/test/clang-doc/array-type.cpp (+12)
- (added) clang-tools-extra/test/clang-doc/class-partial-specialization.cpp (+13)
- (added) clang-tools-extra/test/clang-doc/function-pointer-type.cpp (+12)
- (added) clang-tools-extra/test/clang-doc/json/array-type.cpp (+18)
- (added) clang-tools-extra/test/clang-doc/json/class-partial-specialization.cpp (+25)
- (added) clang-tools-extra/test/clang-doc/json/function-pointer-type.cpp (+18)
- (added) clang-tools-extra/test/clang-doc/json/member-function-pointer-type.cpp (+18)
- (added) clang-tools-extra/test/clang-doc/json/nested-pointer-qualifiers.cpp (+18)
- (added) clang-tools-extra/test/clang-doc/member-function-pointer-type.cpp (+12)
- (added) clang-tools-extra/test/clang-doc/nested-pointer-qualifiers.cpp (+12)
``````````diff
diff --git a/clang-tools-extra/test/clang-doc/Inputs/array-type.cpp b/clang-tools-extra/test/clang-doc/Inputs/array-type.cpp
new file mode 100644
index 00000000000000..74053aa4b0f4a1
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/Inputs/array-type.cpp
@@ -0,0 +1 @@
+void qux(int (&arr)[5]);
diff --git a/clang-tools-extra/test/clang-doc/Inputs/class-partial-specialization.cpp b/clang-tools-extra/test/clang-doc/Inputs/class-partial-specialization.cpp
new file mode 100644
index 00000000000000..f36b3201386911
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/Inputs/class-partial-specialization.cpp
@@ -0,0 +1,2 @@
+template<typename T> struct MyClass {};
+template<typename T> struct MyClass<T*> {};
diff --git a/clang-tools-extra/test/clang-doc/Inputs/function-pointer-type.cpp b/clang-tools-extra/test/clang-doc/Inputs/function-pointer-type.cpp
new file mode 100644
index 00000000000000..adbdad6a23f171
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/Inputs/function-pointer-type.cpp
@@ -0,0 +1 @@
+void bar(void (*fn)(int));
diff --git a/clang-tools-extra/test/clang-doc/Inputs/member-function-pointer-type.cpp b/clang-tools-extra/test/clang-doc/Inputs/member-function-pointer-type.cpp
new file mode 100644
index 00000000000000..4bb025a198b6ab
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/Inputs/member-function-pointer-type.cpp
@@ -0,0 +1,2 @@
+struct Class {};
+void baz(void (Class::*fn)(int));
diff --git a/clang-tools-extra/test/clang-doc/Inputs/nested-pointer-qualifiers.cpp b/clang-tools-extra/test/clang-doc/Inputs/nested-pointer-qualifiers.cpp
new file mode 100644
index 00000000000000..49cfb4c8567f4e
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/Inputs/nested-pointer-qualifiers.cpp
@@ -0,0 +1 @@
+void foo(const int * const * ptr);
diff --git a/clang-tools-extra/test/clang-doc/array-type.cpp b/clang-tools-extra/test/clang-doc/array-type.cpp
new file mode 100644
index 00000000000000..0e7cef6a60853e
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/array-type.cpp
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --output=%t --format=html --executor=standalone %S/Inputs/array-type.cpp
+// RUN: FileCheck %s --check-prefix=HTML < %t/html/GlobalNamespace/index.html
+// RUN: clang-doc --output=%t --format=md --executor=standalone %S/Inputs/array-type.cpp
+// RUN: FileCheck %s --check-prefix=MD < %t/GlobalNamespace/index.md
+// RUN: clang-doc --output=%t --format=md_mustache --executor=standalone %S/Inputs/array-type.cpp
+// RUN: FileCheck %s --check-prefix=MD-MUSTACHE < %t/md/GlobalNamespace/index.md
+
+// HTML: <pre><code class="language-cpp code-clang-doc">void qux (int (&)[5] arr)</code></pre>
+
+// MD: *void qux(int (&)[5] arr)*
+// MD-MUSTACHE: *void qux(int (&)[5] arr)*
diff --git a/clang-tools-extra/test/clang-doc/class-partial-specialization.cpp b/clang-tools-extra/test/clang-doc/class-partial-specialization.cpp
new file mode 100644
index 00000000000000..0eff263bc5632a
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/class-partial-specialization.cpp
@@ -0,0 +1,13 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --output=%t --format=html --executor=standalone %S/Inputs/class-partial-specialization.cpp
+// RUN: FileCheck %s --check-prefix=HTML < %t/html/GlobalNamespace/_ZTV7MyClassIPT_E.html
+// RUN: clang-doc --output=%t --format=md --executor=standalone %S/Inputs/class-partial-specialization.cpp
+// RUN: FileCheck %s --check-prefix=MD < %t/GlobalNamespace/MyClass.md
+// RUN: clang-doc --output=%t --format=md_mustache --executor=standalone %S/Inputs/class-partial-specialization.cpp
+// RUN: FileCheck %s --check-prefix=MD-MUSTACHE < %t/md/GlobalNamespace/_ZTV7MyClassIPT_E.md
+
+// HTML: <pre><code class="language-cpp code-clang-doc">template <typename T></code></pre>
+// HTML: <h1 class="hero__title-large">struct MyClass</h1>
+
+// MD: # struct MyClass
+// MD-MUSTACHE: # struct MyClass
diff --git a/clang-tools-extra/test/clang-doc/function-pointer-type.cpp b/clang-tools-extra/test/clang-doc/function-pointer-type.cpp
new file mode 100644
index 00000000000000..ede36472564aae
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/function-pointer-type.cpp
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --output=%t --format=html --executor=standalone %S/Inputs/function-pointer-type.cpp
+// RUN: FileCheck %s --check-prefix=HTML < %t/html/GlobalNamespace/index.html
+// RUN: clang-doc --output=%t --format=md --executor=standalone %S/Inputs/function-pointer-type.cpp
+// RUN: FileCheck %s --check-prefix=MD < %t/GlobalNamespace/index.md
+// RUN: clang-doc --output=%t --format=md_mustache --executor=standalone %S/Inputs/function-pointer-type.cpp
+// RUN: FileCheck %s --check-prefix=MD-MUSTACHE < %t/md/GlobalNamespace/index.md
+
+// HTML: <pre><code class="language-cpp code-clang-doc">void bar (void (*)(int) fn)</code></pre>
+
+// MD: *void bar(void (*)(int) fn)*
+// MD-MUSTACHE: *void bar(void (*)(int) fn)*
diff --git a/clang-tools-extra/test/clang-doc/json/array-type.cpp b/clang-tools-extra/test/clang-doc/json/array-type.cpp
new file mode 100644
index 00000000000000..861210879a8874
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/json/array-type.cpp
@@ -0,0 +1,18 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --pretty-json --output=%t --format=json --executor=standalone %S/../Inputs/array-type.cpp
+// RUN: FileCheck %s < %t/json/GlobalNamespace/index.json
+
+// CHECK: "Functions": [
+// CHECK-NEXT: {
+// CHECK: "Name": "qux",
+// CHECK: "Params": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "Name": "arr",
+// CHECK-NEXT: "ParamEnd": true,
+// CHECK-NEXT: "Type": {
+// CHECK-NEXT: "Name": "int (&)[5]",
+// CHECK-NEXT: "QualName": "int (&)[5]",
+// CHECK-NEXT: "USR": "0000000000000000000000000000000000000000"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
diff --git a/clang-tools-extra/test/clang-doc/json/class-partial-specialization.cpp b/clang-tools-extra/test/clang-doc/json/class-partial-specialization.cpp
new file mode 100644
index 00000000000000..c5d2a65f5e53f2
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/json/class-partial-specialization.cpp
@@ -0,0 +1,25 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --pretty-json --output=%t --format=json --executor=standalone %S/../Inputs/class-partial-specialization.cpp
+// RUN: FileCheck %s < %t/json/GlobalNamespace/_ZTV7MyClassIPT_E.json
+
+// CHECK: "MangledName": "_ZTV7MyClassIPT_E",
+// CHECK-NEXT: "Name": "MyClass",
+// CHECK: "Template": {
+// CHECK-NEXT: "Parameters": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "End": true,
+// CHECK-NEXT: "Param": "typename T"
+// CHECK-NEXT: }
+// CHECK-NEXT: ],
+// CHECK-NEXT: "Specialization": {
+// CHECK-NEXT: "Parameters": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "Param": "T*",
+// CHECK-NEXT: "SpecParamEnd": true
+// CHECK-NEXT: }
+// CHECK-NEXT: ],
+// CHECK-NEXT: "SpecializationOf": "{{[0-9A-F]*}}",
+// CHECK-NEXT: "VerticalDisplay": false
+// CHECK-NEXT: },
+// CHECK-NEXT: "VerticalDisplay": false
+// CHECK-NEXT: }
diff --git a/clang-tools-extra/test/clang-doc/json/function-pointer-type.cpp b/clang-tools-extra/test/clang-doc/json/function-pointer-type.cpp
new file mode 100644
index 00000000000000..34b693bc67d2b0
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/json/function-pointer-type.cpp
@@ -0,0 +1,18 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --pretty-json --output=%t --format=json --executor=standalone %S/../Inputs/function-pointer-type.cpp
+// RUN: FileCheck %s < %t/json/GlobalNamespace/index.json
+
+// CHECK: "Functions": [
+// CHECK-NEXT: {
+// CHECK: "Name": "bar",
+// CHECK: "Params": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "Name": "fn",
+// CHECK-NEXT: "ParamEnd": true,
+// CHECK-NEXT: "Type": {
+// CHECK-NEXT: "Name": "void (*)(int)",
+// CHECK-NEXT: "QualName": "void (*)(int)",
+// CHECK-NEXT: "USR": "0000000000000000000000000000000000000000"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
diff --git a/clang-tools-extra/test/clang-doc/json/member-function-pointer-type.cpp b/clang-tools-extra/test/clang-doc/json/member-function-pointer-type.cpp
new file mode 100644
index 00000000000000..8ca1ecbb1d14d4
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/json/member-function-pointer-type.cpp
@@ -0,0 +1,18 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --pretty-json --output=%t --format=json --executor=standalone %S/../Inputs/member-function-pointer-type.cpp
+// RUN: FileCheck %s < %t/json/GlobalNamespace/index.json
+
+// CHECK: "Functions": [
+// CHECK-NEXT: {
+// CHECK: "Name": "baz",
+// CHECK: "Params": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "Name": "fn",
+// CHECK-NEXT: "ParamEnd": true,
+// CHECK-NEXT: "Type": {
+// CHECK-NEXT: "Name": "void (Class::*)(int)",
+// CHECK-NEXT: "QualName": "void (Class::*)(int)",
+// CHECK-NEXT: "USR": "0000000000000000000000000000000000000000"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
diff --git a/clang-tools-extra/test/clang-doc/json/nested-pointer-qualifiers.cpp b/clang-tools-extra/test/clang-doc/json/nested-pointer-qualifiers.cpp
new file mode 100644
index 00000000000000..5a3e8842b80369
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/json/nested-pointer-qualifiers.cpp
@@ -0,0 +1,18 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --pretty-json --output=%t --format=json --executor=standalone %S/../Inputs/nested-pointer-qualifiers.cpp
+// RUN: FileCheck %s < %t/json/GlobalNamespace/index.json
+
+// CHECK: "Functions": [
+// CHECK-NEXT: {
+// CHECK: "Name": "foo",
+// CHECK: "Params": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "Name": "ptr",
+// CHECK-NEXT: "ParamEnd": true,
+// CHECK-NEXT: "Type": {
+// CHECK-NEXT: "Name": "const int *const *",
+// CHECK-NEXT: "QualName": "const int *const *",
+// CHECK-NEXT: "USR": "0000000000000000000000000000000000000000"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
diff --git a/clang-tools-extra/test/clang-doc/member-function-pointer-type.cpp b/clang-tools-extra/test/clang-doc/member-function-pointer-type.cpp
new file mode 100644
index 00000000000000..4906c0c4ca966b
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/member-function-pointer-type.cpp
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --output=%t --format=html --executor=standalone %S/Inputs/member-function-pointer-type.cpp
+// RUN: FileCheck %s --check-prefix=HTML < %t/html/GlobalNamespace/index.html
+// RUN: clang-doc --output=%t --format=md --executor=standalone %S/Inputs/member-function-pointer-type.cpp
+// RUN: FileCheck %s --check-prefix=MD < %t/GlobalNamespace/index.md
+// RUN: clang-doc --output=%t --format=md_mustache --executor=standalone %S/Inputs/member-function-pointer-type.cpp
+// RUN: FileCheck %s --check-prefix=MD-MUSTACHE < %t/md/GlobalNamespace/index.md
+
+// HTML: <pre><code class="language-cpp code-clang-doc">void baz (void (Class::*)(int) fn)</code></pre>
+
+// MD: *void baz(void (Class::*)(int) fn)*
+// MD-MUSTACHE: *void baz(void (Class::*)(int) fn)*
diff --git a/clang-tools-extra/test/clang-doc/nested-pointer-qualifiers.cpp b/clang-tools-extra/test/clang-doc/nested-pointer-qualifiers.cpp
new file mode 100644
index 00000000000000..dc204f044711b9
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/nested-pointer-qualifiers.cpp
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --output=%t --format=html --executor=standalone %S/Inputs/nested-pointer-qualifiers.cpp
+// RUN: FileCheck %s --check-prefix=HTML < %t/html/GlobalNamespace/index.html
+// RUN: clang-doc --output=%t --format=md --executor=standalone %S/Inputs/nested-pointer-qualifiers.cpp
+// RUN: FileCheck %s --check-prefix=MD < %t/GlobalNamespace/index.md
+// RUN: clang-doc --output=%t --format=md_mustache --executor=standalone %S/Inputs/nested-pointer-qualifiers.cpp
+// RUN: FileCheck %s --check-prefix=MD-MUSTACHE < %t/md/GlobalNamespace/index.md
+
+// HTML: <pre><code class="language-cpp code-clang-doc">void foo (const int *const * ptr)</code></pre>
+
+// MD: *void foo(const int *const * ptr)*
+// MD-MUSTACHE: *void foo(const int *const * ptr)*
``````````
</details>
https://github.com/llvm/llvm-project/pull/205585
More information about the cfe-commits
mailing list