blob: 5d866359aa75f0222531c2ce2cfc058b1b007a2b [file] [log] [blame]
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +00002
Dmitri Gribenkof303d4c2012-08-07 17:54:38 +00003// This file contains lots of corner cases, so ensure that XML we generate is not invalid.
4// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s | FileCheck %s -check-prefix=WRONG
5// WRONG-NOT: CommentXMLInvalid
6
Stephen Hines6bcf27b2014-05-29 04:14:42 -07007// expected-warning@+2 {{HTML tag 'a' requires an end tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +00008// expected-warning@+1 {{expected quoted string after equals sign}}
9/// <a href=>
10int test_html1(int);
11
Stephen Hines6bcf27b2014-05-29 04:14:42 -070012// expected-warning@+2 {{HTML tag 'a' requires an end tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000013// expected-warning@+1 {{expected quoted string after equals sign}}
14/// <a href==>
15int test_html2(int);
16
Stephen Hines6bcf27b2014-05-29 04:14:42 -070017// expected-warning@+3 {{HTML tag 'a' requires an end tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000018// expected-warning@+2 {{expected quoted string after equals sign}}
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000019// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000020/// <a href= blah
21int test_html3(int);
22
Stephen Hines6bcf27b2014-05-29 04:14:42 -070023// expected-warning@+2 {{HTML tag 'a' requires an end tag}}
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000024// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000025/// <a =>
26int test_html4(int);
27
Stephen Hines6bcf27b2014-05-29 04:14:42 -070028// expected-warning@+2 {{HTML tag 'a' requires an end tag}}
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000029// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000030/// <a "aaa">
31int test_html5(int);
32
Stephen Hines6bcf27b2014-05-29 04:14:42 -070033// expected-warning@+2 {{HTML tag 'a' requires an end tag}}
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000034// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000035/// <a a="b" =>
36int test_html6(int);
37
Stephen Hines6bcf27b2014-05-29 04:14:42 -070038// expected-warning@+2 {{HTML tag 'a' requires an end tag}}
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000039// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000040/// <a a="b" "aaa">
41int test_html7(int);
42
Stephen Hines6bcf27b2014-05-29 04:14:42 -070043// expected-warning@+2 {{HTML tag 'a' requires an end tag}}
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000044// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000045/// <a a="b" =
46int test_html8(int);
47
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000048// expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}}
Dmitri Gribenko834a5bd2012-08-22 22:56:08 +000049/** Aaa bbb<img ddd eee
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000050 * fff ggg.
51 */
52int test_html9(int);
53
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000054// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenko834a5bd2012-08-22 22:56:08 +000055/** Aaa bbb<img ddd eee 42%
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000056 * fff ggg.
57 */
58int test_html10(int);
59
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000060// expected-warning@+1 {{HTML end tag 'br' is forbidden}}
Dmitri Gribenko3d986982012-07-12 23:37:09 +000061/// <br></br>
62int test_html11(int);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000063
64/// <blockquote>Meow</blockquote>
65int test_html_nesting1(int);
66
67/// <b><i>Meow</i></b>
68int test_html_nesting2(int);
69
70/// <p>Aaa<br>
71/// Bbb</p>
72int test_html_nesting3(int);
73
74/// <p>Aaa<br />
75/// Bbb</p>
76int test_html_nesting4(int);
77
Stephen Hines6bcf27b2014-05-29 04:14:42 -070078// expected-warning@+3 {{HTML tag 'b' requires an end tag}}
79// expected-warning@+2 {{HTML tag 'i' requires an end tag}}
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000080// expected-warning@+1 {{HTML end tag does not match any start tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000081/// <b><i>Meow</a>
82int test_html_nesting5(int);
83
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000084// expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
85// expected-warning@+1 {{HTML end tag does not match any start tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000086/// <b><i>Meow</b></b>
87int test_html_nesting6(int);
88
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000089// expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
90// expected-warning@+1 {{HTML end tag does not match any start tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000091/// <b><i>Meow</b></i>
92int test_html_nesting7(int);
93
Stephen Hines6bcf27b2014-05-29 04:14:42 -070094// expected-warning@+1 {{HTML tag 'b' requires an end tag}}
95/// <b>Meow
96int test_html_nesting8(int);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000097
98// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000099/// \brief\returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000100int test_block_command1(int);
101
102// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000103/// \brief \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000104int test_block_command2(int);
105
106// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
107/// \brief
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000108/// \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000109int test_block_command3(int);
110
111// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
112/// \brief
113///
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000114/// \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000115int test_block_command4(int);
116
117// There is trailing whitespace on one of the following lines, don't remove it!
118// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
119/// \brief
120///
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000121/// \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000122int test_block_command5(int);
123
Dmitri Gribenko858e69f2012-07-19 00:01:56 +0000124/// \brief \c Aaa
125int test_block_command6(int);
126
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000127// expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\brief' here}}
128/// \brief Aaa
129///
130/// Bbb
131///
132/// \brief Ccc
133int test_duplicate_brief1(int);
134
135// expected-warning@+5 {{duplicated command '\short'}} expected-note@+1 {{previous command '\short' here}}
136/// \short Aaa
137///
138/// Bbb
139///
140/// \short Ccc
141int test_duplicate_brief2(int);
142
143// expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\short' (an alias of '\brief') here}}
144/// \short Aaa
145///
146/// Bbb
147///
148/// \brief Ccc
149int test_duplicate_brief3(int);
150
151
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000152/// \return Aaa
153///
154/// Bbb
155///
156/// \return Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000157int test_multiple_returns1(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000158
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000159/// \returns Aaa
160///
161/// Bbb
162///
163/// \returns Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000164int test_multiple_returns2(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000165
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000166/// \result Aaa
167///
168/// Bbb
169///
170/// \result Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000171int test_multiple_returns3(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000172
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000173/// \returns Aaa
174///
175/// Bbb
176///
177/// \return Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000178int test_multiple_returns4(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000179
180
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000181// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
182/// \param a Blah blah.
Stephen Hines651f13c2014-04-23 16:59:28 -0700183int test_param1_backslash;
184
185// rdar://13066276
186// Check that the diagnostic uses the same command marker as the comment.
187// expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
188/// @param a Blah blah.
189int test_param1_at;
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000190
191// expected-warning@+1 {{empty paragraph passed to '\param' command}}
192/// \param
193/// \param a Blah blah.
194int test_param2(int a);
195
196// expected-warning@+1 {{empty paragraph passed to '\param' command}}
197/// \param a
198int test_param3(int a);
199
200/// \param a Blah blah.
201int test_param4(int a);
202
203/// \param [in] a Blah blah.
204int test_param5(int a);
205
206/// \param [out] a Blah blah.
207int test_param6(int a);
208
209/// \param [in,out] a Blah blah.
210int test_param7(int a);
211
212// expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
213/// \param [ in ] a Blah blah.
214int test_param8(int a);
215
216// expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
217/// \param [in, out] a Blah blah.
218int test_param9(int a);
219
220// expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}}
221/// \param [ junk] a Blah blah.
222int test_param10(int a);
223
Dmitri Gribenko2e721042012-07-24 21:56:59 +0000224// expected-warning@+1 {{parameter 'a' not found in the function declaration}}
Dmitri Gribenko56bf6fd2012-07-24 21:46:24 +0000225/// \param a Blah blah.
226int test_param11();
227
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000228// expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
229/// \param A Blah blah.
Dmitri Gribenko56bf6fd2012-07-24 21:46:24 +0000230int test_param12(int a);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000231
232// expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
233/// \param aab Blah blah.
Dmitri Gribenko56bf6fd2012-07-24 21:46:24 +0000234int test_param13(int aaa, int bbb);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000235
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000236// expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}}
237/// \param aaa Blah blah.
238/// \param aab Blah blah.
239int test_param14(int aaa, int bbb);
240
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000241// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
242/// \param aab Blah blah.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000243int test_param15(int bbb, int ccc);
244
245// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
246/// \param aab Ccc.
247/// \param aaa Aaa.
248/// \param bbb Bbb.
249int test_param16(int aaa, int bbb);
250
251// expected-warning@+2 {{parameter 'aab' not found in the function declaration}}
252/// \param aaa Aaa.
253/// \param aab Ccc.
254/// \param bbb Bbb.
255int test_param17(int aaa, int bbb);
256
257// expected-warning@+3 {{parameter 'aab' not found in the function declaration}}
258/// \param aaa Aaa.
259/// \param bbb Bbb.
260/// \param aab Ccc.
261int test_param18(int aaa, int bbb);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000262
263class C {
264 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
265 /// \param aaa Blah blah.
266 C(int bbb, int ccc);
267
268 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
269 /// \param aaa Blah blah.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000270 int test_param19(int bbb, int ccc);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000271};
272
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000273// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
274/// \param aab Blah blah.
275template<typename T>
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000276void test_param20(int bbb, int ccc);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000277
Dmitri Gribenko65822772012-07-24 21:44:16 +0000278// expected-warning@+3 {{parameter 'a' is already documented}}
279// expected-note@+1 {{previous documentation}}
280/// \param a Aaa.
281/// \param a Aaa.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000282int test_param21(int a);
Dmitri Gribenko65822772012-07-24 21:44:16 +0000283
284// expected-warning@+4 {{parameter 'x2' is already documented}}
285// expected-note@+2 {{previous documentation}}
286/// \param x1 Aaa.
287/// \param x2 Bbb.
288/// \param x2 Ccc.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000289int test_param22(int x1, int x2, int x3);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000290
Stephen Hines651f13c2014-04-23 16:59:28 -0700291//===---
292// Test that we treat typedefs to some non-function types as functions for the
293// purposes of documentation comment parsing.
294//===---
295
296namespace foo {
297 inline namespace bar {
298 template<typename>
299 struct function_wrapper {};
300
301 template<unsigned>
302 struct not_a_function_wrapper {};
303 }
304};
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000305
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000306// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000307/// \param aaa Meow.
308/// \param bbb Bbb.
309/// \returns aaa.
Stephen Hines651f13c2014-04-23 16:59:28 -0700310typedef int test_function_like_typedef1(int aaa, int ccc);
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000311
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000312// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000313/// \param aaa Meow.
314/// \param bbb Bbb.
315/// \returns aaa.
Stephen Hines651f13c2014-04-23 16:59:28 -0700316typedef int (*test_function_like_typedef2)(int aaa, int ccc);
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000317
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000318// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000319/// \param aaa Meow.
320/// \param bbb Bbb.
321/// \returns aaa.
Stephen Hines651f13c2014-04-23 16:59:28 -0700322typedef int (* const test_function_like_typedef3)(int aaa, int ccc);
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000323
Stephen Hines651f13c2014-04-23 16:59:28 -0700324// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
325/// \param aaa Meow.
326/// \param bbb Bbb.
327/// \returns aaa.
328typedef int (C::*test_function_like_typedef4)(int aaa, int ccc);
329
330// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
331/// \param aaa Meow.
332/// \param bbb Bbb.
333/// \returns aaa.
334typedef foo::function_wrapper<int (int aaa, int ccc)> test_function_like_typedef5;
335
336// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
337/// \param aaa Meow.
338/// \param bbb Bbb.
339/// \returns aaa.
340typedef foo::function_wrapper<int (int aaa, int ccc)> *test_function_like_typedef6;
341
342// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
343/// \param aaa Meow.
344/// \param bbb Bbb.
345/// \returns aaa.
346typedef foo::function_wrapper<int (int aaa, int ccc)> &test_function_like_typedef7;
347
348// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
349/// \param aaa Meow.
350/// \param bbb Bbb.
351/// \returns aaa.
352typedef foo::function_wrapper<int (int aaa, int ccc)> &&test_function_like_typedef8;
353
354
355typedef int (*test_not_function_like_typedef1)(int aaa);
Dmitri Gribenkoec504e02012-09-15 21:13:36 +0000356
357// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
358/// \param aaa Meow.
Stephen Hines651f13c2014-04-23 16:59:28 -0700359typedef test_not_function_like_typedef1 test_not_function_like_typedef2;
Dmitri Gribenkoec504e02012-09-15 21:13:36 +0000360
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000361// rdar://13066276
Stephen Hines651f13c2014-04-23 16:59:28 -0700362// Check that the diagnostic uses the same command marker as the comment.
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000363// expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
364/// @param aaa Meow.
Stephen Hines651f13c2014-04-23 16:59:28 -0700365typedef unsigned int test_not_function_like_typedef3;
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000366
Stephen Hines651f13c2014-04-23 16:59:28 -0700367// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
368/// \param aaa Meow.
369typedef foo::not_a_function_wrapper<1> test_not_function_like_typedef4;
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000370
Dmitri Gribenkoc5b00542013-06-24 04:41:32 +0000371/// \param aaa Aaa
372/// \param ... Vararg
373int test_vararg_param1(int aaa, ...);
374
375/// \param ... Vararg
376int test_vararg_param2(...);
377
378// expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
379/// \param ... Vararg
380int test_vararg_param3(int aaa);
381
382// expected-warning@+1 {{parameter '...' not found in the function declaration}}
383/// \param ... Vararg
384int test_vararg_param4();
385
386
Stephen Hines651f13c2014-04-23 16:59:28 -0700387/// \param aaa Aaa
388/// \param ... Vararg
389template<typename T>
390int test_template_vararg_param1(int aaa, ...);
391
392/// \param ... Vararg
393template<typename T>
394int test_template_vararg_param2(...);
395
396// expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
397/// \param ... Vararg
398template<typename T>
399int test_template_vararg_param3(int aaa);
400
401// expected-warning@+1 {{parameter '...' not found in the function declaration}}
402/// \param ... Vararg
403template<typename T>
404int test_template_vararg_param4();
405
406
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000407// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
408/// \tparam T Aaa
409int test_tparam1;
410
411// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
412/// \tparam T Aaa
413void test_tparam2(int aaa);
414
415// expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
416/// \tparam
417/// \param aaa Blah blah
418template<typename T>
419void test_tparam3(T aaa);
420
421// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
422/// \tparam T Aaa
423template<typename TT>
424void test_tparam4(TT aaa);
425
426// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
427/// \tparam T Aaa
428template<typename TT>
429class test_tparam5 {
430 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
431 /// \tparam T Aaa
432 template<typename TTT>
433 void test_tparam6(TTT aaa);
434};
435
436/// \tparam T1 Aaa
437/// \tparam T2 Bbb
438template<typename T1, typename T2>
439void test_tparam7(T1 aaa, T2 bbb);
440
441// expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
442/// \tparam SomTy Aaa
443/// \tparam OtherTy Bbb
444template<typename SomeTy, typename OtherTy>
445void test_tparam8(SomeTy aaa, OtherTy bbb);
446
447// expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
448/// \tparam T1 Aaa
449/// \tparam T1 Bbb
450template<typename T1, typename T2>
451void test_tparam9(T1 aaa, T2 bbb);
452
453/// \tparam T Aaa
454/// \tparam TT Bbb
455template<template<typename T> class TT>
456void test_tparam10(TT<int> aaa);
457
458/// \tparam T Aaa
459/// \tparam TT Bbb
460/// \tparam TTT Ccc
461template<template<template<typename T> class TT, class C> class TTT>
462void test_tparam11();
463
464/// \tparam I Aaa
465template<int I>
466void test_tparam12();
467
Dmitri Gribenko967e5d72012-08-02 21:36:57 +0000468template<typename T, typename U>
469class test_tparam13 { };
470
471/// \tparam T Aaa
472template<typename T>
473using test_tparam14 = test_tparam13<T, int>;
474
475// expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
476/// \tparam U Aaa
477template<typename T>
478using test_tparam15 = test_tparam13<T, int>;
479
Dmitri Gribenkod1e5c0d2013-01-27 21:18:39 +0000480// ----
481
482/// \tparam T Aaa
483template<typename T>
484class test_tparam16 { };
485
486typedef test_tparam16<int> test_tparam17;
487typedef test_tparam16<double> test_tparam18;
488
489// ----
490
491template<typename T>
492class test_tparam19;
493
494typedef test_tparam19<int> test_tparam20;
495typedef test_tparam19<double> test_tparam21;
496
497/// \tparam T Aaa
498template<typename T>
499class test_tparam19 { };
500
501// ----
502
Dmitri Gribenko8cc9c9d2013-03-04 20:23:16 +0000503// expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
504/// @tparam T Aaa
505int test_tparam22;
506
507// ----
508
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000509
510/// Aaa
511/// \deprecated Bbb
Dmitri Gribenko0bd98382012-09-22 21:47:50 +0000512void test_deprecated_1(int a) __attribute__((deprecated));
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000513
514// We don't want \deprecated to warn about empty paragraph. It is fine to use
515// \deprecated by itself without explanations.
516
517/// Aaa
518/// \deprecated
Dmitri Gribenko0bd98382012-09-22 21:47:50 +0000519void test_deprecated_2(int a) __attribute__((deprecated));
520
521/// Aaa
522/// \deprecated
523void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
524
525/// Aaa
526/// \deprecated
527void test_deprecated_4(int a) __attribute__((unavailable));
528
529// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+3 {{add a deprecation attribute to the declaration to silence this warning}}
530/// Aaa
531/// \deprecated
532void test_deprecated_5(int a);
533
534// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+3 {{add a deprecation attribute to the declaration to silence this warning}}
535/// Aaa
536/// \deprecated
537void test_deprecated_6(int a) {
538}
539
540// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
541/// Aaa
542/// \deprecated
543template<typename T>
544void test_deprecated_7(T aaa);
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000545
546
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000547// rdar://12397511
548// expected-note@+2 {{previous command '\headerfile' here}}
549// expected-warning@+2 {{duplicated command '\headerfile'}}
550/// \headerfile ""
551/// \headerfile foo.h
552int test__headerfile_1(int a);
553
554
Dmitri Gribenko388a5942012-09-14 15:37:29 +0000555/// \invariant aaa
556void test_invariant_1(int a);
557
558// expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
559/// \invariant
560void test_invariant_2(int a);
561
562
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000563// no-warning
564/// \returns Aaa
565int test_returns_right_decl_1(int);
566
567class test_returns_right_decl_2 {
568 // no-warning
569 /// \returns Aaa
570 int test_returns_right_decl_3(int);
571};
572
573// no-warning
574/// \returns Aaa
575template<typename T>
576int test_returns_right_decl_4(T aaa);
577
578// no-warning
579/// \returns Aaa
580template<>
581int test_returns_right_decl_4(int aaa);
582
583/// \returns Aaa
584template<typename T>
585T test_returns_right_decl_5(T aaa);
586
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000587// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000588/// \returns Aaa
Stephen Hines651f13c2014-04-23 16:59:28 -0700589int test_returns_wrong_decl_1_backslash;
590
591// rdar://13066276
592// Check that the diagnostic uses the same command marker as the comment.
593// expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
594/// @returns Aaa
595int test_returns_wrong_decl_1_at;
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000596
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000597// expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000598/// \return Aaa
599int test_returns_wrong_decl_2;
600
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000601// expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000602/// \result Aaa
603int test_returns_wrong_decl_3;
604
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000605// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000606/// \returns Aaa
607void test_returns_wrong_decl_4(int);
608
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000609// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000610/// \returns Aaa
611template<typename T>
612void test_returns_wrong_decl_5(T aaa);
613
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000614// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000615/// \returns Aaa
616template<>
617void test_returns_wrong_decl_5(int aaa);
618
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000619// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000620/// \returns Aaa
621struct test_returns_wrong_decl_6 { };
622
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000623// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000624/// \returns Aaa
625class test_returns_wrong_decl_7 {
626 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
627 /// \returns Aaa
628 test_returns_wrong_decl_7();
629
630 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
631 /// \returns Aaa
632 ~test_returns_wrong_decl_7();
633};
634
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000635// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000636/// \returns Aaa
637enum test_returns_wrong_decl_8 {
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000638 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000639 /// \returns Aaa
640 test_returns_wrong_decl_9
641};
642
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000643// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000644/// \returns Aaa
645namespace test_returns_wrong_decl_10 { };
646
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000647// rdar://13094352
Fariborz Jahanian99a70572013-03-05 22:46:07 +0000648// expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000649/*! @function test_function
650*/
651typedef unsigned int Base64Flags;
652unsigned test_function(Base64Flags inFlags);
653
Fariborz Jahanian99a70572013-03-05 22:46:07 +0000654// expected-warning@+1 {{'@callback' command should be used in a comment attached to a pointer to function declaration}}
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000655/*! @callback test_callback
656*/
657typedef unsigned int BaseFlags;
658unsigned (*test_callback)(BaseFlags inFlags);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000659
Dmitri Gribenko36cbbe92012-11-18 00:30:31 +0000660// expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
661/// \endverbatim
662int test_verbatim_1();
663
664// expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
665/// \endcode
666int test_verbatim_2();
667
668// FIXME: we give a bad diagnostic here because we throw away non-documentation
669// comments early.
670//
NAKAMURA Takumibf823c02012-11-18 02:34:33 +0000671// expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
Dmitri Gribenko36cbbe92012-11-18 00:30:31 +0000672/// \code
673// foo
674/// \endcode
675int test_verbatim_3();
676
677
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000678// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000679int test1; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000680
681// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
682// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000683int test2, ///< \brief\author Aaa
684 test3; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000685
686// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
687int test4; ///< \brief
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000688 ///< \author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000689
690
Dmitri Gribenko6969e432013-06-23 23:33:14 +0000691class TestRelates {};
692
693/// \relates TestRelates
694/// \brief Aaa
695void test_relates_1();
696
697/// \related TestRelates
698/// \brief Aaa
699void test_relates_2();
700
701/// \relatesalso TestRelates
702/// \brief Aaa
703void test_relates_3();
704
705/// \relatedalso TestRelates
706/// \brief Aaa
707void test_relates_4();
708
709
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000710// Check that we attach the comment to the declaration during parsing in the
711// following cases. The test is based on the fact that we don't parse
712// documentation comments that are not attached to anything.
713
714// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000715/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000716int test_attach1;
717
718// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000719/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000720int test_attach2(int);
721
722// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000723/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000724struct test_attach3 {
725 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000726 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000727 int test_attach4;
728
729 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000730 int test_attach5; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000731
732 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000733 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000734 int test_attach6(int);
735};
736
737// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000738/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000739class test_attach7 {
740 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000741 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000742 int test_attach8;
743
744 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000745 int test_attach9; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000746
747 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000748 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000749 int test_attach10(int);
750};
751
752// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000753/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000754enum test_attach9 {
755 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000756 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000757 test_attach10,
758
759 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000760 test_attach11 ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000761};
762
763// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000764/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000765struct test_noattach12 *test_attach13;
766
767// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000768/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000769typedef struct test_noattach14 *test_attach15;
770
771// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000772/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000773typedef struct test_attach16 { int a; } test_attach17;
774
775struct S { int a; };
776
777// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000778/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000779struct S *test_attach18;
780
781// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000782/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000783typedef struct S *test_attach19;
784
785// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000786/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000787struct test_attach20;
788
789// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000790/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000791typedef struct test_attach21 {
792 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000793 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000794 int test_attach22;
795} test_attach23;
796
797// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000798/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000799namespace test_attach24 {
800 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000801 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000802 namespace test_attach25 {
803 }
804}
805
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000806// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000807/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000808/// \tparam T Aaa
809template<typename T>
810void test_attach26(T aaa);
811
812// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000813/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000814/// \tparam T Aaa
815template<typename T, typename U>
816void test_attach27(T aaa, U bbb);
817
818// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
819// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000820/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000821/// \tparam T Aaa
822template<>
823void test_attach27(int aaa, int bbb);
824
825// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000826/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000827/// \tparam T Aaa
828template<typename T>
829class test_attach28 {
830 T aaa;
831};
832
833// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000834/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000835using test_attach29 = test_attach28<int>;
836
837// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000838/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000839/// \tparam T Aaa
840template<typename T, typename U>
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000841class test_attach30 { };
842
843// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000844/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000845/// \tparam T Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000846template<typename T>
847class test_attach30<T, int> { };
848
849// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000850/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000851template<>
852class test_attach30<int, int> { };
853
854// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000855/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000856template<typename T>
857using test_attach31 = test_attach30<T, int>;
858
859// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000860/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000861/// \tparam T Aaa
862template<typename T, typename U, typename V>
863class test_attach32 { };
864
865// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000866/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000867/// \tparam T Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000868template<typename T, typename U>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000869class test_attach32<T, U, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000870
871// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000872/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000873/// \tparam T Aaa
874template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000875class test_attach32<T, int, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000876
877// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
878// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000879/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000880/// \tparam T Aaa
881template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000882class test_attach32<int, int, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000883
884// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000885/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000886class test_attach33 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000887 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000888 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000889 /// \tparam T Aaa
890 template<typename T, typename U>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000891 void test_attach34(T aaa, U bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000892};
893
894template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000895class test_attach35 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000896 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
897 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000898 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000899 /// \tparam T Aaa
900 template<typename TT, typename UU>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000901 void test_attach36(TT aaa, UU bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000902};
903
904// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
905// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000906/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000907/// \tparam T Aaa
908template<> template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000909void test_attach35<int>::test_attach36(int aaa, int bbb) {}
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000910
911template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000912class test_attach37 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000913 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
914 // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000915 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000916 /// \tparam T Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000917 void test_attach38(int aaa, int bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000918
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000919 void test_attach39(int aaa, int bbb);
920};
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000921
922// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
923// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000924/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000925/// \tparam T Aaa
926template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000927void test_attach37<int>::test_attach38(int aaa, int bbb) {}
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000928
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000929// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
930/// \brief\author Aaa
931/// \tparam T Aaa
932template<typename T>
933void test_attach37<T>::test_attach39(int aaa, int bbb) {}
934
Dmitri Gribenko1599eac2012-08-16 18:19:43 +0000935// We used to emit warning that parameter 'a' is not found because we parsed
936// the comment in context of the redeclaration which does not have parameter
937// names.
938template <typename T>
939struct test_attach38 {
940 /*!
941 \param a First param
942 \param b Second param
943 */
944 template <typename B>
945 void test_attach39(T a, B b);
946};
947
948template <>
949template <typename B>
950void test_attach38<int>::test_attach39(int, B);
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000951
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000952
Dmitri Gribenko9f08f492012-07-20 20:18:53 +0000953// PR13411, reduced. We used to crash on this.
954/**
955 * @code Aaa.
956 */
957void test_nocrash1(int);
958
Dmitri Gribenkoe5deb792012-07-30 18:05:28 +0000959// We used to crash on this.
960// expected-warning@+2 {{empty paragraph passed to '\param' command}}
961// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
962/// \param\brief
963void test_nocrash2(int);
964
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000965// PR13593, example 1 and 2
Douglas Gregorcd81df22012-08-13 16:37:30 +0000966
967/**
968* Bla.
969*/
970template <typename>
971void test_nocrash3();
972
973/// Foo
974template <typename, typename>
975void test_nocrash4() { }
976
977template <typename>
978void test_nocrash3()
979{
980}
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000981
982// PR13593, example 3
983
984/**
985 * aaa
986 */
987template <typename T>
988inline T test_nocrash5(T a1)
989{
990 return a1;
991}
992
993///
994//,
995
996inline void test_nocrash6()
997{
998 test_nocrash5(1);
999}
1000
1001// We used to crash on this.
1002
1003/*!
1004 Blah.
1005*/
1006typedef const struct test_nocrash7 * test_nocrash8;
1007
Dmitri Gribenkob0b8a962012-09-11 19:22:03 +00001008// We used to crash on this.
1009
Fariborz Jahanianad6fd9f2013-05-03 23:15:20 +00001010// expected-warning@+1 {{unknown command tag name}}
Dmitri Gribenkob0b8a962012-09-11 19:22:03 +00001011/// aaa \unknown aaa \unknown aaa
1012int test_nocrash9;
1013
Dmitri Gribenko10442562013-01-26 00:36:14 +00001014// We used to crash on this. PR15068
1015
Fariborz Jahanianc98e9132013-03-01 22:51:30 +00001016// expected-warning@+2 {{empty paragraph passed to '@param' command}}
1017// expected-warning@+2 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko10442562013-01-26 00:36:14 +00001018///@param x
1019///@param y
1020int test_nocrash10(int x, int y);
1021
Fariborz Jahanianc98e9132013-03-01 22:51:30 +00001022// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
1023// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}}
Dmitri Gribenko10442562013-01-26 00:36:14 +00001024///@param x
1025///@param y
1026int test_nocrash11();
1027
Fariborz Jahanianc98e9132013-03-01 22:51:30 +00001028// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
1029// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}}
Dmitri Gribenko10442562013-01-26 00:36:14 +00001030/**
1031@param x
1032@param y
1033**/
1034int test_nocrash12();
1035
Fariborz Jahanianc98e9132013-03-01 22:51:30 +00001036// expected-warning@+2 {{empty paragraph passed to '@param' command}}
1037// expected-warning@+1 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko10442562013-01-26 00:36:14 +00001038///@param x@param y
1039int test_nocrash13(int x, int y);
Fariborz Jahanian28c1cd22013-03-07 23:33:11 +00001040
Pirama Arumuga Nainar58878f82015-05-06 11:48:57 -07001041/**
1042 * \verbatim
1043 * Aaa
1044 **/
1045int test_nocrash14();
1046
Fariborz Jahanian28c1cd22013-03-07 23:33:11 +00001047// rdar://12379114
1048// expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
1049/*!
1050 @union U This is new
1051*/
1052struct U { int iS; };
1053
1054/*!
1055 @union U1
1056*/
1057union U1 {int i; };
1058
1059// expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
1060/*!
1061 @struct S2
1062*/
1063union S2 {};
1064
1065/*!
1066 @class C1
1067*/
1068class C1;
1069
1070/*!
1071 @struct S3;
1072*/
1073class S3;
Fariborz Jahanian2d588b42013-06-19 18:08:03 +00001074
1075// rdar://14124702
1076//----------------------------------------------------------------------
1077/// @class Predicate Predicate.h "lldb/Host/Predicate.h"
1078/// @brief A C++ wrapper class for providing threaded access to a value
1079/// of type T.
1080///
1081/// A templatized class.
1082/// specified values.
1083//----------------------------------------------------------------------
1084template <class T, class T1>
1085class Predicate
1086{
1087};
1088
1089//----------------------------------------------------------------------
1090/// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
1091/// @brief A C++ wrapper class for providing threaded access to a value
1092/// of type T.
1093///
1094/// A template specilization class.
1095//----------------------------------------------------------------------
1096template<> class Predicate<int, char>
1097{
1098};
1099
1100//----------------------------------------------------------------------
1101/// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
1102/// @brief A C++ wrapper class for providing threaded access to a value
1103/// of type T.
1104///
1105/// A partial specialization template class.
1106//----------------------------------------------------------------------
1107template<class T> class Predicate<T, int>
1108{
1109};
1110
1111/*! @function test_function
1112*/
1113template <class T> T test_function (T arg);
1114
1115/*! @function test_function<int>
1116*/
1117template <> int test_function<int> (int arg);