[llvm-branch-commits] [clang] [clang][test] add testing for the AST matcher reference (PR #94248)

Aaron Ballman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 4 13:29:21 PDT 2024


================
@@ -330,35 +377,46 @@ AST_POLYMORPHIC_MATCHER_P(isExpandedFromMacro,
 
 /// Matches declarations.
 ///
-/// Examples matches \c X, \c C, and the friend declaration inside \c C;
+/// Given
 /// \code
 ///   void X();
 ///   class C {
-///     friend X;
+///     friend void X();
 ///   };
 /// \endcode
+/// \compile_args{-std=c++}
+/// The matcher \matcher{decl()}
+/// matches \match{void X()}, \match{type=name;count=2$C}
+/// and \match{count=2$friend void X()}.
----------------
AaronBallman wrote:

Can you explain `\match{type=name;count=2$C}`? I can see it matching `class C`, but I'm wondering what the second match is (and should we add a comment explaining that other match?).

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


More information about the llvm-branch-commits mailing list