blob: a8b9ea520a6fd5616b4c6b79e72a6889a2513a26 [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 Gribenko219bd152012-08-24 17:45:39 +0000278// 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 +0000279/// \param aaa Meow.
280/// \param bbb Bbb.
281/// \returns aaa.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000282typedef int test_function_like_typedef1(int aaa, int ccc);
Dmitri Gribenko907f6b82012-08-24 00:05:30 +0000283
Dmitri Gribenko219bd152012-08-24 17:45:39 +0000284// 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 +0000285/// \param aaa Meow.
286/// \param bbb Bbb.
287/// \returns aaa.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000288typedef int (*test_function_like_typedef2)(int aaa, int ccc);
Dmitri Gribenko907f6b82012-08-24 00:05:30 +0000289
Dmitri Gribenko219bd152012-08-24 17:45:39 +0000290// 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 +0000291/// \param aaa Meow.
292/// \param bbb Bbb.
293/// \returns aaa.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000294typedef int (* const test_function_like_typedef3)(int aaa, int ccc);
Dmitri Gribenko907f6b82012-08-24 00:05:30 +0000295
Dmitri Gribenko219bd152012-08-24 17:45:39 +0000296// 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 +0000297/// \param aaa Meow.
298/// \param bbb Bbb.
299/// \returns aaa.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000300typedef int (C::*test_function_like_typedef4)(int aaa, int ccc);
Dmitri Gribenko219bd152012-08-24 17:45:39 +0000301
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000302typedef int (*test_not_function_like_typedef1)(int aaa);
Dmitri Gribenko49fdf8d2012-09-15 21:13:36 +0000303
304// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
305/// \param aaa Meow.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000306typedef test_not_function_like_typedef1 test_not_function_like_typedef2;
Dmitri Gribenko49fdf8d2012-09-15 21:13:36 +0000307
Dmitri Gribenkofd5ef422013-03-04 19:39:33 +0000308// rdar://13066276
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000309// Check that the diagnostic uses the same command marker as the comment.
Dmitri Gribenkofd5ef422013-03-04 19:39:33 +0000310// expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
311/// @param aaa Meow.
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000312typedef unsigned int test_not_function_like_typedef3;
Dmitri Gribenkofd5ef422013-03-04 19:39:33 +0000313
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000314
Dmitri Gribenko02489eb2013-06-24 04:41:32 +0000315/// \param aaa Aaa
316/// \param ... Vararg
317int test_vararg_param1(int aaa, ...);
318
319/// \param ... Vararg
320int test_vararg_param2(...);
321
322// expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
323/// \param ... Vararg
324int test_vararg_param3(int aaa);
325
326// expected-warning@+1 {{parameter '...' not found in the function declaration}}
327/// \param ... Vararg
328int test_vararg_param4();
329
330
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000331// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
332/// \tparam T Aaa
333int test_tparam1;
334
335// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
336/// \tparam T Aaa
337void test_tparam2(int aaa);
338
339// expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
340/// \tparam
341/// \param aaa Blah blah
342template<typename T>
343void test_tparam3(T aaa);
344
345// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
346/// \tparam T Aaa
347template<typename TT>
348void test_tparam4(TT aaa);
349
350// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
351/// \tparam T Aaa
352template<typename TT>
353class test_tparam5 {
354 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
355 /// \tparam T Aaa
356 template<typename TTT>
357 void test_tparam6(TTT aaa);
358};
359
360/// \tparam T1 Aaa
361/// \tparam T2 Bbb
362template<typename T1, typename T2>
363void test_tparam7(T1 aaa, T2 bbb);
364
365// expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
366/// \tparam SomTy Aaa
367/// \tparam OtherTy Bbb
368template<typename SomeTy, typename OtherTy>
369void test_tparam8(SomeTy aaa, OtherTy bbb);
370
371// expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
372/// \tparam T1 Aaa
373/// \tparam T1 Bbb
374template<typename T1, typename T2>
375void test_tparam9(T1 aaa, T2 bbb);
376
377/// \tparam T Aaa
378/// \tparam TT Bbb
379template<template<typename T> class TT>
380void test_tparam10(TT<int> aaa);
381
382/// \tparam T Aaa
383/// \tparam TT Bbb
384/// \tparam TTT Ccc
385template<template<template<typename T> class TT, class C> class TTT>
386void test_tparam11();
387
388/// \tparam I Aaa
389template<int I>
390void test_tparam12();
391
Dmitri Gribenkobaeb60e2012-08-02 21:36:57 +0000392template<typename T, typename U>
393class test_tparam13 { };
394
395/// \tparam T Aaa
396template<typename T>
397using test_tparam14 = test_tparam13<T, int>;
398
399// expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
400/// \tparam U Aaa
401template<typename T>
402using test_tparam15 = test_tparam13<T, int>;
403
Dmitri Gribenko01b06512013-01-27 21:18:39 +0000404// ----
405
406/// \tparam T Aaa
407template<typename T>
408class test_tparam16 { };
409
410typedef test_tparam16<int> test_tparam17;
411typedef test_tparam16<double> test_tparam18;
412
413// ----
414
415template<typename T>
416class test_tparam19;
417
418typedef test_tparam19<int> test_tparam20;
419typedef test_tparam19<double> test_tparam21;
420
421/// \tparam T Aaa
422template<typename T>
423class test_tparam19 { };
424
425// ----
426
Dmitri Gribenko05e22f22013-03-04 20:23:16 +0000427// expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
428/// @tparam T Aaa
429int test_tparam22;
430
431// ----
432
Dmitri Gribenkob37d5e82012-09-13 20:36:01 +0000433
434/// Aaa
435/// \deprecated Bbb
Dmitri Gribenko1da88862012-09-22 21:47:50 +0000436void test_deprecated_1(int a) __attribute__((deprecated));
Dmitri Gribenkob37d5e82012-09-13 20:36:01 +0000437
438// We don't want \deprecated to warn about empty paragraph. It is fine to use
439// \deprecated by itself without explanations.
440
441/// Aaa
442/// \deprecated
Dmitri Gribenko1da88862012-09-22 21:47:50 +0000443void test_deprecated_2(int a) __attribute__((deprecated));
444
445/// Aaa
446/// \deprecated
447void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
448
449/// Aaa
450/// \deprecated
451void test_deprecated_4(int a) __attribute__((unavailable));
452
453// 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}}
454/// Aaa
455/// \deprecated
456void test_deprecated_5(int a);
457
458// 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}}
459/// Aaa
460/// \deprecated
461void test_deprecated_6(int a) {
462}
463
464// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
465/// Aaa
466/// \deprecated
467template<typename T>
468void test_deprecated_7(T aaa);
Dmitri Gribenkob37d5e82012-09-13 20:36:01 +0000469
470
Dmitri Gribenkofd5ef422013-03-04 19:39:33 +0000471// rdar://12397511
472// expected-note@+2 {{previous command '\headerfile' here}}
473// expected-warning@+2 {{duplicated command '\headerfile'}}
474/// \headerfile ""
475/// \headerfile foo.h
476int test__headerfile_1(int a);
477
478
Dmitri Gribenko578865b2012-09-14 15:37:29 +0000479/// \invariant aaa
480void test_invariant_1(int a);
481
482// expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
483/// \invariant
484void test_invariant_2(int a);
485
486
Dmitri Gribenko64305832012-08-03 21:15:32 +0000487// no-warning
488/// \returns Aaa
489int test_returns_right_decl_1(int);
490
491class test_returns_right_decl_2 {
492 // no-warning
493 /// \returns Aaa
494 int test_returns_right_decl_3(int);
495};
496
497// no-warning
498/// \returns Aaa
499template<typename T>
500int test_returns_right_decl_4(T aaa);
501
502// no-warning
503/// \returns Aaa
504template<>
505int test_returns_right_decl_4(int aaa);
506
507/// \returns Aaa
508template<typename T>
509T test_returns_right_decl_5(T aaa);
510
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000511// 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 +0000512/// \returns Aaa
Dmitri Gribenkof869ad12013-12-17 19:45:12 +0000513int test_returns_wrong_decl_1_backslash;
514
515// rdar://13066276
516// Check that the diagnostic uses the same command marker as the comment.
517// expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
518/// @returns Aaa
519int test_returns_wrong_decl_1_at;
Dmitri Gribenko64305832012-08-03 21:15:32 +0000520
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000521// 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 +0000522/// \return Aaa
523int test_returns_wrong_decl_2;
524
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000525// 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 +0000526/// \result Aaa
527int test_returns_wrong_decl_3;
528
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000529// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000530/// \returns Aaa
531void test_returns_wrong_decl_4(int);
532
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000533// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000534/// \returns Aaa
535template<typename T>
536void test_returns_wrong_decl_5(T aaa);
537
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000538// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko64305832012-08-03 21:15:32 +0000539/// \returns Aaa
540template<>
541void test_returns_wrong_decl_5(int aaa);
542
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000543// 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 +0000544/// \returns Aaa
545struct test_returns_wrong_decl_6 { };
546
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000547// 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 +0000548/// \returns Aaa
549class test_returns_wrong_decl_7 {
550 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
551 /// \returns Aaa
552 test_returns_wrong_decl_7();
553
554 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
555 /// \returns Aaa
556 ~test_returns_wrong_decl_7();
557};
558
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000559// 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 +0000560/// \returns Aaa
561enum test_returns_wrong_decl_8 {
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000562 // 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 +0000563 /// \returns Aaa
564 test_returns_wrong_decl_9
565};
566
Dmitri Gribenko558babc2012-08-06 16:29:26 +0000567// 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 +0000568/// \returns Aaa
569namespace test_returns_wrong_decl_10 { };
570
Fariborz Jahanianf4ba35d2013-03-05 19:40:47 +0000571// rdar://13094352
Fariborz Jahanian56fe4062013-03-05 22:46:07 +0000572// expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
Fariborz Jahanianf4ba35d2013-03-05 19:40:47 +0000573/*! @function test_function
574*/
575typedef unsigned int Base64Flags;
576unsigned test_function(Base64Flags inFlags);
577
Fariborz Jahanian56fe4062013-03-05 22:46:07 +0000578// 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 +0000579/*! @callback test_callback
580*/
581typedef unsigned int BaseFlags;
582unsigned (*test_callback)(BaseFlags inFlags);
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000583
Dmitri Gribenko76b91c32012-11-18 00:30:31 +0000584// expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
585/// \endverbatim
586int test_verbatim_1();
587
588// expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
589/// \endcode
590int test_verbatim_2();
591
592// FIXME: we give a bad diagnostic here because we throw away non-documentation
593// comments early.
594//
NAKAMURA Takumi34245502012-11-18 02:34:33 +0000595// expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
Dmitri Gribenko76b91c32012-11-18 00:30:31 +0000596/// \code
597// foo
598/// \endcode
599int test_verbatim_3();
600
601
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000602// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000603int test1; ///< \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000604
605// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
606// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000607int test2, ///< \brief\author Aaa
608 test3; ///< \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000609
610// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
611int test4; ///< \brief
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000612 ///< \author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000613
614
Dmitri Gribenko761f8012013-06-23 23:33:14 +0000615class TestRelates {};
616
617/// \relates TestRelates
618/// \brief Aaa
619void test_relates_1();
620
621/// \related TestRelates
622/// \brief Aaa
623void test_relates_2();
624
625/// \relatesalso TestRelates
626/// \brief Aaa
627void test_relates_3();
628
629/// \relatedalso TestRelates
630/// \brief Aaa
631void test_relates_4();
632
633
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000634// Check that we attach the comment to the declaration during parsing in the
635// following cases. The test is based on the fact that we don't parse
636// documentation comments that are not attached to anything.
637
638// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000639/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000640int test_attach1;
641
642// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000643/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000644int test_attach2(int);
645
646// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000647/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000648struct test_attach3 {
649 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000650 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000651 int test_attach4;
652
653 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000654 int test_attach5; ///< \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000655
656 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000657 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000658 int test_attach6(int);
659};
660
661// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000662/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000663class test_attach7 {
664 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000665 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000666 int test_attach8;
667
668 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000669 int test_attach9; ///< \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000670
671 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000672 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000673 int test_attach10(int);
674};
675
676// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000677/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000678enum test_attach9 {
679 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000680 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000681 test_attach10,
682
683 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000684 test_attach11 ///< \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000685};
686
687// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000688/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000689struct test_noattach12 *test_attach13;
690
691// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000692/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000693typedef struct test_noattach14 *test_attach15;
694
695// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000696/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000697typedef struct test_attach16 { int a; } test_attach17;
698
699struct S { int a; };
700
701// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000702/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000703struct S *test_attach18;
704
705// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000706/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000707typedef struct S *test_attach19;
708
709// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000710/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000711struct test_attach20;
712
713// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000714/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000715typedef struct test_attach21 {
716 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000717 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000718 int test_attach22;
719} test_attach23;
720
721// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000722/// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000723namespace test_attach24 {
724 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000725 /// \brief\author Aaa
Dmitri Gribenkof26054f2012-07-11 21:38:39 +0000726 namespace test_attach25 {
727 }
728}
729
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000730// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000731/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000732/// \tparam T Aaa
733template<typename T>
734void test_attach26(T aaa);
735
736// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000737/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000738/// \tparam T Aaa
739template<typename T, typename U>
740void test_attach27(T aaa, U bbb);
741
742// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
743// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000744/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000745/// \tparam T Aaa
746template<>
747void test_attach27(int aaa, int bbb);
748
749// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000750/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000751/// \tparam T Aaa
752template<typename T>
753class test_attach28 {
754 T aaa;
755};
756
757// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000758/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000759using test_attach29 = test_attach28<int>;
760
761// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000762/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000763/// \tparam T Aaa
764template<typename T, typename U>
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000765class test_attach30 { };
766
767// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000768/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000769/// \tparam T Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000770template<typename T>
771class test_attach30<T, int> { };
772
773// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000774/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000775template<>
776class test_attach30<int, int> { };
777
778// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000779/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000780template<typename T>
781using test_attach31 = test_attach30<T, int>;
782
783// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000784/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000785/// \tparam T Aaa
786template<typename T, typename U, typename V>
787class test_attach32 { };
788
789// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000790/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000791/// \tparam T Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000792template<typename T, typename U>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000793class test_attach32<T, U, int> { };
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000794
795// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000796/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000797/// \tparam T Aaa
798template<typename T>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000799class test_attach32<T, int, int> { };
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000800
801// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
802// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000803/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000804/// \tparam T Aaa
805template<>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000806class test_attach32<int, int, int> { };
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000807
808// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000809/// \brief\author Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000810class test_attach33 {
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000811 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000812 /// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000813 /// \tparam T Aaa
814 template<typename T, typename U>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000815 void test_attach34(T aaa, U bbb);
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000816};
817
818template<typename T>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000819class test_attach35 {
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000820 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
821 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000822 /// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000823 /// \tparam T Aaa
824 template<typename TT, typename UU>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000825 void test_attach36(TT aaa, UU bbb);
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000826};
827
828// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
829// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000830/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000831/// \tparam T Aaa
832template<> template<>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000833void test_attach35<int>::test_attach36(int aaa, int bbb) {}
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000834
835template<typename T>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000836class test_attach37 {
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000837 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
838 // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000839 /// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000840 /// \tparam T Aaa
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000841 void test_attach38(int aaa, int bbb);
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000842
Dmitri Gribenkob2610882012-08-14 17:17:18 +0000843 void test_attach39(int aaa, int bbb);
844};
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000845
846// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
847// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko5ec0c752012-08-06 17:08:27 +0000848/// \brief\author Aaa
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000849/// \tparam T Aaa
850template<>
Dmitri Gribenko7f4b3772012-08-02 20:49:51 +0000851void test_attach37<int>::test_attach38(int aaa, int bbb) {}
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000852
Dmitri Gribenkob2610882012-08-14 17:17:18 +0000853// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
854/// \brief\author Aaa
855/// \tparam T Aaa
856template<typename T>
857void test_attach37<T>::test_attach39(int aaa, int bbb) {}
858
Dmitri Gribenko4ae66a32012-08-16 18:19:43 +0000859// We used to emit warning that parameter 'a' is not found because we parsed
860// the comment in context of the redeclaration which does not have parameter
861// names.
862template <typename T>
863struct test_attach38 {
864 /*!
865 \param a First param
866 \param b Second param
867 */
868 template <typename B>
869 void test_attach39(T a, B b);
870};
871
872template <>
873template <typename B>
874void test_attach38<int>::test_attach39(int, B);
Dmitri Gribenkob2610882012-08-14 17:17:18 +0000875
Dmitri Gribenko34df2202012-07-31 22:37:06 +0000876
Dmitri Gribenko66a00c72012-07-20 20:18:53 +0000877// PR13411, reduced. We used to crash on this.
878/**
879 * @code Aaa.
880 */
881void test_nocrash1(int);
882
Dmitri Gribenko1ba47ca2012-07-30 18:05:28 +0000883// We used to crash on this.
884// expected-warning@+2 {{empty paragraph passed to '\param' command}}
885// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
886/// \param\brief
887void test_nocrash2(int);
888
Dmitri Gribenkob2610882012-08-14 17:17:18 +0000889// PR13593, example 1 and 2
Douglas Gregor35ceb272012-08-13 16:37:30 +0000890
891/**
892* Bla.
893*/
894template <typename>
895void test_nocrash3();
896
897/// Foo
898template <typename, typename>
899void test_nocrash4() { }
900
901template <typename>
902void test_nocrash3()
903{
904}
Dmitri Gribenkob2610882012-08-14 17:17:18 +0000905
906// PR13593, example 3
907
908/**
909 * aaa
910 */
911template <typename T>
912inline T test_nocrash5(T a1)
913{
914 return a1;
915}
916
917///
918//,
919
920inline void test_nocrash6()
921{
922 test_nocrash5(1);
923}
924
925// We used to crash on this.
926
927/*!
928 Blah.
929*/
930typedef const struct test_nocrash7 * test_nocrash8;
931
Dmitri Gribenko9304d862012-09-11 19:22:03 +0000932// We used to crash on this.
933
Fariborz Jahanian5b637072013-05-03 23:15:20 +0000934// expected-warning@+1 {{unknown command tag name}}
Dmitri Gribenko9304d862012-09-11 19:22:03 +0000935/// aaa \unknown aaa \unknown aaa
936int test_nocrash9;
937
Dmitri Gribenko71469302013-01-26 00:36:14 +0000938// We used to crash on this. PR15068
939
Fariborz Jahaniand4996362013-03-01 22:51:30 +0000940// expected-warning@+2 {{empty paragraph passed to '@param' command}}
941// expected-warning@+2 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko71469302013-01-26 00:36:14 +0000942///@param x
943///@param y
944int test_nocrash10(int x, int y);
945
Fariborz Jahaniand4996362013-03-01 22:51:30 +0000946// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
947// 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 +0000948///@param x
949///@param y
950int test_nocrash11();
951
Fariborz Jahaniand4996362013-03-01 22:51:30 +0000952// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
953// 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 +0000954/**
955@param x
956@param y
957**/
958int test_nocrash12();
959
Fariborz Jahaniand4996362013-03-01 22:51:30 +0000960// expected-warning@+2 {{empty paragraph passed to '@param' command}}
961// expected-warning@+1 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko71469302013-01-26 00:36:14 +0000962///@param x@param y
963int test_nocrash13(int x, int y);
Fariborz Jahaniana649eee2013-03-07 23:33:11 +0000964
965// rdar://12379114
966// expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
967/*!
968 @union U This is new
969*/
970struct U { int iS; };
971
972/*!
973 @union U1
974*/
975union U1 {int i; };
976
977// expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
978/*!
979 @struct S2
980*/
981union S2 {};
982
983/*!
984 @class C1
985*/
986class C1;
987
988/*!
989 @struct S3;
990*/
991class S3;
Fariborz Jahanianc0607ed2013-06-19 18:08:03 +0000992
993// rdar://14124702
994//----------------------------------------------------------------------
995/// @class Predicate Predicate.h "lldb/Host/Predicate.h"
996/// @brief A C++ wrapper class for providing threaded access to a value
997/// of type T.
998///
999/// A templatized class.
1000/// specified values.
1001//----------------------------------------------------------------------
1002template <class T, class T1>
1003class Predicate
1004{
1005};
1006
1007//----------------------------------------------------------------------
1008/// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
1009/// @brief A C++ wrapper class for providing threaded access to a value
1010/// of type T.
1011///
1012/// A template specilization class.
1013//----------------------------------------------------------------------
1014template<> class Predicate<int, char>
1015{
1016};
1017
1018//----------------------------------------------------------------------
1019/// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
1020/// @brief A C++ wrapper class for providing threaded access to a value
1021/// of type T.
1022///
1023/// A partial specialization template class.
1024//----------------------------------------------------------------------
1025template<class T> class Predicate<T, int>
1026{
1027};
1028
1029/*! @function test_function
1030*/
1031template <class T> T test_function (T arg);
1032
1033/*! @function test_function<int>
1034*/
1035template <> int test_function<int> (int arg);