blob: ed25d949f5594b3bad4b2d8be42b576c4a96f7d5 [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
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +00007// expected-warning@+1 {{expected quoted string after equals sign}}
8/// <a href=>
9int test_html1(int);
10
11// expected-warning@+1 {{expected quoted string after equals sign}}
12/// <a href==>
13int test_html2(int);
14
15// expected-warning@+2 {{expected quoted string after equals sign}}
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000016// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000017/// <a href= blah
18int test_html3(int);
19
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000020// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000021/// <a =>
22int test_html4(int);
23
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 "aaa">
26int test_html5(int);
27
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000028// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000029/// <a a="b" =>
30int test_html6(int);
31
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000032// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000033/// <a a="b" "aaa">
34int test_html7(int);
35
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000036// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000037/// <a a="b" =
38int test_html8(int);
39
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000040// 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 +000041/** Aaa bbb<img ddd eee
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000042 * fff ggg.
43 */
44int test_html9(int);
45
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000046// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenko834a5bd2012-08-22 22:56:08 +000047/** Aaa bbb<img ddd eee 42%
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000048 * fff ggg.
49 */
50int test_html10(int);
51
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000052// expected-warning@+1 {{HTML end tag 'br' is forbidden}}
Dmitri Gribenko3d986982012-07-12 23:37:09 +000053/// <br></br>
54int test_html11(int);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000055
56/// <blockquote>Meow</blockquote>
57int test_html_nesting1(int);
58
59/// <b><i>Meow</i></b>
60int test_html_nesting2(int);
61
62/// <p>Aaa<br>
63/// Bbb</p>
64int test_html_nesting3(int);
65
66/// <p>Aaa<br />
67/// Bbb</p>
68int test_html_nesting4(int);
69
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000070// expected-warning@+1 {{HTML end tag does not match any start tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000071/// <b><i>Meow</a>
72int test_html_nesting5(int);
73
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000074// expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
75// expected-warning@+1 {{HTML end tag does not match any start tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000076/// <b><i>Meow</b></b>
77int test_html_nesting6(int);
78
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000079// expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
80// expected-warning@+1 {{HTML end tag does not match any start tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000081/// <b><i>Meow</b></i>
82int test_html_nesting7(int);
83
84
85// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000086/// \brief\returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000087int test_block_command1(int);
88
89// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000090/// \brief \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000091int test_block_command2(int);
92
93// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
94/// \brief
Dmitri Gribenko9443c572012-08-06 17:08:27 +000095/// \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000096int test_block_command3(int);
97
98// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
99/// \brief
100///
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000101/// \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000102int test_block_command4(int);
103
104// There is trailing whitespace on one of the following lines, don't remove it!
105// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
106/// \brief
107///
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000108/// \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000109int test_block_command5(int);
110
Dmitri Gribenko858e69f2012-07-19 00:01:56 +0000111/// \brief \c Aaa
112int test_block_command6(int);
113
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000114// expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\brief' here}}
115/// \brief Aaa
116///
117/// Bbb
118///
119/// \brief Ccc
120int test_duplicate_brief1(int);
121
122// expected-warning@+5 {{duplicated command '\short'}} expected-note@+1 {{previous command '\short' here}}
123/// \short Aaa
124///
125/// Bbb
126///
127/// \short Ccc
128int test_duplicate_brief2(int);
129
130// expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\short' (an alias of '\brief') here}}
131/// \short Aaa
132///
133/// Bbb
134///
135/// \brief Ccc
136int test_duplicate_brief3(int);
137
138
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000139/// \return Aaa
140///
141/// Bbb
142///
143/// \return Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000144int test_multiple_returns1(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000145
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000146/// \returns Aaa
147///
148/// Bbb
149///
150/// \returns Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000151int test_multiple_returns2(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000152
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000153/// \result Aaa
154///
155/// Bbb
156///
157/// \result Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000158int test_multiple_returns3(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000159
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000160/// \returns Aaa
161///
162/// Bbb
163///
164/// \return Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000165int test_multiple_returns4(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000166
167
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000168// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
169/// \param a Blah blah.
Stephen Hines651f13c2014-04-23 16:59:28 -0700170int test_param1_backslash;
171
172// rdar://13066276
173// Check that the diagnostic uses the same command marker as the comment.
174// expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
175/// @param a Blah blah.
176int test_param1_at;
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000177
178// expected-warning@+1 {{empty paragraph passed to '\param' command}}
179/// \param
180/// \param a Blah blah.
181int test_param2(int a);
182
183// expected-warning@+1 {{empty paragraph passed to '\param' command}}
184/// \param a
185int test_param3(int a);
186
187/// \param a Blah blah.
188int test_param4(int a);
189
190/// \param [in] a Blah blah.
191int test_param5(int a);
192
193/// \param [out] a Blah blah.
194int test_param6(int a);
195
196/// \param [in,out] a Blah blah.
197int test_param7(int a);
198
199// expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
200/// \param [ in ] a Blah blah.
201int test_param8(int a);
202
203// expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
204/// \param [in, out] a Blah blah.
205int test_param9(int a);
206
207// expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}}
208/// \param [ junk] a Blah blah.
209int test_param10(int a);
210
Dmitri Gribenko2e721042012-07-24 21:56:59 +0000211// expected-warning@+1 {{parameter 'a' not found in the function declaration}}
Dmitri Gribenko56bf6fd2012-07-24 21:46:24 +0000212/// \param a Blah blah.
213int test_param11();
214
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000215// expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
216/// \param A Blah blah.
Dmitri Gribenko56bf6fd2012-07-24 21:46:24 +0000217int test_param12(int a);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000218
219// expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
220/// \param aab Blah blah.
Dmitri Gribenko56bf6fd2012-07-24 21:46:24 +0000221int test_param13(int aaa, int bbb);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000222
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000223// expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}}
224/// \param aaa Blah blah.
225/// \param aab Blah blah.
226int test_param14(int aaa, int bbb);
227
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000228// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
229/// \param aab Blah blah.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000230int test_param15(int bbb, int ccc);
231
232// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
233/// \param aab Ccc.
234/// \param aaa Aaa.
235/// \param bbb Bbb.
236int test_param16(int aaa, int bbb);
237
238// expected-warning@+2 {{parameter 'aab' not found in the function declaration}}
239/// \param aaa Aaa.
240/// \param aab Ccc.
241/// \param bbb Bbb.
242int test_param17(int aaa, int bbb);
243
244// expected-warning@+3 {{parameter 'aab' not found in the function declaration}}
245/// \param aaa Aaa.
246/// \param bbb Bbb.
247/// \param aab Ccc.
248int test_param18(int aaa, int bbb);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000249
250class C {
251 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
252 /// \param aaa Blah blah.
253 C(int bbb, int ccc);
254
255 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
256 /// \param aaa Blah blah.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000257 int test_param19(int bbb, int ccc);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000258};
259
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000260// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
261/// \param aab Blah blah.
262template<typename T>
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000263void test_param20(int bbb, int ccc);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000264
Dmitri Gribenko65822772012-07-24 21:44:16 +0000265// expected-warning@+3 {{parameter 'a' is already documented}}
266// expected-note@+1 {{previous documentation}}
267/// \param a Aaa.
268/// \param a Aaa.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000269int test_param21(int a);
Dmitri Gribenko65822772012-07-24 21:44:16 +0000270
271// expected-warning@+4 {{parameter 'x2' is already documented}}
272// expected-note@+2 {{previous documentation}}
273/// \param x1 Aaa.
274/// \param x2 Bbb.
275/// \param x2 Ccc.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000276int test_param22(int x1, int x2, int x3);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000277
Stephen Hines651f13c2014-04-23 16:59:28 -0700278//===---
279// Test that we treat typedefs to some non-function types as functions for the
280// purposes of documentation comment parsing.
281//===---
282
283namespace foo {
284 inline namespace bar {
285 template<typename>
286 struct function_wrapper {};
287
288 template<unsigned>
289 struct not_a_function_wrapper {};
290 }
291};
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000292
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000293// 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 +0000294/// \param aaa Meow.
295/// \param bbb Bbb.
296/// \returns aaa.
Stephen Hines651f13c2014-04-23 16:59:28 -0700297typedef int test_function_like_typedef1(int aaa, int ccc);
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000298
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000299// 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 +0000300/// \param aaa Meow.
301/// \param bbb Bbb.
302/// \returns aaa.
Stephen Hines651f13c2014-04-23 16:59:28 -0700303typedef int (*test_function_like_typedef2)(int aaa, int ccc);
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000304
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000305// 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 +0000306/// \param aaa Meow.
307/// \param bbb Bbb.
308/// \returns aaa.
Stephen Hines651f13c2014-04-23 16:59:28 -0700309typedef int (* const test_function_like_typedef3)(int aaa, int ccc);
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000310
Stephen Hines651f13c2014-04-23 16:59:28 -0700311// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
312/// \param aaa Meow.
313/// \param bbb Bbb.
314/// \returns aaa.
315typedef int (C::*test_function_like_typedef4)(int aaa, int ccc);
316
317// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
318/// \param aaa Meow.
319/// \param bbb Bbb.
320/// \returns aaa.
321typedef foo::function_wrapper<int (int aaa, int ccc)> test_function_like_typedef5;
322
323// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
324/// \param aaa Meow.
325/// \param bbb Bbb.
326/// \returns aaa.
327typedef foo::function_wrapper<int (int aaa, int ccc)> *test_function_like_typedef6;
328
329// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
330/// \param aaa Meow.
331/// \param bbb Bbb.
332/// \returns aaa.
333typedef foo::function_wrapper<int (int aaa, int ccc)> &test_function_like_typedef7;
334
335// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
336/// \param aaa Meow.
337/// \param bbb Bbb.
338/// \returns aaa.
339typedef foo::function_wrapper<int (int aaa, int ccc)> &&test_function_like_typedef8;
340
341
342typedef int (*test_not_function_like_typedef1)(int aaa);
Dmitri Gribenkoec504e02012-09-15 21:13:36 +0000343
344// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
345/// \param aaa Meow.
Stephen Hines651f13c2014-04-23 16:59:28 -0700346typedef test_not_function_like_typedef1 test_not_function_like_typedef2;
Dmitri Gribenkoec504e02012-09-15 21:13:36 +0000347
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000348// rdar://13066276
Stephen Hines651f13c2014-04-23 16:59:28 -0700349// Check that the diagnostic uses the same command marker as the comment.
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000350// expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
351/// @param aaa Meow.
Stephen Hines651f13c2014-04-23 16:59:28 -0700352typedef unsigned int test_not_function_like_typedef3;
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000353
Stephen Hines651f13c2014-04-23 16:59:28 -0700354// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
355/// \param aaa Meow.
356typedef foo::not_a_function_wrapper<1> test_not_function_like_typedef4;
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000357
Dmitri Gribenkoc5b00542013-06-24 04:41:32 +0000358/// \param aaa Aaa
359/// \param ... Vararg
360int test_vararg_param1(int aaa, ...);
361
362/// \param ... Vararg
363int test_vararg_param2(...);
364
365// expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
366/// \param ... Vararg
367int test_vararg_param3(int aaa);
368
369// expected-warning@+1 {{parameter '...' not found in the function declaration}}
370/// \param ... Vararg
371int test_vararg_param4();
372
373
Stephen Hines651f13c2014-04-23 16:59:28 -0700374/// \param aaa Aaa
375/// \param ... Vararg
376template<typename T>
377int test_template_vararg_param1(int aaa, ...);
378
379/// \param ... Vararg
380template<typename T>
381int test_template_vararg_param2(...);
382
383// expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
384/// \param ... Vararg
385template<typename T>
386int test_template_vararg_param3(int aaa);
387
388// expected-warning@+1 {{parameter '...' not found in the function declaration}}
389/// \param ... Vararg
390template<typename T>
391int test_template_vararg_param4();
392
393
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000394// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
395/// \tparam T Aaa
396int test_tparam1;
397
398// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
399/// \tparam T Aaa
400void test_tparam2(int aaa);
401
402// expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
403/// \tparam
404/// \param aaa Blah blah
405template<typename T>
406void test_tparam3(T aaa);
407
408// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
409/// \tparam T Aaa
410template<typename TT>
411void test_tparam4(TT aaa);
412
413// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
414/// \tparam T Aaa
415template<typename TT>
416class test_tparam5 {
417 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
418 /// \tparam T Aaa
419 template<typename TTT>
420 void test_tparam6(TTT aaa);
421};
422
423/// \tparam T1 Aaa
424/// \tparam T2 Bbb
425template<typename T1, typename T2>
426void test_tparam7(T1 aaa, T2 bbb);
427
428// expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
429/// \tparam SomTy Aaa
430/// \tparam OtherTy Bbb
431template<typename SomeTy, typename OtherTy>
432void test_tparam8(SomeTy aaa, OtherTy bbb);
433
434// expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
435/// \tparam T1 Aaa
436/// \tparam T1 Bbb
437template<typename T1, typename T2>
438void test_tparam9(T1 aaa, T2 bbb);
439
440/// \tparam T Aaa
441/// \tparam TT Bbb
442template<template<typename T> class TT>
443void test_tparam10(TT<int> aaa);
444
445/// \tparam T Aaa
446/// \tparam TT Bbb
447/// \tparam TTT Ccc
448template<template<template<typename T> class TT, class C> class TTT>
449void test_tparam11();
450
451/// \tparam I Aaa
452template<int I>
453void test_tparam12();
454
Dmitri Gribenko967e5d72012-08-02 21:36:57 +0000455template<typename T, typename U>
456class test_tparam13 { };
457
458/// \tparam T Aaa
459template<typename T>
460using test_tparam14 = test_tparam13<T, int>;
461
462// expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
463/// \tparam U Aaa
464template<typename T>
465using test_tparam15 = test_tparam13<T, int>;
466
Dmitri Gribenkod1e5c0d2013-01-27 21:18:39 +0000467// ----
468
469/// \tparam T Aaa
470template<typename T>
471class test_tparam16 { };
472
473typedef test_tparam16<int> test_tparam17;
474typedef test_tparam16<double> test_tparam18;
475
476// ----
477
478template<typename T>
479class test_tparam19;
480
481typedef test_tparam19<int> test_tparam20;
482typedef test_tparam19<double> test_tparam21;
483
484/// \tparam T Aaa
485template<typename T>
486class test_tparam19 { };
487
488// ----
489
Dmitri Gribenko8cc9c9d2013-03-04 20:23:16 +0000490// expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
491/// @tparam T Aaa
492int test_tparam22;
493
494// ----
495
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000496
497/// Aaa
498/// \deprecated Bbb
Dmitri Gribenko0bd98382012-09-22 21:47:50 +0000499void test_deprecated_1(int a) __attribute__((deprecated));
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000500
501// We don't want \deprecated to warn about empty paragraph. It is fine to use
502// \deprecated by itself without explanations.
503
504/// Aaa
505/// \deprecated
Dmitri Gribenko0bd98382012-09-22 21:47:50 +0000506void test_deprecated_2(int a) __attribute__((deprecated));
507
508/// Aaa
509/// \deprecated
510void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
511
512/// Aaa
513/// \deprecated
514void test_deprecated_4(int a) __attribute__((unavailable));
515
516// 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}}
517/// Aaa
518/// \deprecated
519void test_deprecated_5(int a);
520
521// 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}}
522/// Aaa
523/// \deprecated
524void test_deprecated_6(int a) {
525}
526
527// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
528/// Aaa
529/// \deprecated
530template<typename T>
531void test_deprecated_7(T aaa);
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000532
533
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000534// rdar://12397511
535// expected-note@+2 {{previous command '\headerfile' here}}
536// expected-warning@+2 {{duplicated command '\headerfile'}}
537/// \headerfile ""
538/// \headerfile foo.h
539int test__headerfile_1(int a);
540
541
Dmitri Gribenko388a5942012-09-14 15:37:29 +0000542/// \invariant aaa
543void test_invariant_1(int a);
544
545// expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
546/// \invariant
547void test_invariant_2(int a);
548
549
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000550// no-warning
551/// \returns Aaa
552int test_returns_right_decl_1(int);
553
554class test_returns_right_decl_2 {
555 // no-warning
556 /// \returns Aaa
557 int test_returns_right_decl_3(int);
558};
559
560// no-warning
561/// \returns Aaa
562template<typename T>
563int test_returns_right_decl_4(T aaa);
564
565// no-warning
566/// \returns Aaa
567template<>
568int test_returns_right_decl_4(int aaa);
569
570/// \returns Aaa
571template<typename T>
572T test_returns_right_decl_5(T aaa);
573
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000574// 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 +0000575/// \returns Aaa
Stephen Hines651f13c2014-04-23 16:59:28 -0700576int test_returns_wrong_decl_1_backslash;
577
578// rdar://13066276
579// Check that the diagnostic uses the same command marker as the comment.
580// expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
581/// @returns Aaa
582int test_returns_wrong_decl_1_at;
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000583
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000584// 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 +0000585/// \return Aaa
586int test_returns_wrong_decl_2;
587
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000588// 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 +0000589/// \result Aaa
590int test_returns_wrong_decl_3;
591
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000592// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000593/// \returns Aaa
594void test_returns_wrong_decl_4(int);
595
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000596// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000597/// \returns Aaa
598template<typename T>
599void test_returns_wrong_decl_5(T aaa);
600
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000601// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000602/// \returns Aaa
603template<>
604void test_returns_wrong_decl_5(int aaa);
605
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000606// 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 +0000607/// \returns Aaa
608struct test_returns_wrong_decl_6 { };
609
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000610// 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 +0000611/// \returns Aaa
612class test_returns_wrong_decl_7 {
613 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
614 /// \returns Aaa
615 test_returns_wrong_decl_7();
616
617 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
618 /// \returns Aaa
619 ~test_returns_wrong_decl_7();
620};
621
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000622// 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 +0000623/// \returns Aaa
624enum test_returns_wrong_decl_8 {
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000625 // 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 +0000626 /// \returns Aaa
627 test_returns_wrong_decl_9
628};
629
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000630// 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 +0000631/// \returns Aaa
632namespace test_returns_wrong_decl_10 { };
633
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000634// rdar://13094352
Fariborz Jahanian99a70572013-03-05 22:46:07 +0000635// expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000636/*! @function test_function
637*/
638typedef unsigned int Base64Flags;
639unsigned test_function(Base64Flags inFlags);
640
Fariborz Jahanian99a70572013-03-05 22:46:07 +0000641// 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 +0000642/*! @callback test_callback
643*/
644typedef unsigned int BaseFlags;
645unsigned (*test_callback)(BaseFlags inFlags);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000646
Dmitri Gribenko36cbbe92012-11-18 00:30:31 +0000647// expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
648/// \endverbatim
649int test_verbatim_1();
650
651// expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
652/// \endcode
653int test_verbatim_2();
654
655// FIXME: we give a bad diagnostic here because we throw away non-documentation
656// comments early.
657//
NAKAMURA Takumibf823c02012-11-18 02:34:33 +0000658// expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
Dmitri Gribenko36cbbe92012-11-18 00:30:31 +0000659/// \code
660// foo
661/// \endcode
662int test_verbatim_3();
663
664
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000665// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000666int test1; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000667
668// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
669// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000670int test2, ///< \brief\author Aaa
671 test3; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000672
673// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
674int test4; ///< \brief
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000675 ///< \author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000676
677
Dmitri Gribenko6969e432013-06-23 23:33:14 +0000678class TestRelates {};
679
680/// \relates TestRelates
681/// \brief Aaa
682void test_relates_1();
683
684/// \related TestRelates
685/// \brief Aaa
686void test_relates_2();
687
688/// \relatesalso TestRelates
689/// \brief Aaa
690void test_relates_3();
691
692/// \relatedalso TestRelates
693/// \brief Aaa
694void test_relates_4();
695
696
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000697// Check that we attach the comment to the declaration during parsing in the
698// following cases. The test is based on the fact that we don't parse
699// documentation comments that are not attached to anything.
700
701// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000702/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000703int test_attach1;
704
705// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000706/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000707int test_attach2(int);
708
709// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000710/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000711struct test_attach3 {
712 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000713 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000714 int test_attach4;
715
716 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000717 int test_attach5; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000718
719 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000720 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000721 int test_attach6(int);
722};
723
724// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000725/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000726class test_attach7 {
727 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000728 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000729 int test_attach8;
730
731 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000732 int test_attach9; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000733
734 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000735 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000736 int test_attach10(int);
737};
738
739// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000740/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000741enum test_attach9 {
742 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000743 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000744 test_attach10,
745
746 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000747 test_attach11 ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000748};
749
750// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000751/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000752struct test_noattach12 *test_attach13;
753
754// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000755/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000756typedef struct test_noattach14 *test_attach15;
757
758// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000759/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000760typedef struct test_attach16 { int a; } test_attach17;
761
762struct S { int a; };
763
764// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000765/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000766struct S *test_attach18;
767
768// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000769/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000770typedef struct S *test_attach19;
771
772// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000773/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000774struct test_attach20;
775
776// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000777/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000778typedef struct test_attach21 {
779 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000780 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000781 int test_attach22;
782} test_attach23;
783
784// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000785/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000786namespace test_attach24 {
787 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000788 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000789 namespace test_attach25 {
790 }
791}
792
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000793// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000794/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000795/// \tparam T Aaa
796template<typename T>
797void test_attach26(T aaa);
798
799// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000800/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000801/// \tparam T Aaa
802template<typename T, typename U>
803void test_attach27(T aaa, U bbb);
804
805// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
806// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000807/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000808/// \tparam T Aaa
809template<>
810void test_attach27(int aaa, int bbb);
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>
816class test_attach28 {
817 T aaa;
818};
819
820// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000821/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000822using test_attach29 = test_attach28<int>;
823
824// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000825/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000826/// \tparam T Aaa
827template<typename T, typename U>
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000828class test_attach30 { };
829
830// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000831/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000832/// \tparam T Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000833template<typename T>
834class test_attach30<T, int> { };
835
836// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000837/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000838template<>
839class test_attach30<int, int> { };
840
841// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000842/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000843template<typename T>
844using test_attach31 = test_attach30<T, int>;
845
846// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000847/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000848/// \tparam T Aaa
849template<typename T, typename U, typename V>
850class test_attach32 { };
851
852// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000853/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000854/// \tparam T Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000855template<typename T, typename U>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000856class test_attach32<T, U, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000857
858// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000859/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000860/// \tparam T Aaa
861template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000862class test_attach32<T, int, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000863
864// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
865// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000866/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000867/// \tparam T Aaa
868template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000869class test_attach32<int, int, 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 Gribenkoc27bc802012-08-02 20:49:51 +0000873class test_attach33 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000874 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000875 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000876 /// \tparam T Aaa
877 template<typename T, typename U>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000878 void test_attach34(T aaa, U bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000879};
880
881template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000882class test_attach35 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000883 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
884 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000885 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000886 /// \tparam T Aaa
887 template<typename TT, typename UU>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000888 void test_attach36(TT aaa, UU bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000889};
890
891// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
892// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000893/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000894/// \tparam T Aaa
895template<> template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000896void test_attach35<int>::test_attach36(int aaa, int bbb) {}
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000897
898template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000899class test_attach37 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000900 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
901 // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000902 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000903 /// \tparam T Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000904 void test_attach38(int aaa, int bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000905
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000906 void test_attach39(int aaa, int bbb);
907};
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000908
909// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
910// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000911/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000912/// \tparam T Aaa
913template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000914void test_attach37<int>::test_attach38(int aaa, int bbb) {}
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000915
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000916// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
917/// \brief\author Aaa
918/// \tparam T Aaa
919template<typename T>
920void test_attach37<T>::test_attach39(int aaa, int bbb) {}
921
Dmitri Gribenko1599eac2012-08-16 18:19:43 +0000922// We used to emit warning that parameter 'a' is not found because we parsed
923// the comment in context of the redeclaration which does not have parameter
924// names.
925template <typename T>
926struct test_attach38 {
927 /*!
928 \param a First param
929 \param b Second param
930 */
931 template <typename B>
932 void test_attach39(T a, B b);
933};
934
935template <>
936template <typename B>
937void test_attach38<int>::test_attach39(int, B);
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000938
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000939
Dmitri Gribenko9f08f492012-07-20 20:18:53 +0000940// PR13411, reduced. We used to crash on this.
941/**
942 * @code Aaa.
943 */
944void test_nocrash1(int);
945
Dmitri Gribenkoe5deb792012-07-30 18:05:28 +0000946// We used to crash on this.
947// expected-warning@+2 {{empty paragraph passed to '\param' command}}
948// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
949/// \param\brief
950void test_nocrash2(int);
951
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000952// PR13593, example 1 and 2
Douglas Gregorcd81df22012-08-13 16:37:30 +0000953
954/**
955* Bla.
956*/
957template <typename>
958void test_nocrash3();
959
960/// Foo
961template <typename, typename>
962void test_nocrash4() { }
963
964template <typename>
965void test_nocrash3()
966{
967}
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000968
969// PR13593, example 3
970
971/**
972 * aaa
973 */
974template <typename T>
975inline T test_nocrash5(T a1)
976{
977 return a1;
978}
979
980///
981//,
982
983inline void test_nocrash6()
984{
985 test_nocrash5(1);
986}
987
988// We used to crash on this.
989
990/*!
991 Blah.
992*/
993typedef const struct test_nocrash7 * test_nocrash8;
994
Dmitri Gribenkob0b8a962012-09-11 19:22:03 +0000995// We used to crash on this.
996
Fariborz Jahanianad6fd9f2013-05-03 23:15:20 +0000997// expected-warning@+1 {{unknown command tag name}}
Dmitri Gribenkob0b8a962012-09-11 19:22:03 +0000998/// aaa \unknown aaa \unknown aaa
999int test_nocrash9;
1000
Dmitri Gribenko10442562013-01-26 00:36:14 +00001001// We used to crash on this. PR15068
1002
Fariborz Jahanianc98e9132013-03-01 22:51:30 +00001003// expected-warning@+2 {{empty paragraph passed to '@param' command}}
1004// expected-warning@+2 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko10442562013-01-26 00:36:14 +00001005///@param x
1006///@param y
1007int test_nocrash10(int x, int y);
1008
Fariborz Jahanianc98e9132013-03-01 22:51:30 +00001009// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
1010// 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 +00001011///@param x
1012///@param y
1013int test_nocrash11();
1014
Fariborz Jahanianc98e9132013-03-01 22:51:30 +00001015// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
1016// 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 +00001017/**
1018@param x
1019@param y
1020**/
1021int test_nocrash12();
1022
Fariborz Jahanianc98e9132013-03-01 22:51:30 +00001023// expected-warning@+2 {{empty paragraph passed to '@param' command}}
1024// expected-warning@+1 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko10442562013-01-26 00:36:14 +00001025///@param x@param y
1026int test_nocrash13(int x, int y);
Fariborz Jahanian28c1cd22013-03-07 23:33:11 +00001027
1028// rdar://12379114
1029// expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
1030/*!
1031 @union U This is new
1032*/
1033struct U { int iS; };
1034
1035/*!
1036 @union U1
1037*/
1038union U1 {int i; };
1039
1040// expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
1041/*!
1042 @struct S2
1043*/
1044union S2 {};
1045
1046/*!
1047 @class C1
1048*/
1049class C1;
1050
1051/*!
1052 @struct S3;
1053*/
1054class S3;
Fariborz Jahanian2d588b42013-06-19 18:08:03 +00001055
1056// rdar://14124702
1057//----------------------------------------------------------------------
1058/// @class Predicate Predicate.h "lldb/Host/Predicate.h"
1059/// @brief A C++ wrapper class for providing threaded access to a value
1060/// of type T.
1061///
1062/// A templatized class.
1063/// specified values.
1064//----------------------------------------------------------------------
1065template <class T, class T1>
1066class Predicate
1067{
1068};
1069
1070//----------------------------------------------------------------------
1071/// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
1072/// @brief A C++ wrapper class for providing threaded access to a value
1073/// of type T.
1074///
1075/// A template specilization class.
1076//----------------------------------------------------------------------
1077template<> class Predicate<int, char>
1078{
1079};
1080
1081//----------------------------------------------------------------------
1082/// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
1083/// @brief A C++ wrapper class for providing threaded access to a value
1084/// of type T.
1085///
1086/// A partial specialization template class.
1087//----------------------------------------------------------------------
1088template<class T> class Predicate<T, int>
1089{
1090};
1091
1092/*! @function test_function
1093*/
1094template <class T> T test_function (T arg);
1095
1096/*! @function test_function<int>
1097*/
1098template <> int test_function<int> (int arg);