blob: 21b8dcb0d244944020b2735fd86fb07d04e3f631 [file] [log] [blame]
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +00002
Dmitri Gribenkof303d4c2012-08-07 17:54:38 +00003// This file contains lots of corner cases, so ensure that XML we generate is not invalid.
4// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s | FileCheck %s -check-prefix=WRONG
5// WRONG-NOT: CommentXMLInvalid
6
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +00007// expected-warning@+1 {{expected quoted string after equals sign}}
8/// <a href=>
9int test_html1(int);
10
11// expected-warning@+1 {{expected quoted string after equals sign}}
12/// <a href==>
13int test_html2(int);
14
15// expected-warning@+2 {{expected quoted string after equals sign}}
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000016// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000017/// <a href= blah
18int test_html3(int);
19
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000020// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000021/// <a =>
22int test_html4(int);
23
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000024// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000025/// <a "aaa">
26int test_html5(int);
27
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000028// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000029/// <a a="b" =>
30int test_html6(int);
31
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000032// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000033/// <a a="b" "aaa">
34int test_html7(int);
35
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000036// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000037/// <a a="b" =
38int test_html8(int);
39
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000040// expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}}
Dmitri Gribenko834a5bd2012-08-22 22:56:08 +000041/** Aaa bbb<img ddd eee
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000042 * fff ggg.
43 */
44int test_html9(int);
45
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000046// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
Dmitri Gribenko834a5bd2012-08-22 22:56:08 +000047/** Aaa bbb<img ddd eee 42%
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000048 * fff ggg.
49 */
50int test_html10(int);
51
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000052// expected-warning@+1 {{HTML end tag 'br' is forbidden}}
Dmitri Gribenko3d986982012-07-12 23:37:09 +000053/// <br></br>
54int test_html11(int);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000055
56/// <blockquote>Meow</blockquote>
57int test_html_nesting1(int);
58
59/// <b><i>Meow</i></b>
60int test_html_nesting2(int);
61
62/// <p>Aaa<br>
63/// Bbb</p>
64int test_html_nesting3(int);
65
66/// <p>Aaa<br />
67/// Bbb</p>
68int test_html_nesting4(int);
69
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000070// expected-warning@+1 {{HTML end tag does not match any start tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000071/// <b><i>Meow</a>
72int test_html_nesting5(int);
73
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000074// expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
75// expected-warning@+1 {{HTML end tag does not match any start tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000076/// <b><i>Meow</b></b>
77int test_html_nesting6(int);
78
Dmitri Gribenko3f38bf22012-07-13 00:44:24 +000079// expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
80// expected-warning@+1 {{HTML end tag does not match any start tag}}
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000081/// <b><i>Meow</b></i>
82int test_html_nesting7(int);
83
84
85// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000086/// \brief\returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000087int test_block_command1(int);
88
89// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +000090/// \brief \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000091int test_block_command2(int);
92
93// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
94/// \brief
Dmitri Gribenko9443c572012-08-06 17:08:27 +000095/// \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +000096int test_block_command3(int);
97
98// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
99/// \brief
100///
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000101/// \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000102int test_block_command4(int);
103
104// There is trailing whitespace on one of the following lines, don't remove it!
105// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
106/// \brief
107///
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000108/// \returns Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000109int test_block_command5(int);
110
Dmitri Gribenko858e69f2012-07-19 00:01:56 +0000111/// \brief \c Aaa
112int test_block_command6(int);
113
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000114// expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\brief' here}}
115/// \brief Aaa
116///
117/// Bbb
118///
119/// \brief Ccc
120int test_duplicate_brief1(int);
121
122// expected-warning@+5 {{duplicated command '\short'}} expected-note@+1 {{previous command '\short' here}}
123/// \short Aaa
124///
125/// Bbb
126///
127/// \short Ccc
128int test_duplicate_brief2(int);
129
130// expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\short' (an alias of '\brief') here}}
131/// \short Aaa
132///
133/// Bbb
134///
135/// \brief Ccc
136int test_duplicate_brief3(int);
137
138
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000139/// \return Aaa
140///
141/// Bbb
142///
143/// \return Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000144int test_multiple_returns1(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000145
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000146/// \returns Aaa
147///
148/// Bbb
149///
150/// \returns Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000151int test_multiple_returns2(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000152
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000153/// \result Aaa
154///
155/// Bbb
156///
157/// \result Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000158int test_multiple_returns3(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000159
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000160/// \returns Aaa
161///
162/// Bbb
163///
164/// \return Ccc
Dmitri Gribenko97e5bc22013-06-22 23:03:37 +0000165int test_multiple_returns4(int);
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000166
167
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000168// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
169/// \param a Blah blah.
170int test_param1;
171
172// expected-warning@+1 {{empty paragraph passed to '\param' command}}
173/// \param
174/// \param a Blah blah.
175int test_param2(int a);
176
177// expected-warning@+1 {{empty paragraph passed to '\param' command}}
178/// \param a
179int test_param3(int a);
180
181/// \param a Blah blah.
182int test_param4(int a);
183
184/// \param [in] a Blah blah.
185int test_param5(int a);
186
187/// \param [out] a Blah blah.
188int test_param6(int a);
189
190/// \param [in,out] a Blah blah.
191int test_param7(int a);
192
193// expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
194/// \param [ in ] a Blah blah.
195int test_param8(int a);
196
197// expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
198/// \param [in, out] a Blah blah.
199int test_param9(int a);
200
201// expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}}
202/// \param [ junk] a Blah blah.
203int test_param10(int a);
204
Dmitri Gribenko2e721042012-07-24 21:56:59 +0000205// expected-warning@+1 {{parameter 'a' not found in the function declaration}}
Dmitri Gribenko56bf6fd2012-07-24 21:46:24 +0000206/// \param a Blah blah.
207int test_param11();
208
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000209// expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
210/// \param A Blah blah.
Dmitri Gribenko56bf6fd2012-07-24 21:46:24 +0000211int test_param12(int a);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000212
213// expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
214/// \param aab Blah blah.
Dmitri Gribenko56bf6fd2012-07-24 21:46:24 +0000215int test_param13(int aaa, int bbb);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000216
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000217// expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}}
218/// \param aaa Blah blah.
219/// \param aab Blah blah.
220int test_param14(int aaa, int bbb);
221
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000222// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
223/// \param aab Blah blah.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000224int test_param15(int bbb, int ccc);
225
226// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
227/// \param aab Ccc.
228/// \param aaa Aaa.
229/// \param bbb Bbb.
230int test_param16(int aaa, int bbb);
231
232// expected-warning@+2 {{parameter 'aab' not found in the function declaration}}
233/// \param aaa Aaa.
234/// \param aab Ccc.
235/// \param bbb Bbb.
236int test_param17(int aaa, int bbb);
237
238// expected-warning@+3 {{parameter 'aab' not found in the function declaration}}
239/// \param aaa Aaa.
240/// \param bbb Bbb.
241/// \param aab Ccc.
242int test_param18(int aaa, int bbb);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000243
244class C {
245 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
246 /// \param aaa Blah blah.
247 C(int bbb, int ccc);
248
249 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
250 /// \param aaa Blah blah.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000251 int test_param19(int bbb, int ccc);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000252};
253
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000254// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
255/// \param aab Blah blah.
256template<typename T>
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000257void test_param20(int bbb, int ccc);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000258
Dmitri Gribenko65822772012-07-24 21:44:16 +0000259// expected-warning@+3 {{parameter 'a' is already documented}}
260// expected-note@+1 {{previous documentation}}
261/// \param a Aaa.
262/// \param a Aaa.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000263int test_param21(int a);
Dmitri Gribenko65822772012-07-24 21:44:16 +0000264
265// expected-warning@+4 {{parameter 'x2' is already documented}}
266// expected-note@+2 {{previous documentation}}
267/// \param x1 Aaa.
268/// \param x2 Bbb.
269/// \param x2 Ccc.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000270int test_param22(int x1, int x2, int x3);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000271
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000272// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000273/// \param aaa Meow.
274/// \param bbb Bbb.
275/// \returns aaa.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000276typedef int test_param23(int aaa, int ccc);
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000277
Dmitri Gribenko9edd2c82012-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 Gribenko70ff1092012-08-24 00:05:30 +0000279/// \param aaa Meow.
280/// \param bbb Bbb.
281/// \returns aaa.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000282typedef int (*test_param24)(int aaa, int ccc);
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000283
Dmitri Gribenko9edd2c82012-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 Gribenko70ff1092012-08-24 00:05:30 +0000285/// \param aaa Meow.
286/// \param bbb Bbb.
287/// \returns aaa.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000288typedef int (* const test_param25)(int aaa, int ccc);
Dmitri Gribenko70ff1092012-08-24 00:05:30 +0000289
Dmitri Gribenko9edd2c82012-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 Gribenko70ff1092012-08-24 00:05:30 +0000291/// \param aaa Meow.
292/// \param bbb Bbb.
293/// \returns aaa.
Dmitri Gribenko9edd2c82012-08-24 17:45:39 +0000294typedef int (C::*test_param26)(int aaa, int ccc);
295
Dmitri Gribenkoec504e02012-09-15 21:13:36 +0000296typedef int (*test_param27)(int aaa);
297
298// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
299/// \param aaa Meow.
300typedef test_param27 test_param28;
301
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000302// rdar://13066276
303// expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
304/// @param aaa Meow.
305typedef unsigned int test_param29;
306
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000307
308// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
309/// \tparam T Aaa
310int test_tparam1;
311
312// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
313/// \tparam T Aaa
314void test_tparam2(int aaa);
315
316// expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
317/// \tparam
318/// \param aaa Blah blah
319template<typename T>
320void test_tparam3(T aaa);
321
322// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
323/// \tparam T Aaa
324template<typename TT>
325void test_tparam4(TT aaa);
326
327// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
328/// \tparam T Aaa
329template<typename TT>
330class test_tparam5 {
331 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
332 /// \tparam T Aaa
333 template<typename TTT>
334 void test_tparam6(TTT aaa);
335};
336
337/// \tparam T1 Aaa
338/// \tparam T2 Bbb
339template<typename T1, typename T2>
340void test_tparam7(T1 aaa, T2 bbb);
341
342// expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
343/// \tparam SomTy Aaa
344/// \tparam OtherTy Bbb
345template<typename SomeTy, typename OtherTy>
346void test_tparam8(SomeTy aaa, OtherTy bbb);
347
348// expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
349/// \tparam T1 Aaa
350/// \tparam T1 Bbb
351template<typename T1, typename T2>
352void test_tparam9(T1 aaa, T2 bbb);
353
354/// \tparam T Aaa
355/// \tparam TT Bbb
356template<template<typename T> class TT>
357void test_tparam10(TT<int> aaa);
358
359/// \tparam T Aaa
360/// \tparam TT Bbb
361/// \tparam TTT Ccc
362template<template<template<typename T> class TT, class C> class TTT>
363void test_tparam11();
364
365/// \tparam I Aaa
366template<int I>
367void test_tparam12();
368
Dmitri Gribenko967e5d72012-08-02 21:36:57 +0000369template<typename T, typename U>
370class test_tparam13 { };
371
372/// \tparam T Aaa
373template<typename T>
374using test_tparam14 = test_tparam13<T, int>;
375
376// expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
377/// \tparam U Aaa
378template<typename T>
379using test_tparam15 = test_tparam13<T, int>;
380
Dmitri Gribenkod1e5c0d2013-01-27 21:18:39 +0000381// ----
382
383/// \tparam T Aaa
384template<typename T>
385class test_tparam16 { };
386
387typedef test_tparam16<int> test_tparam17;
388typedef test_tparam16<double> test_tparam18;
389
390// ----
391
392template<typename T>
393class test_tparam19;
394
395typedef test_tparam19<int> test_tparam20;
396typedef test_tparam19<double> test_tparam21;
397
398/// \tparam T Aaa
399template<typename T>
400class test_tparam19 { };
401
402// ----
403
Dmitri Gribenko8cc9c9d2013-03-04 20:23:16 +0000404// expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
405/// @tparam T Aaa
406int test_tparam22;
407
408// ----
409
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000410
411/// Aaa
412/// \deprecated Bbb
Dmitri Gribenko0bd98382012-09-22 21:47:50 +0000413void test_deprecated_1(int a) __attribute__((deprecated));
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000414
415// We don't want \deprecated to warn about empty paragraph. It is fine to use
416// \deprecated by itself without explanations.
417
418/// Aaa
419/// \deprecated
Dmitri Gribenko0bd98382012-09-22 21:47:50 +0000420void test_deprecated_2(int a) __attribute__((deprecated));
421
422/// Aaa
423/// \deprecated
424void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
425
426/// Aaa
427/// \deprecated
428void test_deprecated_4(int a) __attribute__((unavailable));
429
430// 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}}
431/// Aaa
432/// \deprecated
433void test_deprecated_5(int a);
434
435// 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}}
436/// Aaa
437/// \deprecated
438void test_deprecated_6(int a) {
439}
440
441// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
442/// Aaa
443/// \deprecated
444template<typename T>
445void test_deprecated_7(T aaa);
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000446
447
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000448// rdar://12397511
449// expected-note@+2 {{previous command '\headerfile' here}}
450// expected-warning@+2 {{duplicated command '\headerfile'}}
451/// \headerfile ""
452/// \headerfile foo.h
453int test__headerfile_1(int a);
454
455
Dmitri Gribenko388a5942012-09-14 15:37:29 +0000456/// \invariant aaa
457void test_invariant_1(int a);
458
459// expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
460/// \invariant
461void test_invariant_2(int a);
462
463
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000464// no-warning
465/// \returns Aaa
466int test_returns_right_decl_1(int);
467
468class test_returns_right_decl_2 {
469 // no-warning
470 /// \returns Aaa
471 int test_returns_right_decl_3(int);
472};
473
474// no-warning
475/// \returns Aaa
476template<typename T>
477int test_returns_right_decl_4(T aaa);
478
479// no-warning
480/// \returns Aaa
481template<>
482int test_returns_right_decl_4(int aaa);
483
484/// \returns Aaa
485template<typename T>
486T test_returns_right_decl_5(T aaa);
487
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000488// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000489/// \returns Aaa
490int test_returns_wrong_decl_1;
491
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000492// expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000493/// \return Aaa
494int test_returns_wrong_decl_2;
495
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000496// expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000497/// \result Aaa
498int test_returns_wrong_decl_3;
499
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000500// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000501/// \returns Aaa
502void test_returns_wrong_decl_4(int);
503
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000504// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000505/// \returns Aaa
506template<typename T>
507void test_returns_wrong_decl_5(T aaa);
508
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000509// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000510/// \returns Aaa
511template<>
512void test_returns_wrong_decl_5(int aaa);
513
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000514// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000515/// \returns Aaa
516struct test_returns_wrong_decl_6 { };
517
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000518// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000519/// \returns Aaa
520class test_returns_wrong_decl_7 {
521 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
522 /// \returns Aaa
523 test_returns_wrong_decl_7();
524
525 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
526 /// \returns Aaa
527 ~test_returns_wrong_decl_7();
528};
529
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000530// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000531/// \returns Aaa
532enum test_returns_wrong_decl_8 {
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000533 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000534 /// \returns Aaa
535 test_returns_wrong_decl_9
536};
537
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000538// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000539/// \returns Aaa
540namespace test_returns_wrong_decl_10 { };
541
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000542// rdar://13066276
543// expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
544/// @returns Aaa
545typedef unsigned int test_returns_wrong_decl_11;
546
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000547// rdar://13094352
Fariborz Jahanian99a70572013-03-05 22:46:07 +0000548// expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000549/*! @function test_function
550*/
551typedef unsigned int Base64Flags;
552unsigned test_function(Base64Flags inFlags);
553
Fariborz Jahanian99a70572013-03-05 22:46:07 +0000554// expected-warning@+1 {{'@callback' command should be used in a comment attached to a pointer to function declaration}}
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000555/*! @callback test_callback
556*/
557typedef unsigned int BaseFlags;
558unsigned (*test_callback)(BaseFlags inFlags);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000559
Dmitri Gribenko36cbbe92012-11-18 00:30:31 +0000560// expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
561/// \endverbatim
562int test_verbatim_1();
563
564// expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
565/// \endcode
566int test_verbatim_2();
567
568// FIXME: we give a bad diagnostic here because we throw away non-documentation
569// comments early.
570//
NAKAMURA Takumibf823c02012-11-18 02:34:33 +0000571// expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
Dmitri Gribenko36cbbe92012-11-18 00:30:31 +0000572/// \code
573// foo
574/// \endcode
575int test_verbatim_3();
576
577
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000578// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000579int test1; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000580
581// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
582// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000583int test2, ///< \brief\author Aaa
584 test3; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000585
586// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
587int test4; ///< \brief
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000588 ///< \author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000589
590
Dmitri Gribenko6969e432013-06-23 23:33:14 +0000591class TestRelates {};
592
593/// \relates TestRelates
594/// \brief Aaa
595void test_relates_1();
596
597/// \related TestRelates
598/// \brief Aaa
599void test_relates_2();
600
601/// \relatesalso TestRelates
602/// \brief Aaa
603void test_relates_3();
604
605/// \relatedalso TestRelates
606/// \brief Aaa
607void test_relates_4();
608
609
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000610// Check that we attach the comment to the declaration during parsing in the
611// following cases. The test is based on the fact that we don't parse
612// documentation comments that are not attached to anything.
613
614// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000615/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000616int test_attach1;
617
618// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000619/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000620int test_attach2(int);
621
622// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000623/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000624struct test_attach3 {
625 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000626 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000627 int test_attach4;
628
629 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000630 int test_attach5; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000631
632 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000633 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000634 int test_attach6(int);
635};
636
637// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000638/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000639class test_attach7 {
640 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000641 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000642 int test_attach8;
643
644 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000645 int test_attach9; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000646
647 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000648 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000649 int test_attach10(int);
650};
651
652// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000653/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000654enum test_attach9 {
655 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000656 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000657 test_attach10,
658
659 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000660 test_attach11 ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000661};
662
663// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000664/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000665struct test_noattach12 *test_attach13;
666
667// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000668/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000669typedef struct test_noattach14 *test_attach15;
670
671// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000672/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000673typedef struct test_attach16 { int a; } test_attach17;
674
675struct S { int a; };
676
677// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000678/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000679struct S *test_attach18;
680
681// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000682/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000683typedef struct S *test_attach19;
684
685// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000686/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000687struct test_attach20;
688
689// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000690/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000691typedef struct test_attach21 {
692 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000693 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000694 int test_attach22;
695} test_attach23;
696
697// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000698/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000699namespace test_attach24 {
700 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000701 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000702 namespace test_attach25 {
703 }
704}
705
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000706// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000707/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000708/// \tparam T Aaa
709template<typename T>
710void test_attach26(T aaa);
711
712// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000713/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000714/// \tparam T Aaa
715template<typename T, typename U>
716void test_attach27(T aaa, U bbb);
717
718// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
719// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000720/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000721/// \tparam T Aaa
722template<>
723void test_attach27(int aaa, int bbb);
724
725// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000726/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000727/// \tparam T Aaa
728template<typename T>
729class test_attach28 {
730 T aaa;
731};
732
733// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000734/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000735using test_attach29 = test_attach28<int>;
736
737// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000738/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000739/// \tparam T Aaa
740template<typename T, typename U>
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000741class test_attach30 { };
742
743// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000744/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000745/// \tparam T Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000746template<typename T>
747class test_attach30<T, int> { };
748
749// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000750/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000751template<>
752class test_attach30<int, int> { };
753
754// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000755/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000756template<typename T>
757using test_attach31 = test_attach30<T, int>;
758
759// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000760/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000761/// \tparam T Aaa
762template<typename T, typename U, typename V>
763class test_attach32 { };
764
765// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000766/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000767/// \tparam T Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000768template<typename T, typename U>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000769class test_attach32<T, U, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000770
771// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000772/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000773/// \tparam T Aaa
774template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000775class test_attach32<T, int, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000776
777// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
778// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000779/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000780/// \tparam T Aaa
781template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000782class test_attach32<int, int, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000783
784// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000785/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000786class test_attach33 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000787 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000788 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000789 /// \tparam T Aaa
790 template<typename T, typename U>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000791 void test_attach34(T aaa, U bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000792};
793
794template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000795class test_attach35 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000796 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
797 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000798 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000799 /// \tparam T Aaa
800 template<typename TT, typename UU>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000801 void test_attach36(TT aaa, UU bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000802};
803
804// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
805// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000806/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000807/// \tparam T Aaa
808template<> template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000809void test_attach35<int>::test_attach36(int aaa, int bbb) {}
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000810
811template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000812class test_attach37 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000813 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
814 // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000815 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000816 /// \tparam T Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000817 void test_attach38(int aaa, int bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000818
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000819 void test_attach39(int aaa, int bbb);
820};
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000821
822// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
823// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000824/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000825/// \tparam T Aaa
826template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000827void test_attach37<int>::test_attach38(int aaa, int bbb) {}
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000828
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000829// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
830/// \brief\author Aaa
831/// \tparam T Aaa
832template<typename T>
833void test_attach37<T>::test_attach39(int aaa, int bbb) {}
834
Dmitri Gribenko1599eac2012-08-16 18:19:43 +0000835// We used to emit warning that parameter 'a' is not found because we parsed
836// the comment in context of the redeclaration which does not have parameter
837// names.
838template <typename T>
839struct test_attach38 {
840 /*!
841 \param a First param
842 \param b Second param
843 */
844 template <typename B>
845 void test_attach39(T a, B b);
846};
847
848template <>
849template <typename B>
850void test_attach38<int>::test_attach39(int, B);
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000851
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000852
Dmitri Gribenko9f08f492012-07-20 20:18:53 +0000853// PR13411, reduced. We used to crash on this.
854/**
855 * @code Aaa.
856 */
857void test_nocrash1(int);
858
Dmitri Gribenkoe5deb792012-07-30 18:05:28 +0000859// We used to crash on this.
860// expected-warning@+2 {{empty paragraph passed to '\param' command}}
861// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
862/// \param\brief
863void test_nocrash2(int);
864
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000865// PR13593, example 1 and 2
Douglas Gregorcd81df22012-08-13 16:37:30 +0000866
867/**
868* Bla.
869*/
870template <typename>
871void test_nocrash3();
872
873/// Foo
874template <typename, typename>
875void test_nocrash4() { }
876
877template <typename>
878void test_nocrash3()
879{
880}
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000881
882// PR13593, example 3
883
884/**
885 * aaa
886 */
887template <typename T>
888inline T test_nocrash5(T a1)
889{
890 return a1;
891}
892
893///
894//,
895
896inline void test_nocrash6()
897{
898 test_nocrash5(1);
899}
900
901// We used to crash on this.
902
903/*!
904 Blah.
905*/
906typedef const struct test_nocrash7 * test_nocrash8;
907
Dmitri Gribenkob0b8a962012-09-11 19:22:03 +0000908// We used to crash on this.
909
Fariborz Jahanianad6fd9f2013-05-03 23:15:20 +0000910// expected-warning@+1 {{unknown command tag name}}
Dmitri Gribenkob0b8a962012-09-11 19:22:03 +0000911/// aaa \unknown aaa \unknown aaa
912int test_nocrash9;
913
Dmitri Gribenko10442562013-01-26 00:36:14 +0000914// We used to crash on this. PR15068
915
Fariborz Jahanianc98e9132013-03-01 22:51:30 +0000916// expected-warning@+2 {{empty paragraph passed to '@param' command}}
917// expected-warning@+2 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko10442562013-01-26 00:36:14 +0000918///@param x
919///@param y
920int test_nocrash10(int x, int y);
921
Fariborz Jahanianc98e9132013-03-01 22:51:30 +0000922// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
923// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}}
Dmitri Gribenko10442562013-01-26 00:36:14 +0000924///@param x
925///@param y
926int test_nocrash11();
927
Fariborz Jahanianc98e9132013-03-01 22:51:30 +0000928// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
929// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}}
Dmitri Gribenko10442562013-01-26 00:36:14 +0000930/**
931@param x
932@param y
933**/
934int test_nocrash12();
935
Fariborz Jahanianc98e9132013-03-01 22:51:30 +0000936// expected-warning@+2 {{empty paragraph passed to '@param' command}}
937// expected-warning@+1 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko10442562013-01-26 00:36:14 +0000938///@param x@param y
939int test_nocrash13(int x, int y);
Fariborz Jahanian28c1cd22013-03-07 23:33:11 +0000940
941// rdar://12379114
942// expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
943/*!
944 @union U This is new
945*/
946struct U { int iS; };
947
948/*!
949 @union U1
950*/
951union U1 {int i; };
952
953// expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
954/*!
955 @struct S2
956*/
957union S2 {};
958
959/*!
960 @class C1
961*/
962class C1;
963
964/*!
965 @struct S3;
966*/
967class S3;
Fariborz Jahanian2d588b42013-06-19 18:08:03 +0000968
969// rdar://14124702
970//----------------------------------------------------------------------
971/// @class Predicate Predicate.h "lldb/Host/Predicate.h"
972/// @brief A C++ wrapper class for providing threaded access to a value
973/// of type T.
974///
975/// A templatized class.
976/// specified values.
977//----------------------------------------------------------------------
978template <class T, class T1>
979class Predicate
980{
981};
982
983//----------------------------------------------------------------------
984/// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
985/// @brief A C++ wrapper class for providing threaded access to a value
986/// of type T.
987///
988/// A template specilization class.
989//----------------------------------------------------------------------
990template<> class Predicate<int, char>
991{
992};
993
994//----------------------------------------------------------------------
995/// @class Predicate<T, int> 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 partial specialization template class.
1000//----------------------------------------------------------------------
1001template<class T> class Predicate<T, int>
1002{
1003};
1004
1005/*! @function test_function
1006*/
1007template <class T> T test_function (T arg);
1008
1009/*! @function test_function<int>
1010*/
1011template <> int test_function<int> (int arg);