xref: /aosp_15_r20/external/clang/test/Misc/ast-dump-comment.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -Wdocumentation -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
2*67e74705SXin Li 
3*67e74705SXin Li /// Aaa
4*67e74705SXin Li int TestLocation;
5*67e74705SXin Li // CHECK: VarDecl{{.*}}TestLocation
6*67e74705SXin Li // CHECK-NEXT:   FullComment 0x{{[^ ]*}} <line:[[@LINE-3]]:4, col:7>
7*67e74705SXin Li 
8*67e74705SXin Li ///
9*67e74705SXin Li int TestIndent;
10*67e74705SXin Li // CHECK:      {{^VarDecl.*TestIndent[^()]*$}}
11*67e74705SXin Li // CHECK-NEXT: {{^`-FullComment.*>$}}
12*67e74705SXin Li 
13*67e74705SXin Li /// Aaa
14*67e74705SXin Li int Test_TextComment;
15*67e74705SXin Li // CHECK:      VarDecl{{.*}}Test_TextComment
16*67e74705SXin Li // CHECK-NEXT:   FullComment
17*67e74705SXin Li // CHECK-NEXT:     ParagraphComment
18*67e74705SXin Li // CHECK-NEXT:       TextComment{{.*}} Text=" Aaa"
19*67e74705SXin Li 
20*67e74705SXin Li /// \brief Aaa
21*67e74705SXin Li int Test_BlockCommandComment;
22*67e74705SXin Li // CHECK:      VarDecl{{.*}}Test_BlockCommandComment
23*67e74705SXin Li // CHECK:        BlockCommandComment{{.*}} Name="brief"
24*67e74705SXin Li // CHECK-NEXT:     ParagraphComment
25*67e74705SXin Li // CHECK-NEXT:       TextComment{{.*}} Text=" Aaa"
26*67e74705SXin Li 
27*67e74705SXin Li /// \param Aaa xxx
28*67e74705SXin Li /// \param [in,out] Bbb yyy
29*67e74705SXin Li void Test_ParamCommandComment(int Aaa, int Bbb);
30*67e74705SXin Li // CHECK:      FunctionDecl{{.*}}Test_ParamCommandComment
31*67e74705SXin Li // CHECK:        ParamCommandComment{{.*}} [in] implicitly Param="Aaa" ParamIndex=0
32*67e74705SXin Li // CHECK-NEXT:     ParagraphComment
33*67e74705SXin Li // CHECK-NEXT:       TextComment{{.*}} Text=" xxx"
34*67e74705SXin Li // CHECK:        ParamCommandComment{{.*}} [in,out] explicitly Param="Bbb" ParamIndex=1
35*67e74705SXin Li // CHECK-NEXT:     ParagraphComment
36*67e74705SXin Li // CHECK-NEXT:       TextComment{{.*}} Text=" yyy"
37*67e74705SXin Li 
38*67e74705SXin Li /// \tparam Aaa xxx
39*67e74705SXin Li template <typename Aaa> class Test_TParamCommandComment;
40*67e74705SXin Li // CHECK:      ClassTemplateDecl{{.*}}Test_TParamCommandComment
41*67e74705SXin Li // CHECK:        TParamCommandComment{{.*}} Param="Aaa" Position=<0>
42*67e74705SXin Li // CHECK-NEXT:     ParagraphComment
43*67e74705SXin Li // CHECK-NEXT:       TextComment{{.*}} Text=" xxx"
44*67e74705SXin Li 
45*67e74705SXin Li /// \c Aaa
46*67e74705SXin Li int Test_InlineCommandComment;
47*67e74705SXin Li // CHECK:      VarDecl{{.*}}Test_InlineCommandComment
48*67e74705SXin Li // CHECK:        InlineCommandComment{{.*}} Name="c" RenderMonospaced Arg[0]="Aaa"
49*67e74705SXin Li 
50*67e74705SXin Li /// <a>Aaa</a>
51*67e74705SXin Li /// <br/>
52*67e74705SXin Li int Test_HTMLTagComment;
53*67e74705SXin Li // CHECK:      VarDecl{{.*}}Test_HTMLTagComment
54*67e74705SXin Li // CHECK-NEXT:   FullComment
55*67e74705SXin Li // CHECK-NEXT:     ParagraphComment
56*67e74705SXin Li // CHECK-NEXT:       TextComment{{.*}} Text=" "
57*67e74705SXin Li // CHECK-NEXT:       HTMLStartTagComment{{.*}} Name="a"
58*67e74705SXin Li // CHECK-NEXT:       TextComment{{.*}} Text="Aaa"
59*67e74705SXin Li // CHECK-NEXT:       HTMLEndTagComment{{.*}} Name="a"
60*67e74705SXin Li // CHECK-NEXT:       TextComment{{.*}} Text=" "
61*67e74705SXin Li // CHECK-NEXT:       HTMLStartTagComment{{.*}} Name="br" SelfClosing
62*67e74705SXin Li 
63*67e74705SXin Li /// \verbatim
64*67e74705SXin Li /// Aaa
65*67e74705SXin Li /// \endverbatim
66*67e74705SXin Li int Test_VerbatimBlockComment;
67*67e74705SXin Li // CHECK:      VarDecl{{.*}}Test_VerbatimBlockComment
68*67e74705SXin Li // CHECK:        VerbatimBlockComment{{.*}} Name="verbatim" CloseName="endverbatim"
69*67e74705SXin Li // CHECK-NEXT:     VerbatimBlockLineComment{{.*}} Text=" Aaa"
70*67e74705SXin Li 
71*67e74705SXin Li /// \param ... More arguments
72*67e74705SXin Li template<typename T>
73*67e74705SXin Li void Test_TemplatedFunctionVariadic(int arg, ...);
74*67e74705SXin Li // CHECK:      FunctionTemplateDecl{{.*}}Test_TemplatedFunctionVariadic
75*67e74705SXin Li // CHECK:        ParamCommandComment{{.*}} [in] implicitly Param="..."
76*67e74705SXin Li // CHECK-NEXT:     ParagraphComment
77*67e74705SXin Li // CHECK-NEXT:       TextComment{{.*}} Text=" More arguments"
78