Author: ZhongUncle Date: 2025-05-06T16:00:02-07:00 New Revision: a63fd59d95397d236b03e964287728a35efa296b
URL: https://github.com/llvm/llvm-project/commit/a63fd59d95397d236b03e964287728a35efa296b DIFF: https://github.com/llvm/llvm-project/commit/a63fd59d95397d236b03e964287728a35efa296b.diff LOG: [clang-doc] Add regression test for test comments in macros (#132510) Fixes https://github.com/llvm/llvm-project/issues/59819. The underlying problem was fixed in https://reviews.llvm.org/D142560, but this patch adds a proper regression test. Added: clang-tools-extra/test/clang-doc/comments-in-macros.cpp Modified: Removed: ################################################################################ diff --git a/clang-tools-extra/test/clang-doc/comments-in-macros.cpp b/clang-tools-extra/test/clang-doc/comments-in-macros.cpp new file mode 100644 index 0000000000000..0c70fadb7f9ac --- /dev/null +++ b/clang-tools-extra/test/clang-doc/comments-in-macros.cpp @@ -0,0 +1,35 @@ +// Regression test for https://github.com/llvm/llvm-project/issues/59819 + +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --format=md --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: clang-doc --format=html --doxygen --output=%t --executor=standalone %s +// 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 { +public: +// MD-MYCLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}comments-in-macros.cpp#[[@LINE+2]]* +// HTML-MYCLASS-LINE: <p>Defined at line [[@LINE+1]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}comments-in-macros.cpp</p> + DECLARE_METHODS +}; + _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits