[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Add test to clang-doc, it can test comments in macro. Original issue is #59819. (PR #132360)

via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 21 09:15:36 PDT 2025


================
@@ -0,0 +1,32 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s
+// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s
+// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass-LINE
+// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass
+// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass-LINE
+// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass
+
+#define DECLARE_METHODS                                           \
+    /**    
+     * @brief Declare a method to calculate the sum of two numbers
+     */                                                           \
+    int Add(int a, int b)                                         \
+    {                                                             \
+        return a + b;                                             \
+    }
+
+// MD-MyClass: ### Add
+// MD-MyClass: *public int Add(int a, int b)*
+// MD-MyClass: **brief** Declare a method to calculate the sum of two numbers
+
+// HTML-MyClass: <p>public int Add(int a, int b)</p>
+// HTML-MyClass: <div>brief</div>
+// HTML-MyClass: <p> Declare a method to calculate the sum of two numbers</p>
+
+
+class MyClass {
----------------
ZhongUncle wrote:

If I didn't use this class, in this style comment, generated content will no this macro, both html and markdown. That why I use a . And again, I try  to restore issue example in issue, so I use this style comment. 

I also think this class shouldn't be here, but I don't know how to implement a macro function like in issue.

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


More information about the lldb-commits mailing list