warn-documentation.cpp revision 97e5bc2643dd1478ca10d1b9a6581f332801c958
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s
2
3// 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
7// 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}}
16// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
17/// <a href= blah
18int test_html3(int);
19
20// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
21/// <a =>
22int test_html4(int);
23
24// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
25/// <a "aaa">
26int test_html5(int);
27
28// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
29/// <a a="b" =>
30int test_html6(int);
31
32// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
33/// <a a="b" "aaa">
34int test_html7(int);
35
36// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
37/// <a a="b" =
38int test_html8(int);
39
40// expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}}
41/** Aaa bbb<img ddd eee
42 * fff ggg.
43 */
44int test_html9(int);
45
46// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
47/** Aaa bbb<img ddd eee 42%
48 * fff ggg.
49 */
50int test_html10(int);
51
52// expected-warning@+1 {{HTML end tag 'br' is forbidden}}
53/// <br></br>
54int test_html11(int);
55
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
70// expected-warning@+1 {{HTML end tag does not match any start tag}}
71/// <b><i>Meow</a>
72int test_html_nesting5(int);
73
74// expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
75// expected-warning@+1 {{HTML end tag does not match any start tag}}
76/// <b><i>Meow</b></b>
77int test_html_nesting6(int);
78
79// expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
80// expected-warning@+1 {{HTML end tag does not match any start tag}}
81/// <b><i>Meow</b></i>
82int test_html_nesting7(int);
83
84
85// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
86/// \brief\returns Aaa
87int test_block_command1(int);
88
89// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
90/// \brief \returns Aaa
91int test_block_command2(int);
92
93// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
94/// \brief
95/// \returns Aaa
96int test_block_command3(int);
97
98// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
99/// \brief
100///
101/// \returns Aaa
102int 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///
108/// \returns Aaa
109int test_block_command5(int);
110
111/// \brief \c Aaa
112int test_block_command6(int);
113
114// 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
139/// \return Aaa
140///
141/// Bbb
142///
143/// \return Ccc
144int test_multiple_returns1(int);
145
146/// \returns Aaa
147///
148/// Bbb
149///
150/// \returns Ccc
151int test_multiple_returns2(int);
152
153/// \result Aaa
154///
155/// Bbb
156///
157/// \result Ccc
158int test_multiple_returns3(int);
159
160/// \returns Aaa
161///
162/// Bbb
163///
164/// \return Ccc
165int test_multiple_returns4(int);
166
167
168// 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
205// expected-warning@+1 {{parameter 'a' not found in the function declaration}}
206/// \param a Blah blah.
207int test_param11();
208
209// expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
210/// \param A Blah blah.
211int test_param12(int a);
212
213// expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
214/// \param aab Blah blah.
215int test_param13(int aaa, int bbb);
216
217// 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
222// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
223/// \param aab Blah blah.
224int 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);
243
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.
251 int test_param19(int bbb, int ccc);
252};
253
254// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
255/// \param aab Blah blah.
256template<typename T>
257void test_param20(int bbb, int ccc);
258
259// expected-warning@+3 {{parameter 'a' is already documented}}
260// expected-note@+1 {{previous documentation}}
261/// \param a Aaa.
262/// \param a Aaa.
263int test_param21(int a);
264
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.
270int test_param22(int x1, int x2, int x3);
271
272// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
273/// \param aaa Meow.
274/// \param bbb Bbb.
275/// \returns aaa.
276typedef int test_param23(int aaa, int ccc);
277
278// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
279/// \param aaa Meow.
280/// \param bbb Bbb.
281/// \returns aaa.
282typedef int (*test_param24)(int aaa, int ccc);
283
284// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
285/// \param aaa Meow.
286/// \param bbb Bbb.
287/// \returns aaa.
288typedef int (* const test_param25)(int aaa, int ccc);
289
290// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
291/// \param aaa Meow.
292/// \param bbb Bbb.
293/// \returns aaa.
294typedef int (C::*test_param26)(int aaa, int ccc);
295
296typedef 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
302// 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
307
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
369template<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
381// ----
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
404// 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
410
411/// Aaa
412/// \deprecated Bbb
413void test_deprecated_1(int a) __attribute__((deprecated));
414
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
420void 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);
446
447
448// 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
456/// \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
464// 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
488// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
489/// \returns Aaa
490int test_returns_wrong_decl_1;
491
492// expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
493/// \return Aaa
494int test_returns_wrong_decl_2;
495
496// expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}}
497/// \result Aaa
498int test_returns_wrong_decl_3;
499
500// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
501/// \returns Aaa
502void test_returns_wrong_decl_4(int);
503
504// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
505/// \returns Aaa
506template<typename T>
507void test_returns_wrong_decl_5(T aaa);
508
509// expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
510/// \returns Aaa
511template<>
512void test_returns_wrong_decl_5(int aaa);
513
514// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
515/// \returns Aaa
516struct test_returns_wrong_decl_6 { };
517
518// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
519/// \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
530// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
531/// \returns Aaa
532enum test_returns_wrong_decl_8 {
533  // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
534  /// \returns Aaa
535  test_returns_wrong_decl_9
536};
537
538// expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
539/// \returns Aaa
540namespace test_returns_wrong_decl_10 { };
541
542// 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
547// rdar://13094352
548// expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
549/*!	@function test_function
550*/
551typedef unsigned int Base64Flags;
552unsigned test_function(Base64Flags inFlags);
553
554// expected-warning@+1 {{'@callback' command should be used in a comment attached to a pointer to function declaration}}
555/*! @callback test_callback
556*/
557typedef unsigned int BaseFlags;
558unsigned (*test_callback)(BaseFlags inFlags);
559
560// 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//
571// expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
572/// \code
573//  foo
574/// \endcode
575int test_verbatim_3();
576
577
578// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
579int test1; ///< \brief\author Aaa
580
581// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
582// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
583int test2, ///< \brief\author Aaa
584    test3; ///< \brief\author Aaa
585
586// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
587int test4; ///< \brief
588           ///< \author Aaa
589
590
591// Check that we attach the comment to the declaration during parsing in the
592// following cases.  The test is based on the fact that we don't parse
593// documentation comments that are not attached to anything.
594
595// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
596/// \brief\author Aaa
597int test_attach1;
598
599// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
600/// \brief\author Aaa
601int test_attach2(int);
602
603// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
604/// \brief\author Aaa
605struct test_attach3 {
606  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
607  /// \brief\author Aaa
608  int test_attach4;
609
610  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
611  int test_attach5; ///< \brief\author Aaa
612
613  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
614  /// \brief\author Aaa
615  int test_attach6(int);
616};
617
618// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
619/// \brief\author Aaa
620class test_attach7 {
621  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
622  /// \brief\author Aaa
623  int test_attach8;
624
625  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
626  int test_attach9; ///< \brief\author Aaa
627
628  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
629  /// \brief\author Aaa
630  int test_attach10(int);
631};
632
633// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
634/// \brief\author Aaa
635enum test_attach9 {
636  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
637  /// \brief\author Aaa
638  test_attach10,
639
640  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
641  test_attach11 ///< \brief\author Aaa
642};
643
644// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
645/// \brief\author Aaa
646struct test_noattach12 *test_attach13;
647
648// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
649/// \brief\author Aaa
650typedef struct test_noattach14 *test_attach15;
651
652// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
653/// \brief\author Aaa
654typedef struct test_attach16 { int a; } test_attach17;
655
656struct S { int a; };
657
658// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
659/// \brief\author Aaa
660struct S *test_attach18;
661
662// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
663/// \brief\author Aaa
664typedef struct S *test_attach19;
665
666// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
667/// \brief\author Aaa
668struct test_attach20;
669
670// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
671/// \brief\author Aaa
672typedef struct test_attach21 {
673  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
674  /// \brief\author Aaa
675  int test_attach22;
676} test_attach23;
677
678// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
679/// \brief\author Aaa
680namespace test_attach24 {
681  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
682  /// \brief\author Aaa
683  namespace test_attach25 {
684  }
685}
686
687// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
688/// \brief\author Aaa
689/// \tparam T Aaa
690template<typename T>
691void test_attach26(T aaa);
692
693// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
694/// \brief\author Aaa
695/// \tparam T Aaa
696template<typename T, typename U>
697void test_attach27(T aaa, U bbb);
698
699// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
700// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
701/// \brief\author Aaa
702/// \tparam T Aaa
703template<>
704void test_attach27(int aaa, int bbb);
705
706// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
707/// \brief\author Aaa
708/// \tparam T Aaa
709template<typename T>
710class test_attach28 {
711  T aaa;
712};
713
714// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
715/// \brief\author Aaa
716using test_attach29 = test_attach28<int>;
717
718// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
719/// \brief\author Aaa
720/// \tparam T Aaa
721template<typename T, typename U>
722class test_attach30 { };
723
724// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
725/// \brief\author Aaa
726/// \tparam T Aaa
727template<typename T>
728class test_attach30<T, int> { };
729
730// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
731/// \brief\author Aaa
732template<>
733class test_attach30<int, int> { };
734
735// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
736/// \brief\author Aaa
737template<typename T>
738using test_attach31 = test_attach30<T, int>;
739
740// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
741/// \brief\author Aaa
742/// \tparam T Aaa
743template<typename T, typename U, typename V>
744class test_attach32 { };
745
746// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
747/// \brief\author Aaa
748/// \tparam T Aaa
749template<typename T, typename U>
750class test_attach32<T, U, int> { };
751
752// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
753/// \brief\author Aaa
754/// \tparam T Aaa
755template<typename T>
756class test_attach32<T, int, int> { };
757
758// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
759// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
760/// \brief\author Aaa
761/// \tparam T Aaa
762template<>
763class test_attach32<int, int, int> { };
764
765// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
766/// \brief\author Aaa
767class test_attach33 {
768  // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
769  /// \brief\author Aaa
770  /// \tparam T Aaa
771  template<typename T, typename U>
772  void test_attach34(T aaa, U bbb);
773};
774
775template<typename T>
776class test_attach35 {
777  // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
778  // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
779  /// \brief\author Aaa
780  /// \tparam T Aaa
781  template<typename TT, typename UU>
782  void test_attach36(TT aaa, UU bbb);
783};
784
785// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
786// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
787/// \brief\author Aaa
788/// \tparam T Aaa
789template<> template<>
790void test_attach35<int>::test_attach36(int aaa, int bbb) {}
791
792template<typename T>
793class test_attach37 {
794  // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
795  // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
796  /// \brief\author Aaa
797  /// \tparam T Aaa
798  void test_attach38(int aaa, int bbb);
799
800  void test_attach39(int aaa, int bbb);
801};
802
803// expected-warning@+2 {{empty paragraph passed to '\brief' command}}
804// expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
805/// \brief\author Aaa
806/// \tparam T Aaa
807template<>
808void test_attach37<int>::test_attach38(int aaa, int bbb) {}
809
810// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
811/// \brief\author Aaa
812/// \tparam T Aaa
813template<typename T>
814void test_attach37<T>::test_attach39(int aaa, int bbb) {}
815
816// We used to emit warning that parameter 'a' is not found because we parsed
817// the comment in context of the redeclaration which does not have parameter
818// names.
819template <typename T>
820struct test_attach38 {
821  /*!
822    \param a  First param
823    \param b  Second param
824  */
825  template <typename B>
826  void test_attach39(T a, B b);
827};
828
829template <>
830template <typename B>
831void test_attach38<int>::test_attach39(int, B);
832
833
834// PR13411, reduced.  We used to crash on this.
835/**
836 * @code Aaa.
837 */
838void test_nocrash1(int);
839
840// We used to crash on this.
841// expected-warning@+2 {{empty paragraph passed to '\param' command}}
842// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
843/// \param\brief
844void test_nocrash2(int);
845
846// PR13593, example 1 and 2
847
848/**
849* Bla.
850*/
851template <typename>
852void test_nocrash3();
853
854/// Foo
855template <typename, typename>
856void test_nocrash4() { }
857
858template <typename>
859void test_nocrash3()
860{
861}
862
863// PR13593, example 3
864
865/**
866 * aaa
867 */
868template <typename T>
869inline T test_nocrash5(T a1)
870{
871    return a1;
872}
873
874///
875//,
876
877inline void test_nocrash6()
878{
879    test_nocrash5(1);
880}
881
882// We used to crash on this.
883
884/*!
885  Blah.
886*/
887typedef const struct test_nocrash7 * test_nocrash8;
888
889// We used to crash on this.
890
891// expected-warning@+1 {{unknown command tag name}}
892/// aaa \unknown aaa \unknown aaa
893int test_nocrash9;
894
895// We used to crash on this.  PR15068
896
897// expected-warning@+2 {{empty paragraph passed to '@param' command}}
898// expected-warning@+2 {{empty paragraph passed to '@param' command}}
899///@param x
900///@param y
901int test_nocrash10(int x, int y);
902
903// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
904// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}}
905///@param x
906///@param y
907int test_nocrash11();
908
909// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
910// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}}
911/**
912@param x
913@param y
914**/
915int test_nocrash12();
916
917// expected-warning@+2 {{empty paragraph passed to '@param' command}}
918// expected-warning@+1 {{empty paragraph passed to '@param' command}}
919///@param x@param y
920int test_nocrash13(int x, int y);
921
922// rdar://12379114
923// expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
924/*!
925   @union U This is new
926*/
927struct U { int iS; };
928
929/*!
930  @union U1
931*/
932union U1 {int i; };
933
934// expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
935/*!
936 @struct S2
937*/
938union S2 {};
939
940/*!
941  @class C1
942*/
943class C1;
944
945/*!
946  @struct S3;
947*/
948class S3;
949
950// rdar://14124702
951//----------------------------------------------------------------------
952/// @class Predicate Predicate.h "lldb/Host/Predicate.h"
953/// @brief A C++ wrapper class for providing threaded access to a value
954/// of type T.
955///
956/// A templatized class.
957/// specified values.
958//----------------------------------------------------------------------
959template <class T, class T1>
960class Predicate
961{
962};
963
964//----------------------------------------------------------------------
965/// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
966/// @brief A C++ wrapper class for providing threaded access to a value
967/// of type T.
968///
969/// A template specilization class.
970//----------------------------------------------------------------------
971template<> class Predicate<int, char>
972{
973};
974
975//----------------------------------------------------------------------
976/// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
977/// @brief A C++ wrapper class for providing threaded access to a value
978/// of type T.
979///
980/// A partial specialization template class.
981//----------------------------------------------------------------------
982template<class T> class Predicate<T, int>
983{
984};
985
986/*!     @function test_function
987*/
988template <class T> T test_function (T arg);
989
990/*!     @function test_function<int>
991*/
992template <> int test_function<int> (int arg);
993