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:

public int Add(int a, int b)

+// HTML-MYCLASS:
brief
+// HTML-MYCLASS:

Declare a method to calculate the sum of two numbers

+ + +class MyClass { +public: +// MD-MYCLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}comments-in-macros.cpp#[[@LINE+2]]* +// HTML-MYCLASS-LINE:

Defined at line [[@LINE+1]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}comments-in-macros.cpp

+ DECLARE_METHODS +}; +