blob: ad7ab181a78a8ee98bc0fcb53c69020d86fb1997 [file] [log] [blame]
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s
Dmitri Gribenkof26054f2012-07-11 21:38:39 +00002
Dmitri Gribenko740c0fb2012-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 Gribenkof26054f2012-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 Gribenkoe00ffc72012-07-13 00:44:24 +000016// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000017/// <a href= blah
18int test_html3(int);
19
Dmitri Gribenkoe00ffc72012-07-13 00:44:24 +000020// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000021/// <a =>
22int test_html4(int);
23
Dmitri Gribenkoe00ffc72012-07-13 00:44:24 +000024// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000025/// <a "aaa">
26int test_html5(int);
27
Dmitri Gribenkoe00ffc72012-07-13 00:44:24 +000028// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000029/// <a a="b" =>
30int test_html6(int);
31
Dmitri Gribenkoe00ffc72012-07-13 00:44:24 +000032// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000033/// <a a="b" "aaa">
34int test_html7(int);
35
Dmitri Gribenkoe00ffc72012-07-13 00:44:24 +000036// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000037/// <a a="b" =
38int test_html8(int);
39
Dmitri Gribenkoe00ffc72012-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 Gribenko107618a2012-08-22 22:56:08 +000041/** Aaa bbb<img ddd eee
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000042 * fff ggg.
43 */
44int test_html9(int);
45
Dmitri Gribenkoe00ffc72012-07-13 00:44:24 +000046// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenko107618a2012-08-22 22:56:08 +000047/** Aaa bbb<img ddd eee 42%
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000048 * fff ggg.
49 */
50int test_html10(int);
51
Dmitri Gribenkoe00ffc72012-07-13 00:44:24 +000052// expected-warning@+1 {{HTML end tag 'br' is forbidden}}
Dmitri Gribenko9460fbf2012-07-12 23:37:09 +000053/// <br></br>
54int test_html11(int);
Dmitri Gribenkof26054f2012-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 Gribenkoe00ffc72012-07-13 00:44:24 +000070// expected-warning@+1 {{HTML end tag does not match any start tag}}
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000071/// <b><i>Meow</a>
72int test_html_nesting5(int);
73
Dmitri Gribenkoe00ffc72012-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 Gribenkof26054f2012-07-11 21:38:39 +000076/// <b><i>Meow</b></b>
77int test_html_nesting6(int);
78
Dmitri Gribenkoe00ffc72012-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 Gribenkof26054f2012-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 Gribenko5ec0c752012-08-06 17:08:27 +000086/// \brief\returns Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000087int test_block_command1(int);
88
89// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +000090/// \brief \returns Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +000091int test_block_command2(int);
92
93// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
94/// \brief
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +000095/// \returns Aaa
Dmitri Gribenkof26054f2012-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 Gribenko5ec0c752012-08-06 17:08:27 +0000101/// \returns Aaa
Dmitri Gribenkof26054f2012-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 Gribenko5ec0c752012-08-06 17:08:27 +0000108/// \returns Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000109int test_block_command5(int);
110
Dmitri Gribenko7b2ca3e2012-07-19 00:01:56 +0000111/// \brief \c Aaa
112int test_block_command6(int);
113
Dmitri Gribenko5ec0c752012-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 Gribenko5ec0c752012-08-06 17:08:27 +0000139/// \return Aaa
140///
141/// Bbb
142///
143/// \return Ccc
Dmitri Gribenkod6662932013-06-22 23:03:37 +0000144int test_multiple_returns1(int);
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000145
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000146/// \returns Aaa
147///
148/// Bbb
149///
150/// \returns Ccc
Dmitri Gribenkod6662932013-06-22 23:03:37 +0000151int test_multiple_returns2(int);
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000152
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000153/// \result Aaa
154///
155/// Bbb
156///
157/// \result Ccc
Dmitri Gribenkod6662932013-06-22 23:03:37 +0000158int test_multiple_returns3(int);
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000159
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000160/// \returns Aaa
161///
162/// Bbb
163///
164/// \return Ccc
Dmitri Gribenkod6662932013-06-22 23:03:37 +0000165int test_multiple_returns4(int);
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000166
167
Dmitri Gribenkof26054f2012-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.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000170int 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 Gribenkof26054f2012-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 Gribenko3c541282012-07-24 21:56:59 +0000211// expected-warning@+1 {{parameter 'a' not found in the function declaration}}
Dmitri Gribenko5b8a1d42012-07-24 21:46:24 +0000212/// \param a Blah blah.
213int test_param11();
214
Dmitri Gribenkof26054f2012-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 Gribenko5b8a1d42012-07-24 21:46:24 +0000217int test_param12(int a);
Dmitri Gribenkof26054f2012-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 Gribenko5b8a1d42012-07-24 21:46:24 +0000221int test_param13(int aaa, int bbb);
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000222
Dmitri Gribenko219bd152012-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 Gribenkof26054f2012-07-11 21:38:39 +0000228// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
229/// \param aab Blah blah.
Dmitri Gribenko219bd152012-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 Gribenkof26054f2012-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 Gribenko219bd152012-08-24 17:45:39 +0000257 int test_param19(int bbb, int ccc);
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000258};
259
Dmitri Gribenko34df2202012-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 Gribenko219bd152012-08-24 17:45:39 +0000263void test_param20(int bbb, int ccc);
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000264
Dmitri Gribenko8f0f1b02012-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 Gribenko219bd152012-08-24 17:45:39 +0000269int test_param21(int a);
Dmitri Gribenko8f0f1b02012-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 Gribenko219bd152012-08-24 17:45:39 +0000276int test_param22(int x1, int x2, int x3);
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000277
Dmitri Gribenkofa68a572013-12-17 22:06:11 +0000278//===---
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};
292
Dmitri Gribenko219bd152012-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 Gribenko907f6b82012-08-24 00:05:30 +0000294/// \param aaa Meow.
295/// \param bbb Bbb.
296/// \returns aaa.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000297typedef int test_function_like_typedef1(int aaa, int ccc);
Dmitri Gribenko907f6b82012-08-24 00:05:30 +0000298
Dmitri Gribenko219bd152012-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 Gribenko907f6b82012-08-24 00:05:30 +0000300/// \param aaa Meow.
301/// \param bbb Bbb.
302/// \returns aaa.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000303typedef int (*test_function_like_typedef2)(int aaa, int ccc);
Dmitri Gribenko907f6b82012-08-24 00:05:30 +0000304
Dmitri Gribenko219bd152012-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 Gribenko907f6b82012-08-24 00:05:30 +0000306/// \param aaa Meow.
307/// \param bbb Bbb.
308/// \returns aaa.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000309typedef int (* const test_function_like_typedef3)(int aaa, int ccc);
Dmitri Gribenko907f6b82012-08-24 00:05:30 +0000310
Dmitri Gribenko219bd152012-08-24 17:45:39 +0000311// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
Dmitri Gribenko907f6b82012-08-24 00:05:30 +0000312/// \param aaa Meow.
313/// \param bbb Bbb.
314/// \returns aaa.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000315typedef int (C::*test_function_like_typedef4)(int aaa, int ccc);
Dmitri Gribenko219bd152012-08-24 17:45:39 +0000316
Dmitri Gribenkofa68a572013-12-17 22:06:11 +0000317// 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
Dmitri Gribenkoe8bc31f2013-12-17 22:22:14 +0000329// 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
Dmitri Gribenkofa68a572013-12-17 22:06:11 +0000341
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000342typedef int (*test_not_function_like_typedef1)(int aaa);
Dmitri Gribenko49fdf8d2012-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.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000346typedef test_not_function_like_typedef1 test_not_function_like_typedef2;
Dmitri Gribenko49fdf8d2012-09-15 21:13:36 +0000347
Dmitri Gribenkofd5ef422013-03-04 19:39:33 +0000348// rdar://13066276
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000349// Check that the diagnostic uses the same command marker as the comment.
Dmitri Gribenkofd5ef422013-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.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000352typedef unsigned int test_not_function_like_typedef3;
Dmitri Gribenkofd5ef422013-03-04 19:39:33 +0000353
Dmitri Gribenkofa68a572013-12-17 22:06:11 +0000354// 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 Gribenko34df2202012-07-31 22:37:06 +0000357
Dmitri Gribenko02489eb2013-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
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000374// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
375/// \tparam T Aaa
376int test_tparam1;
377
378// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
379/// \tparam T Aaa
380void test_tparam2(int aaa);
381
382// expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
383/// \tparam
384/// \param aaa Blah blah
385template<typename T>
386void test_tparam3(T aaa);
387
388// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
389/// \tparam T Aaa
390template<typename TT>
391void test_tparam4(TT aaa);
392
393// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
394/// \tparam T Aaa
395template<typename TT>
396class test_tparam5 {
397 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
398 /// \tparam T Aaa
399 template<typename TTT>
400 void test_tparam6(TTT aaa);
401};
402
403/// \tparam T1 Aaa
404/// \tparam T2 Bbb
405template<typename T1, typename T2>
406void test_tparam7(T1 aaa, T2 bbb);
407
408// expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
409/// \tparam SomTy Aaa
410/// \tparam OtherTy Bbb
411template<typename SomeTy, typename OtherTy>
412void test_tparam8(SomeTy aaa, OtherTy bbb);
413
414// expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
415/// \tparam T1 Aaa
416/// \tparam T1 Bbb
417template<typename T1, typename T2>
418void test_tparam9(T1 aaa, T2 bbb);
419
420/// \tparam T Aaa
421/// \tparam TT Bbb
422template<template<typename T> class TT>
423void test_tparam10(TT<int> aaa);
424
425/// \tparam T Aaa
426/// \tparam TT Bbb
427/// \tparam TTT Ccc
428template<template<template<typename T> class TT, class C> class TTT>
429void test_tparam11();
430
431/// \tparam I Aaa
432template<int I>
433void test_tparam12();
434
Dmitri Gribenkobaeb60e2012-08-02 21:36:57 +0000435template<typename T, typename U>
436class test_tparam13 { };
437
438/// \tparam T Aaa
439template<typename T>
440using test_tparam14 = test_tparam13<T, int>;
441
442// expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
443/// \tparam U Aaa
444template<typename T>
445using test_tparam15 = test_tparam13<T, int>;
446
Dmitri Gribenko01b06512013-01-27 21:18:39 +0000447// ----
448
449/// \tparam T Aaa
450template<typename T>
451class test_tparam16 { };
452
453typedef test_tparam16<int> test_tparam17;
454typedef test_tparam16<double> test_tparam18;
455
456// ----
457
458template<typename T>
459class test_tparam19;
460
461typedef test_tparam19<int> test_tparam20;
462typedef test_tparam19<double> test_tparam21;
463
464/// \tparam T Aaa
465template<typename T>
466class test_tparam19 { };
467
468// ----
469
Dmitri Gribenko05e22f22013-03-04 20:23:16 +0000470// expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
471/// @tparam T Aaa
472int test_tparam22;
473
474// ----
475
Dmitri Gribenkob37d5e82012-09-13 20:36:01 +0000476
477/// Aaa
478/// \deprecated Bbb
Dmitri Gribenko1da88862012-09-22 21:47:50 +0000479void test_deprecated_1(int a) __attribute__((deprecated));
Dmitri Gribenkob37d5e82012-09-13 20:36:01 +0000480
481// We don't want \deprecated to warn about empty paragraph. It is fine to use
482// \deprecated by itself without explanations.
483
484/// Aaa
485/// \deprecated
Dmitri Gribenko1da88862012-09-22 21:47:50 +0000486void test_deprecated_2(int a) __attribute__((deprecated));
487
488/// Aaa
489/// \deprecated
490void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
491
492/// Aaa
493/// \deprecated
494void test_deprecated_4(int a) __attribute__((unavailable));
495
496// 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}}
497/// Aaa
498/// \deprecated
499void test_deprecated_5(int a);
500
501// 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}}
502/// Aaa
503/// \deprecated
504void test_deprecated_6(int a) {
505}
506
507// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
508/// Aaa
509/// \deprecated
510template<typename T>
511void test_deprecated_7(T aaa);
Dmitri Gribenkob37d5e82012-09-13 20:36:01 +0000512
513
Dmitri Gribenkofd5ef422013-03-04 19:39:33 +0000514// rdar://12397511
515// expected-note@+2 {{previous command '\headerfile' here}}
516// expected-warning@+2 {{duplicated command '\headerfile'}}
517/// \headerfile ""
518/// \headerfile foo.h
519int test__headerfile_1(int a);
520
521
Dmitri Gribenko578865b2012-09-14 15:37:29 +0000522/// \invariant aaa
523void test_invariant_1(int a);
524
525// expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
526/// \invariant
527void test_invariant_2(int a);
528
529
Dmitri Gribenko64305832012-08-03 21:15:32 +0000530// no-warning
531/// \returns Aaa
532int test_returns_right_decl_1(int);
533
534class test_returns_right_decl_2 {
535 // no-warning
536 /// \returns Aaa
537 int test_returns_right_decl_3(int);
538};
539
540// no-warning
541/// \returns Aaa
542template<typename T>
543int test_returns_right_decl_4(T aaa);
544
545// no-warning
546/// \returns Aaa
547template<>
548int test_returns_right_decl_4(int aaa);
549
550/// \returns Aaa
551template<typename T>
552T test_returns_right_decl_5(T aaa);
553
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000554// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000555/// \returns Aaa
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000556int test_returns_wrong_decl_1_backslash;
557
558// rdar://13066276
559// Check that the diagnostic uses the same command marker as the comment.
560// expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
561/// @returns Aaa
562int test_returns_wrong_decl_1_at;
Dmitri Gribenko64305832012-08-03 21:15:32 +0000563
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000564// expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000565/// \return Aaa
566int test_returns_wrong_decl_2;
567
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000568// expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000569/// \result Aaa
570int test_returns_wrong_decl_3;
571
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000572// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000573/// \returns Aaa
574void test_returns_wrong_decl_4(int);
575
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000576// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000577/// \returns Aaa
578template<typename T>
579void test_returns_wrong_decl_5(T aaa);
580
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000581// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000582/// \returns Aaa
583template<>
584void test_returns_wrong_decl_5(int aaa);
585
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000586// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000587/// \returns Aaa
588struct test_returns_wrong_decl_6 { };
589
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000590// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000591/// \returns Aaa
592class test_returns_wrong_decl_7 {
593 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
594 /// \returns Aaa
595 test_returns_wrong_decl_7();
596
597 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
598 /// \returns Aaa
599 ~test_returns_wrong_decl_7();
600};
601
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000602// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000603/// \returns Aaa
604enum test_returns_wrong_decl_8 {
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000605 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000606 /// \returns Aaa
607 test_returns_wrong_decl_9
608};
609
Dmitri Gribenko558babc2012-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 Gribenko64305832012-08-03 21:15:32 +0000611/// \returns Aaa
612namespace test_returns_wrong_decl_10 { };
613
Fariborz Jahanianf4ba35d2013-03-05 19:40:47 +0000614// rdar://13094352
Fariborz Jahanian56fe4062013-03-05 22:46:07 +0000615// expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
Fariborz Jahanianf4ba35d2013-03-05 19:40:47 +0000616/*! @function test_function
617*/
618typedef unsigned int Base64Flags;
619unsigned test_function(Base64Flags inFlags);
620
Fariborz Jahanian56fe4062013-03-05 22:46:07 +0000621// expected-warning@+1 {{'@callback' command should be used in a comment attached to a pointer to function declaration}}
Fariborz Jahanianf4ba35d2013-03-05 19:40:47 +0000622/*! @callback test_callback
623*/
624typedef unsigned int BaseFlags;
625unsigned (*test_callback)(BaseFlags inFlags);
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000626
Dmitri Gribenko76b91c32012-11-18 00:30:31 +0000627// expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
628/// \endverbatim
629int test_verbatim_1();
630
631// expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
632/// \endcode
633int test_verbatim_2();
634
635// FIXME: we give a bad diagnostic here because we throw away non-documentation
636// comments early.
637//
NAKAMURA Takumi34245502012-11-18 02:34:33 +0000638// expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
Dmitri Gribenko76b91c32012-11-18 00:30:31 +0000639/// \code
640// foo
641/// \endcode
642int test_verbatim_3();
643
644
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000645// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000646int test1; ///< \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000647
648// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
649// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000650int test2, ///< \brief\author Aaa
651 test3; ///< \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000652
653// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
654int test4; ///< \brief
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000655 ///< \author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000656
657
Dmitri Gribenko761f8012013-06-23 23:33:14 +0000658class TestRelates {};
659
660/// \relates TestRelates
661/// \brief Aaa
662void test_relates_1();
663
664/// \related TestRelates
665/// \brief Aaa
666void test_relates_2();
667
668/// \relatesalso TestRelates
669/// \brief Aaa
670void test_relates_3();
671
672/// \relatedalso TestRelates
673/// \brief Aaa
674void test_relates_4();
675
676
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000677// Check that we attach the comment to the declaration during parsing in the
678// following cases. The test is based on the fact that we don't parse
679// documentation comments that are not attached to anything.
680
681// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000682/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000683int test_attach1;
684
685// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000686/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000687int test_attach2(int);
688
689// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000690/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000691struct test_attach3 {
692 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000693 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000694 int test_attach4;
695
696 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000697 int test_attach5; ///< \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000698
699 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000700 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000701 int test_attach6(int);
702};
703
704// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000705/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000706class test_attach7 {
707 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000708 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000709 int test_attach8;
710
711 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000712 int test_attach9; ///< \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000713
714 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000715 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000716 int test_attach10(int);
717};
718
719// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000720/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000721enum test_attach9 {
722 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000723 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000724 test_attach10,
725
726 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000727 test_attach11 ///< \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000728};
729
730// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000731/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000732struct test_noattach12 *test_attach13;
733
734// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000735/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000736typedef struct test_noattach14 *test_attach15;
737
738// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000739/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000740typedef struct test_attach16 { int a; } test_attach17;
741
742struct S { int a; };
743
744// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000745/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000746struct S *test_attach18;
747
748// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000749/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000750typedef struct S *test_attach19;
751
752// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000753/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000754struct test_attach20;
755
756// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000757/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000758typedef struct test_attach21 {
759 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000760 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000761 int test_attach22;
762} test_attach23;
763
764// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000765/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000766namespace test_attach24 {
767 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000768 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000769 namespace test_attach25 {
770 }
771}
772
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000773// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000774/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000775/// \tparam T Aaa
776template<typename T>
777void test_attach26(T aaa);
778
779// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000780/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000781/// \tparam T Aaa
782template<typename T, typename U>
783void test_attach27(T aaa, U bbb);
784
785// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
786// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000787/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000788/// \tparam T Aaa
789template<>
790void test_attach27(int aaa, int bbb);
791
792// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000793/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000794/// \tparam T Aaa
795template<typename T>
796class test_attach28 {
797 T aaa;
798};
799
800// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000801/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000802using test_attach29 = test_attach28<int>;
803
804// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000805/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000806/// \tparam T Aaa
807template<typename T, typename U>
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000808class test_attach30 { };
809
810// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000811/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000812/// \tparam T Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000813template<typename T>
814class test_attach30<T, int> { };
815
816// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000817/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000818template<>
819class test_attach30<int, int> { };
820
821// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000822/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000823template<typename T>
824using test_attach31 = test_attach30<T, int>;
825
826// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000827/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000828/// \tparam T Aaa
829template<typename T, typename U, typename V>
830class test_attach32 { };
831
832// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000833/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000834/// \tparam T Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000835template<typename T, typename U>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000836class test_attach32<T, U, int> { };
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000837
838// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000839/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000840/// \tparam T Aaa
841template<typename T>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000842class test_attach32<T, int, int> { };
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000843
844// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
845// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000846/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000847/// \tparam T Aaa
848template<>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000849class test_attach32<int, int, int> { };
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000850
851// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000852/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000853class test_attach33 {
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000854 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000855 /// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000856 /// \tparam T Aaa
857 template<typename T, typename U>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000858 void test_attach34(T aaa, U bbb);
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000859};
860
861template<typename T>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000862class test_attach35 {
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000863 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
864 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000865 /// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000866 /// \tparam T Aaa
867 template<typename TT, typename UU>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000868 void test_attach36(TT aaa, UU bbb);
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000869};
870
871// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
872// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000873/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000874/// \tparam T Aaa
875template<> template<>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000876void test_attach35<int>::test_attach36(int aaa, int bbb) {}
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000877
878template<typename T>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000879class test_attach37 {
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000880 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
881 // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000882 /// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000883 /// \tparam T Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000884 void test_attach38(int aaa, int bbb);
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000885
Dmitri Gribenkob2610882012-08-14 17:17:18 +0000886 void test_attach39(int aaa, int bbb);
887};
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000888
889// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
890// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000891/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000892/// \tparam T Aaa
893template<>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000894void test_attach37<int>::test_attach38(int aaa, int bbb) {}
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000895
Dmitri Gribenkob2610882012-08-14 17:17:18 +0000896// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
897/// \brief\author Aaa
898/// \tparam T Aaa
899template<typename T>
900void test_attach37<T>::test_attach39(int aaa, int bbb) {}
901
Dmitri Gribenko4ae66a32012-08-16 18:19:43 +0000902// We used to emit warning that parameter 'a' is not found because we parsed
903// the comment in context of the redeclaration which does not have parameter
904// names.
905template <typename T>
906struct test_attach38 {
907 /*!
908 \param a First param
909 \param b Second param
910 */
911 template <typename B>
912 void test_attach39(T a, B b);
913};
914
915template <>
916template <typename B>
917void test_attach38<int>::test_attach39(int, B);
Dmitri Gribenkob2610882012-08-14 17:17:18 +0000918
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000919
Dmitri Gribenko66a00c72012-07-20 20:18:53 +0000920// PR13411, reduced. We used to crash on this.
921/**
922 * @code Aaa.
923 */
924void test_nocrash1(int);
925
Dmitri Gribenko1ba47ca2012-07-30 18:05:28 +0000926// We used to crash on this.
927// expected-warning@+2 {{empty paragraph passed to '\param' command}}
928// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
929/// \param\brief
930void test_nocrash2(int);
931
Dmitri Gribenkob2610882012-08-14 17:17:18 +0000932// PR13593, example 1 and 2
Douglas Gregor35ceb272012-08-13 16:37:30 +0000933
934/**
935* Bla.
936*/
937template <typename>
938void test_nocrash3();
939
940/// Foo
941template <typename, typename>
942void test_nocrash4() { }
943
944template <typename>
945void test_nocrash3()
946{
947}
Dmitri Gribenkob2610882012-08-14 17:17:18 +0000948
949// PR13593, example 3
950
951/**
952 * aaa
953 */
954template <typename T>
955inline T test_nocrash5(T a1)
956{
957 return a1;
958}
959
960///
961//,
962
963inline void test_nocrash6()
964{
965 test_nocrash5(1);
966}
967
968// We used to crash on this.
969
970/*!
971 Blah.
972*/
973typedef const struct test_nocrash7 * test_nocrash8;
974
Dmitri Gribenko9304d862012-09-11 19:22:03 +0000975// We used to crash on this.
976
Fariborz Jahanian5b637072013-05-03 23:15:20 +0000977// expected-warning@+1 {{unknown command tag name}}
Dmitri Gribenko9304d862012-09-11 19:22:03 +0000978/// aaa \unknown aaa \unknown aaa
979int test_nocrash9;
980
Dmitri Gribenko71469302013-01-26 00:36:14 +0000981// We used to crash on this. PR15068
982
Fariborz Jahaniand4996362013-03-01 22:51:30 +0000983// expected-warning@+2 {{empty paragraph passed to '@param' command}}
984// expected-warning@+2 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko71469302013-01-26 00:36:14 +0000985///@param x
986///@param y
987int test_nocrash10(int x, int y);
988
Fariborz Jahaniand4996362013-03-01 22:51:30 +0000989// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
990// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}}
Dmitri Gribenko71469302013-01-26 00:36:14 +0000991///@param x
992///@param y
993int test_nocrash11();
994
Fariborz Jahaniand4996362013-03-01 22:51:30 +0000995// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
996// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}}
Dmitri Gribenko71469302013-01-26 00:36:14 +0000997/**
998@param x
999@param y
1000**/
1001int test_nocrash12();
1002
Fariborz Jahaniand4996362013-03-01 22:51:30 +00001003// expected-warning@+2 {{empty paragraph passed to '@param' command}}
1004// expected-warning@+1 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko71469302013-01-26 00:36:14 +00001005///@param x@param y
1006int test_nocrash13(int x, int y);
Fariborz Jahaniana649eee2013-03-07 23:33:11 +00001007
1008// rdar://12379114
1009// expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
1010/*!
1011 @union U This is new
1012*/
1013struct U { int iS; };
1014
1015/*!
1016 @union U1
1017*/
1018union U1 {int i; };
1019
1020// expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
1021/*!
1022 @struct S2
1023*/
1024union S2 {};
1025
1026/*!
1027 @class C1
1028*/
1029class C1;
1030
1031/*!
1032 @struct S3;
1033*/
1034class S3;
Fariborz Jahanianc0607ed2013-06-19 18:08:03 +00001035
1036// rdar://14124702
1037//----------------------------------------------------------------------
1038/// @class Predicate Predicate.h "lldb/Host/Predicate.h"
1039/// @brief A C++ wrapper class for providing threaded access to a value
1040/// of type T.
1041///
1042/// A templatized class.
1043/// specified values.
1044//----------------------------------------------------------------------
1045template <class T, class T1>
1046class Predicate
1047{
1048};
1049
1050//----------------------------------------------------------------------
1051/// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
1052/// @brief A C++ wrapper class for providing threaded access to a value
1053/// of type T.
1054///
1055/// A template specilization class.
1056//----------------------------------------------------------------------
1057template<> class Predicate<int, char>
1058{
1059};
1060
1061//----------------------------------------------------------------------
1062/// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
1063/// @brief A C++ wrapper class for providing threaded access to a value
1064/// of type T.
1065///
1066/// A partial specialization template class.
1067//----------------------------------------------------------------------
1068template<class T> class Predicate<T, int>
1069{
1070};
1071
1072/*! @function test_function
1073*/
1074template <class T> T test_function (T arg);
1075
1076/*! @function test_function<int>
1077*/
1078template <> int test_function<int> (int arg);