[llvm-branch-commits] [clang-doc] Add tests for Markdown output with C++ templates (PR #119813)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 12 20:27:36 PST 2024


llvmbot 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/119813.diff


1 Files Affected:

- (modified) clang-tools-extra/test/clang-doc/templates.cpp (+19) 


``````````diff
diff --git a/clang-tools-extra/test/clang-doc/templates.cpp b/clang-tools-extra/test/clang-doc/templates.cpp
index 05a3dab71f48a1..536b24161990aa 100644
--- a/clang-tools-extra/test/clang-doc/templates.cpp
+++ b/clang-tools-extra/test/clang-doc/templates.cpp
@@ -1,11 +1,18 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
+
 // RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs
 // RUN: cat %t/docs/index.yaml | FileCheck %s --check-prefix=YAML
 
+// RUN: clang-doc --doxygen --executor=standalone %s -output=%t/docs --format=md
+// RUN: cat %t/docs/GlobalNamespace/index.md | FileCheck %s --check-prefix=MD
+
 // YAML: ---
 // YAML-NEXT: USR:             '{{([0-9A-F]{40})}}'
 
+// MD: # Global Namespace
+// MD: ## Functions
+
 template<class... T>
 void ParamPackFunction(T... args);
 
@@ -28,6 +35,9 @@ void ParamPackFunction(T... args);
 // YAML-NEXT:      Params:
 // YAML-NEXT:        - Contents:        'class... T'
 
+// MD: ### ParamPackFunction
+// MD: *void ParamPackFunction(T... args)*
+
 template<typename T, int U = 1>
 void function(T x) {}
 
@@ -50,6 +60,10 @@ void function(T x) {}
 // YAML-NEXT:         - Contents:        'typename T'
 // YAML-NEXT:         - Contents:        'int U = 1'
 
+// MD: ### function
+// MD: *void function(T x)*
+// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 23]]*
+
 template<>
 void function<bool, 0>(bool x) {}
 
@@ -75,3 +89,8 @@ void function<bool, 0>(bool x) {}
 // YAML-NEXT:           - Contents:        '0'
 // YAML-NEXT: ...
 
+// MD: ### function
+// MD: *void function(_Bool x)*
+// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 27]]*
+
+

``````````

</details>


https://github.com/llvm/llvm-project/pull/119813


More information about the llvm-branch-commits mailing list