blob: 7166a4990945f1a5a3f726accce2ef9fb46ed7c6 [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
Dmitri Gribenkoc5b00542013-06-24 04:41:32 +0000308/// \param aaa Aaa
309/// \param ... Vararg
310int test_vararg_param1(int aaa, ...);
311
312/// \param ... Vararg
313int test_vararg_param2(...);
314
315// expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
316/// \param ... Vararg
317int test_vararg_param3(int aaa);
318
319// expected-warning@+1 {{parameter '...' not found in the function declaration}}
320/// \param ... Vararg
321int test_vararg_param4();
322
323
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000324// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
325/// \tparam T Aaa
326int test_tparam1;
327
328// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
329/// \tparam T Aaa
330void test_tparam2(int aaa);
331
332// expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
333/// \tparam
334/// \param aaa Blah blah
335template<typename T>
336void test_tparam3(T aaa);
337
338// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
339/// \tparam T Aaa
340template<typename TT>
341void test_tparam4(TT aaa);
342
343// expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
344/// \tparam T Aaa
345template<typename TT>
346class test_tparam5 {
347 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
348 /// \tparam T Aaa
349 template<typename TTT>
350 void test_tparam6(TTT aaa);
351};
352
353/// \tparam T1 Aaa
354/// \tparam T2 Bbb
355template<typename T1, typename T2>
356void test_tparam7(T1 aaa, T2 bbb);
357
358// expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
359/// \tparam SomTy Aaa
360/// \tparam OtherTy Bbb
361template<typename SomeTy, typename OtherTy>
362void test_tparam8(SomeTy aaa, OtherTy bbb);
363
364// expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
365/// \tparam T1 Aaa
366/// \tparam T1 Bbb
367template<typename T1, typename T2>
368void test_tparam9(T1 aaa, T2 bbb);
369
370/// \tparam T Aaa
371/// \tparam TT Bbb
372template<template<typename T> class TT>
373void test_tparam10(TT<int> aaa);
374
375/// \tparam T Aaa
376/// \tparam TT Bbb
377/// \tparam TTT Ccc
378template<template<template<typename T> class TT, class C> class TTT>
379void test_tparam11();
380
381/// \tparam I Aaa
382template<int I>
383void test_tparam12();
384
Dmitri Gribenko967e5d72012-08-02 21:36:57 +0000385template<typename T, typename U>
386class test_tparam13 { };
387
388/// \tparam T Aaa
389template<typename T>
390using test_tparam14 = test_tparam13<T, int>;
391
392// expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
393/// \tparam U Aaa
394template<typename T>
395using test_tparam15 = test_tparam13<T, int>;
396
Dmitri Gribenkod1e5c0d2013-01-27 21:18:39 +0000397// ----
398
399/// \tparam T Aaa
400template<typename T>
401class test_tparam16 { };
402
403typedef test_tparam16<int> test_tparam17;
404typedef test_tparam16<double> test_tparam18;
405
406// ----
407
408template<typename T>
409class test_tparam19;
410
411typedef test_tparam19<int> test_tparam20;
412typedef test_tparam19<double> test_tparam21;
413
414/// \tparam T Aaa
415template<typename T>
416class test_tparam19 { };
417
418// ----
419
Dmitri Gribenko8cc9c9d2013-03-04 20:23:16 +0000420// expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
421/// @tparam T Aaa
422int test_tparam22;
423
424// ----
425
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000426
427/// Aaa
428/// \deprecated Bbb
Dmitri Gribenko0bd98382012-09-22 21:47:50 +0000429void test_deprecated_1(int a) __attribute__((deprecated));
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000430
431// We don't want \deprecated to warn about empty paragraph. It is fine to use
432// \deprecated by itself without explanations.
433
434/// Aaa
435/// \deprecated
Dmitri Gribenko0bd98382012-09-22 21:47:50 +0000436void test_deprecated_2(int a) __attribute__((deprecated));
437
438/// Aaa
439/// \deprecated
440void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
441
442/// Aaa
443/// \deprecated
444void test_deprecated_4(int a) __attribute__((unavailable));
445
446// 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}}
447/// Aaa
448/// \deprecated
449void test_deprecated_5(int a);
450
451// 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}}
452/// Aaa
453/// \deprecated
454void test_deprecated_6(int a) {
455}
456
457// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
458/// Aaa
459/// \deprecated
460template<typename T>
461void test_deprecated_7(T aaa);
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +0000462
463
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000464// rdar://12397511
465// expected-note@+2 {{previous command '\headerfile' here}}
466// expected-warning@+2 {{duplicated command '\headerfile'}}
467/// \headerfile ""
468/// \headerfile foo.h
469int test__headerfile_1(int a);
470
471
Dmitri Gribenko388a5942012-09-14 15:37:29 +0000472/// \invariant aaa
473void test_invariant_1(int a);
474
475// expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
476/// \invariant
477void test_invariant_2(int a);
478
479
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000480// no-warning
481/// \returns Aaa
482int test_returns_right_decl_1(int);
483
484class test_returns_right_decl_2 {
485 // no-warning
486 /// \returns Aaa
487 int test_returns_right_decl_3(int);
488};
489
490// no-warning
491/// \returns Aaa
492template<typename T>
493int test_returns_right_decl_4(T aaa);
494
495// no-warning
496/// \returns Aaa
497template<>
498int test_returns_right_decl_4(int aaa);
499
500/// \returns Aaa
501template<typename T>
502T test_returns_right_decl_5(T aaa);
503
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000504// 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 +0000505/// \returns Aaa
506int test_returns_wrong_decl_1;
507
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000508// 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 +0000509/// \return Aaa
510int test_returns_wrong_decl_2;
511
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000512// 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 +0000513/// \result Aaa
514int test_returns_wrong_decl_3;
515
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000516// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000517/// \returns Aaa
518void test_returns_wrong_decl_4(int);
519
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000520// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000521/// \returns Aaa
522template<typename T>
523void test_returns_wrong_decl_5(T aaa);
524
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000525// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000526/// \returns Aaa
527template<>
528void test_returns_wrong_decl_5(int aaa);
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
532struct test_returns_wrong_decl_6 { };
533
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000534// 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 +0000535/// \returns Aaa
536class test_returns_wrong_decl_7 {
537 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
538 /// \returns Aaa
539 test_returns_wrong_decl_7();
540
541 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
542 /// \returns Aaa
543 ~test_returns_wrong_decl_7();
544};
545
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000546// 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 +0000547/// \returns Aaa
548enum test_returns_wrong_decl_8 {
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000549 // 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 +0000550 /// \returns Aaa
551 test_returns_wrong_decl_9
552};
553
Dmitri Gribenko88815f32012-08-06 16:29:26 +0000554// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
Dmitri Gribenko89ab7d02012-08-03 21:15:32 +0000555/// \returns Aaa
556namespace test_returns_wrong_decl_10 { };
557
Dmitri Gribenko151b2ac2013-03-04 19:39:33 +0000558// rdar://13066276
559// expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
560/// @returns Aaa
561typedef unsigned int test_returns_wrong_decl_11;
562
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000563// rdar://13094352
Fariborz Jahanian99a70572013-03-05 22:46:07 +0000564// expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000565/*! @function test_function
566*/
567typedef unsigned int Base64Flags;
568unsigned test_function(Base64Flags inFlags);
569
Fariborz Jahanian99a70572013-03-05 22:46:07 +0000570// 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 +0000571/*! @callback test_callback
572*/
573typedef unsigned int BaseFlags;
574unsigned (*test_callback)(BaseFlags inFlags);
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000575
Dmitri Gribenko36cbbe92012-11-18 00:30:31 +0000576// expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
577/// \endverbatim
578int test_verbatim_1();
579
580// expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
581/// \endcode
582int test_verbatim_2();
583
584// FIXME: we give a bad diagnostic here because we throw away non-documentation
585// comments early.
586//
NAKAMURA Takumibf823c02012-11-18 02:34:33 +0000587// expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
Dmitri Gribenko36cbbe92012-11-18 00:30:31 +0000588/// \code
589// foo
590/// \endcode
591int test_verbatim_3();
592
593
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000594// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000595int test1; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000596
597// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
598// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000599int test2, ///< \brief\author Aaa
600 test3; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000601
602// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
603int test4; ///< \brief
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000604 ///< \author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000605
606
Dmitri Gribenko6969e432013-06-23 23:33:14 +0000607class TestRelates {};
608
609/// \relates TestRelates
610/// \brief Aaa
611void test_relates_1();
612
613/// \related TestRelates
614/// \brief Aaa
615void test_relates_2();
616
617/// \relatesalso TestRelates
618/// \brief Aaa
619void test_relates_3();
620
621/// \relatedalso TestRelates
622/// \brief Aaa
623void test_relates_4();
624
625
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000626// Check that we attach the comment to the declaration during parsing in the
627// following cases. The test is based on the fact that we don't parse
628// documentation comments that are not attached to anything.
629
630// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000631/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000632int test_attach1;
633
634// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000635/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000636int test_attach2(int);
637
638// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000639/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000640struct test_attach3 {
641 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000642 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000643 int test_attach4;
644
645 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000646 int test_attach5; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000647
648 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000649 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000650 int test_attach6(int);
651};
652
653// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000654/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000655class test_attach7 {
656 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000657 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000658 int test_attach8;
659
660 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000661 int test_attach9; ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000662
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 +0000665 int test_attach10(int);
666};
667
668// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000669/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000670enum test_attach9 {
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 +0000673 test_attach10,
674
675 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000676 test_attach11 ///< \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000677};
678
679// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000680/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000681struct test_noattach12 *test_attach13;
682
683// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000684/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000685typedef struct test_noattach14 *test_attach15;
686
687// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000688/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000689typedef struct test_attach16 { int a; } test_attach17;
690
691struct S { int a; };
692
693// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000694/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000695struct S *test_attach18;
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 +0000699typedef struct S *test_attach19;
700
701// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000702/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000703struct test_attach20;
704
705// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000706/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000707typedef struct test_attach21 {
708 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000709 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000710 int test_attach22;
711} test_attach23;
712
713// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000714/// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000715namespace test_attach24 {
716 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000717 /// \brief\author Aaa
Dmitri Gribenkoa5ef44f2012-07-11 21:38:39 +0000718 namespace test_attach25 {
719 }
720}
721
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000722// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000723/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000724/// \tparam T Aaa
725template<typename T>
726void test_attach26(T aaa);
727
728// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000729/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000730/// \tparam T Aaa
731template<typename T, typename U>
732void test_attach27(T aaa, U bbb);
733
734// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
735// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000736/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000737/// \tparam T Aaa
738template<>
739void test_attach27(int aaa, int bbb);
740
741// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000742/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000743/// \tparam T Aaa
744template<typename T>
745class test_attach28 {
746 T aaa;
747};
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 +0000751using test_attach29 = test_attach28<int>;
752
753// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000754/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000755/// \tparam T Aaa
756template<typename T, typename U>
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000757class test_attach30 { };
758
759// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000760/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000761/// \tparam T Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000762template<typename T>
763class test_attach30<T, int> { };
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 +0000767template<>
768class test_attach30<int, int> { };
769
770// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000771/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000772template<typename T>
773using test_attach31 = test_attach30<T, int>;
774
775// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000776/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000777/// \tparam T Aaa
778template<typename T, typename U, typename V>
779class test_attach32 { };
780
781// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000782/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000783/// \tparam T Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000784template<typename T, typename U>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000785class test_attach32<T, U, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000786
787// 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
790template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000791class test_attach32<T, int, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000792
793// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
794// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000795/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000796/// \tparam T Aaa
797template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000798class test_attach32<int, int, int> { };
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000799
800// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000801/// \brief\author Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000802class test_attach33 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000803 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000804 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000805 /// \tparam T Aaa
806 template<typename T, typename U>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000807 void test_attach34(T aaa, U bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000808};
809
810template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000811class test_attach35 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000812 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
813 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000814 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000815 /// \tparam T Aaa
816 template<typename TT, typename UU>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000817 void test_attach36(TT aaa, UU bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000818};
819
820// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
821// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000822/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000823/// \tparam T Aaa
824template<> template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000825void test_attach35<int>::test_attach36(int aaa, int bbb) {}
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000826
827template<typename T>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000828class test_attach37 {
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000829 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
830 // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000831 /// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000832 /// \tparam T Aaa
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000833 void test_attach38(int aaa, int bbb);
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000834
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000835 void test_attach39(int aaa, int bbb);
836};
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000837
838// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
839// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
Dmitri Gribenko9443c572012-08-06 17:08:27 +0000840/// \brief\author Aaa
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000841/// \tparam T Aaa
842template<>
Dmitri Gribenkoc27bc802012-08-02 20:49:51 +0000843void test_attach37<int>::test_attach38(int aaa, int bbb) {}
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000844
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000845// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
846/// \brief\author Aaa
847/// \tparam T Aaa
848template<typename T>
849void test_attach37<T>::test_attach39(int aaa, int bbb) {}
850
Dmitri Gribenko1599eac2012-08-16 18:19:43 +0000851// We used to emit warning that parameter 'a' is not found because we parsed
852// the comment in context of the redeclaration which does not have parameter
853// names.
854template <typename T>
855struct test_attach38 {
856 /*!
857 \param a First param
858 \param b Second param
859 */
860 template <typename B>
861 void test_attach39(T a, B b);
862};
863
864template <>
865template <typename B>
866void test_attach38<int>::test_attach39(int, B);
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000867
Dmitri Gribenko96b09862012-07-31 22:37:06 +0000868
Dmitri Gribenko9f08f492012-07-20 20:18:53 +0000869// PR13411, reduced. We used to crash on this.
870/**
871 * @code Aaa.
872 */
873void test_nocrash1(int);
874
Dmitri Gribenkoe5deb792012-07-30 18:05:28 +0000875// We used to crash on this.
876// expected-warning@+2 {{empty paragraph passed to '\param' command}}
877// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
878/// \param\brief
879void test_nocrash2(int);
880
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000881// PR13593, example 1 and 2
Douglas Gregorcd81df22012-08-13 16:37:30 +0000882
883/**
884* Bla.
885*/
886template <typename>
887void test_nocrash3();
888
889/// Foo
890template <typename, typename>
891void test_nocrash4() { }
892
893template <typename>
894void test_nocrash3()
895{
896}
Dmitri Gribenkoc41ace92012-08-14 17:17:18 +0000897
898// PR13593, example 3
899
900/**
901 * aaa
902 */
903template <typename T>
904inline T test_nocrash5(T a1)
905{
906 return a1;
907}
908
909///
910//,
911
912inline void test_nocrash6()
913{
914 test_nocrash5(1);
915}
916
917// We used to crash on this.
918
919/*!
920 Blah.
921*/
922typedef const struct test_nocrash7 * test_nocrash8;
923
Dmitri Gribenkob0b8a962012-09-11 19:22:03 +0000924// We used to crash on this.
925
Fariborz Jahanianad6fd9f2013-05-03 23:15:20 +0000926// expected-warning@+1 {{unknown command tag name}}
Dmitri Gribenkob0b8a962012-09-11 19:22:03 +0000927/// aaa \unknown aaa \unknown aaa
928int test_nocrash9;
929
Dmitri Gribenko10442562013-01-26 00:36:14 +0000930// We used to crash on this. PR15068
931
Fariborz Jahanianc98e9132013-03-01 22:51:30 +0000932// expected-warning@+2 {{empty paragraph passed to '@param' command}}
933// expected-warning@+2 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko10442562013-01-26 00:36:14 +0000934///@param x
935///@param y
936int test_nocrash10(int x, int y);
937
Fariborz Jahanianc98e9132013-03-01 22:51:30 +0000938// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
939// 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 +0000940///@param x
941///@param y
942int test_nocrash11();
943
Fariborz Jahanianc98e9132013-03-01 22:51:30 +0000944// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
945// 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 +0000946/**
947@param x
948@param y
949**/
950int test_nocrash12();
951
Fariborz Jahanianc98e9132013-03-01 22:51:30 +0000952// expected-warning@+2 {{empty paragraph passed to '@param' command}}
953// expected-warning@+1 {{empty paragraph passed to '@param' command}}
Dmitri Gribenko10442562013-01-26 00:36:14 +0000954///@param x@param y
955int test_nocrash13(int x, int y);
Fariborz Jahanian28c1cd22013-03-07 23:33:11 +0000956
957// rdar://12379114
958// expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
959/*!
960 @union U This is new
961*/
962struct U { int iS; };
963
964/*!
965 @union U1
966*/
967union U1 {int i; };
968
969// expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
970/*!
971 @struct S2
972*/
973union S2 {};
974
975/*!
976 @class C1
977*/
978class C1;
979
980/*!
981 @struct S3;
982*/
983class S3;
Fariborz Jahanian2d588b42013-06-19 18:08:03 +0000984
985// rdar://14124702
986//----------------------------------------------------------------------
987/// @class Predicate Predicate.h "lldb/Host/Predicate.h"
988/// @brief A C++ wrapper class for providing threaded access to a value
989/// of type T.
990///
991/// A templatized class.
992/// specified values.
993//----------------------------------------------------------------------
994template <class T, class T1>
995class Predicate
996{
997};
998
999//----------------------------------------------------------------------
1000/// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
1001/// @brief A C++ wrapper class for providing threaded access to a value
1002/// of type T.
1003///
1004/// A template specilization class.
1005//----------------------------------------------------------------------
1006template<> class Predicate<int, char>
1007{
1008};
1009
1010//----------------------------------------------------------------------
1011/// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
1012/// @brief A C++ wrapper class for providing threaded access to a value
1013/// of type T.
1014///
1015/// A partial specialization template class.
1016//----------------------------------------------------------------------
1017template<class T> class Predicate<T, int>
1018{
1019};
1020
1021/*! @function test_function
1022*/
1023template <class T> T test_function (T arg);
1024
1025/*! @function test_function<int>
1026*/
1027template <> int test_function<int> (int arg);