Debian Codegraph @

clang/test/AST/ast-dump-comment.cpp

raw
1 // Without serialization:
2 // RUN: %clang_cc1 -Wdocumentation -ast-dump -ast-dump-filter Test %s \
3 // RUN: | FileCheck -strict-whitespace %s
4 //
5 // With serialization:
6 // RUN: %clang_cc1 -Wdocumentation -emit-pch -o %t %s
7 // RUN: %clang_cc1 -x c++ -Wdocumentation -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
8 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
9 // RUN: | FileCheck --strict-whitespace %s
10
11 /// Aaa
12 int TestLocation;
13 // CHECK: VarDecl{{.*}}TestLocation
14 // CHECK-NEXT: FullComment 0x{{[^ ]*}} <line:[[@LINE-3]]:4, col:7>
15
16 ///
17 int TestIndent;
18 // CHECK: {{^VarDecl.*TestIndent[^()]*$}}
19 // CHECK-NEXT: {{^`-FullComment.*>$}}
20
21 /// Aaa
22 int Test_TextComment;
23 // CHECK: VarDecl{{.*}}Test_TextComment
24 // CHECK-NEXT: FullComment
25 // CHECK-NEXT: ParagraphComment
26 // CHECK-NEXT: TextComment{{.*}} Text=" Aaa"
27
28 /// \brief Aaa
29 int Test_BlockCommandComment;
30 // CHECK: VarDecl{{.*}}Test_BlockCommandComment
31 // CHECK: BlockCommandComment{{.*}} Name="brief"
32 // CHECK-NEXT: ParagraphComment
33 // CHECK-NEXT: TextComment{{.*}} Text=" Aaa"
34
35 /// \retval 42 Aaa
36 int Test_BlockCommandComment_WithArgs();
37 // CHECK: FunctionDecl{{.*}}Test_BlockCommandComment_WithArgs
38 // CHECK: BlockCommandComment{{.*}} Name="retval" Arg[0]="42"
39 // CHECK-NEXT: ParagraphComment
40 // CHECK-NEXT: TextComment{{.*}} Text=" Aaa"
41
42 /// \param Aaa xxx
43 /// \param [in,out] Bbb yyy
44 void Test_ParamCommandComment(int Aaa, int Bbb);
45 // CHECK: FunctionDecl{{.*}}Test_ParamCommandComment
46 // CHECK: ParamCommandComment{{.*}} [in] implicitly Param="Aaa" ParamIndex=0
47 // CHECK-NEXT: ParagraphComment
48 // CHECK-NEXT: TextComment{{.*}} Text=" xxx"
49 // CHECK: ParamCommandComment{{.*}} [in,out] explicitly Param="Bbb" ParamIndex=1
50 // CHECK-NEXT: ParagraphComment
51 // CHECK-NEXT: TextComment{{.*}} Text=" yyy"
52
53 /// \tparam Aaa xxx
54 template <typename Aaa> class Test_TParamCommandComment;
55 // CHECK: ClassTemplateDecl{{.*}}Test_TParamCommandComment
56 // CHECK: TParamCommandComment{{.*}} Param="Aaa" Position=<0>
57 // CHECK-NEXT: ParagraphComment
58 // CHECK-NEXT: TextComment{{.*}} Text=" xxx"
59
60 /// \c Aaa
61 int Test_InlineCommandComment;
62 // CHECK: VarDecl{{.*}}Test_InlineCommandComment
63 // CHECK: InlineCommandComment{{.*}} Name="c" RenderMonospaced Arg[0]="Aaa"
64
65 /// \n Aaa
66 int Test_InlineCommandComment_NoArgs;
67 // CHECK: VarDecl{{.*}}Test_InlineCommandComment_NoArgs
68 // CHECK: InlineCommandComment{{.*}} Name="n" RenderNormal
69 // CHECK-NEXT: TextComment{{.*}} Text=" Aaa"
70
71 /// \anchor Aaa
72 int Test_InlineCommandCommentAnchor;
73 // CHECK: VarDecl{{.*}}Test_InlineCommandComment
74 // CHECK: InlineCommandComment{{.*}} Name="anchor" RenderAnchor Arg[0]="Aaa"
75
76 /// \relates Aaa
77 int Test_InlineCommandCommentRelates;
78 // CHECK: VarDecl{{.*}}Test_InlineCommandCommentRelates
79 // CHECK: InlineCommandComment{{.*}} Name="relates" RenderNormal Arg[0]="Aaa"
80
81 /// <a>Aaa</a>
82 /// <br/>
83 int Test_HTMLTagComment;
84 // CHECK: VarDecl{{.*}}Test_HTMLTagComment
85 // CHECK-NEXT: FullComment
86 // CHECK-NEXT: ParagraphComment
87 // CHECK-NEXT: TextComment{{.*}} Text=" "
88 // CHECK-NEXT: HTMLStartTagComment{{.*}} Name="a"
89 // CHECK-NEXT: TextComment{{.*}} Text="Aaa"
90 // CHECK-NEXT: HTMLEndTagComment{{.*}} Name="a"
91 // CHECK-NEXT: TextComment{{.*}} Text=" "
92 // CHECK-NEXT: HTMLStartTagComment{{.*}} Name="br" SelfClosing
93
94 /// <a
95 /// href="foo"
96 /// >Aaa</a>b
97 int Test_HTMLTagMultilineBCPL;
98 // CHECK: VarDecl{{.*}}Test_HTMLTagMultilineBCPL
99 // CHECK-NEXT: FullComment
100 // CHECK-NEXT: ParagraphComment
101 // CHECK-NEXT: TextComment{{.*}} Text=" "
102 // CHECK-NEXT: HTMLStartTagComment{{.*}} Name="a" Attrs: "href="foo"
103 // CHECK-NEXT: TextComment{{.*}} Text="Aaa"
104 // CHECK-NEXT: HTMLEndTagComment{{.*}} Name="a"
105 // CHECK-NEXT: TextComment{{.*}} Text="b"
106
107 /// \verbatim
108 /// Aaa
109 /// \endverbatim
110 /// \f$ a \f$
111 /// \f( b \f)
112 /// \f[ c \f]
113 /// \f{env}{ c \f}
114 int Test_VerbatimBlockComment;
115 // CHECK: VarDecl{{.*}}Test_VerbatimBlockComment
116 // CHECK: VerbatimBlockComment{{.*}} Name="verbatim" CloseName="endverbatim"
117 // CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" Aaa"
118 // CHECK: VerbatimBlockComment{{.*}} Name="f$" CloseName="f$"
119 // CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" a "
120 // CHECK: VerbatimBlockComment{{.*}} Name="f(" CloseName="f)"
121 // CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" b "
122 // CHECK: VerbatimBlockComment{{.*}} Name="f[" CloseName="f]"
123 // CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" c "
124 // CHECK: VerbatimBlockComment{{.*}} Name="f{" CloseName="f}"
125 // CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text="env}{ c "
126
127 /// \param ... More arguments
128 template<typename T>
129 void Test_TemplatedFunctionVariadic(int arg, ...);
130 // CHECK: FunctionTemplateDecl{{.*}}Test_TemplatedFunctionVariadic
131 // CHECK: ParamCommandComment{{.*}} [in] implicitly Param="..."
132 // CHECK-NEXT: ParagraphComment
133 // CHECK-NEXT: TextComment{{.*}} Text=" More arguments"
134
135 /// \param[out] Aaa <summary>Short summary</summary>
136 int Test_HTMLSummaryTag(int Aaa);
137 // CHECK: FunctionDecl{{.*}}Test_HTMLSummaryTag
138 // CHECK: ParamCommandComment{{.*}} [out] explicitly Param="Aaa"
139 // CHECK-NEXT: ParagraphComment
140 // CHECK: HTMLStartTagComment{{.*}} Name="summary"
141 // CHECK-NEXT: TextComment{{.*}} Text="Short summary"
142 // CHECK-NEXT: HTMLEndTagComment{{.*}} Name="summary"
143
144 /// \thread_safe test for underscore in special command
145 int Test_UnderscoreInSpecialCommand;
146 // CHECK: VarDecl{{.*}}Test_UnderscoreInSpecialCommand 'int'
147 // CHECK: InlineCommandComment{{.*}} Name="thread_safe" RenderNormal
148 // CHECK-NEXT: TextComment{{.*}} Text=" test for underscore in special command"
149
150 /// <details>
151 /// <summary>
152 /// Summary
153 /// </summary>
154 /// <p>Details</p>
155 /// </details>
156 ///
157 /// Some <mark>highlighting</mark>
158 ///
159 /// <figure>
160 /// <img src="pic.jpg">
161 /// <figcaption>Figure 1</figcaption>
162 /// </figure>
163 int Test_AdditionalHTMLTags(int Aaa);
164 // CHECK: FunctionDecl{{.*}}Test_AdditionalHTMLTags 'int (int)'
165 // CHECK: HTMLStartTagComment{{.*}} Name="details"
166 // CHECK: HTMLStartTagComment{{.*}} Name="summary"
167 // CHECK-NEXT: TextComment{{.*}} Text=" Summary"
168 // CHECK: HTMLEndTagComment{{.*}} Name="summary"
169 // CHECK: HTMLStartTagComment{{.*}} Name="p"
170 // CHECK-NEXT: TextComment{{.*}} Text="Details"
171 // CHECK-NEXT: HTMLEndTagComment{{.*}} Name="p"
172 // CHECK: HTMLEndTagComment{{.*}} Name="details"
173 // CHECK: HTMLStartTagComment{{.*}} Name="mark"
174 // CHECK-NEXT: TextComment{{.*}} Text="highlighting"
175 // CHECK-NEXT: HTMLEndTagComment{{.*}} Name="mark"
176 // CHECK: HTMLStartTagComment{{.*}} Name="figure"
177 // CHECK: HTMLStartTagComment{{.*}} Name="img" Attrs: "src="pic.jpg"
178 // CHECK: HTMLStartTagComment{{.*}} Name="figcaption"
179 // CHECK-NEXT: TextComment{{.*}} Text="Figure 1"
180 // CHECK-NEXT: HTMLEndTagComment{{.*}} Name="figcaption"
181 // CHECK: HTMLEndTagComment{{.*}} Name="figure"