Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 2 | |
Dmitri Gribenko | 740c0fb | 2012-08-07 17:54:38 +0000 | [diff] [blame] | 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 | |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 7 | // expected-warning@+1 {{expected quoted string after equals sign}} |
| 8 | /// <a href=> |
| 9 | int test_html1(int); |
| 10 | |
| 11 | // expected-warning@+1 {{expected quoted string after equals sign}} |
| 12 | /// <a href==> |
| 13 | int test_html2(int); |
| 14 | |
| 15 | // expected-warning@+2 {{expected quoted string after equals sign}} |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 16 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 17 | /// <a href= blah |
| 18 | int test_html3(int); |
| 19 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 20 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 21 | /// <a => |
| 22 | int test_html4(int); |
| 23 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 24 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 25 | /// <a "aaa"> |
| 26 | int test_html5(int); |
| 27 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 28 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 29 | /// <a a="b" => |
| 30 | int test_html6(int); |
| 31 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 32 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 33 | /// <a a="b" "aaa"> |
| 34 | int test_html7(int); |
| 35 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 36 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 37 | /// <a a="b" = |
| 38 | int test_html8(int); |
| 39 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 40 | // expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}} |
Dmitri Gribenko | 107618a | 2012-08-22 22:56:08 +0000 | [diff] [blame] | 41 | /** Aaa bbb<img ddd eee |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 42 | * fff ggg. |
| 43 | */ |
| 44 | int test_html9(int); |
| 45 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 46 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | 107618a | 2012-08-22 22:56:08 +0000 | [diff] [blame] | 47 | /** Aaa bbb<img ddd eee 42% |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 48 | * fff ggg. |
| 49 | */ |
| 50 | int test_html10(int); |
| 51 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 52 | // expected-warning@+1 {{HTML end tag 'br' is forbidden}} |
Dmitri Gribenko | 9460fbf | 2012-07-12 23:37:09 +0000 | [diff] [blame] | 53 | /// <br></br> |
| 54 | int test_html11(int); |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 55 | |
| 56 | /// <blockquote>Meow</blockquote> |
| 57 | int test_html_nesting1(int); |
| 58 | |
| 59 | /// <b><i>Meow</i></b> |
| 60 | int test_html_nesting2(int); |
| 61 | |
| 62 | /// <p>Aaa<br> |
| 63 | /// Bbb</p> |
| 64 | int test_html_nesting3(int); |
| 65 | |
| 66 | /// <p>Aaa<br /> |
| 67 | /// Bbb</p> |
| 68 | int test_html_nesting4(int); |
| 69 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 70 | // expected-warning@+1 {{HTML end tag does not match any start tag}} |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 71 | /// <b><i>Meow</a> |
| 72 | int test_html_nesting5(int); |
| 73 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 74 | // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}} |
| 75 | // expected-warning@+1 {{HTML end tag does not match any start tag}} |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 76 | /// <b><i>Meow</b></b> |
| 77 | int test_html_nesting6(int); |
| 78 | |
Dmitri Gribenko | e00ffc7 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 79 | // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}} |
| 80 | // expected-warning@+1 {{HTML end tag does not match any start tag}} |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 81 | /// <b><i>Meow</b></i> |
| 82 | int test_html_nesting7(int); |
| 83 | |
| 84 | |
| 85 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 86 | /// \brief\returns Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 87 | int test_block_command1(int); |
| 88 | |
| 89 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 90 | /// \brief \returns Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 91 | int test_block_command2(int); |
| 92 | |
| 93 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 94 | /// \brief |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 95 | /// \returns Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 96 | int test_block_command3(int); |
| 97 | |
| 98 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 99 | /// \brief |
| 100 | /// |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 101 | /// \returns Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 102 | int 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 Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 108 | /// \returns Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 109 | int test_block_command5(int); |
| 110 | |
Dmitri Gribenko | 7b2ca3e | 2012-07-19 00:01:56 +0000 | [diff] [blame] | 111 | /// \brief \c Aaa |
| 112 | int test_block_command6(int); |
| 113 | |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 114 | // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\brief' here}} |
| 115 | /// \brief Aaa |
| 116 | /// |
| 117 | /// Bbb |
| 118 | /// |
| 119 | /// \brief Ccc |
| 120 | int 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 |
| 128 | int 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 |
| 136 | int test_duplicate_brief3(int); |
| 137 | |
| 138 | |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 139 | /// \return Aaa |
| 140 | /// |
| 141 | /// Bbb |
| 142 | /// |
| 143 | /// \return Ccc |
Dmitri Gribenko | d666293 | 2013-06-22 23:03:37 +0000 | [diff] [blame] | 144 | int test_multiple_returns1(int); |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 145 | |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 146 | /// \returns Aaa |
| 147 | /// |
| 148 | /// Bbb |
| 149 | /// |
| 150 | /// \returns Ccc |
Dmitri Gribenko | d666293 | 2013-06-22 23:03:37 +0000 | [diff] [blame] | 151 | int test_multiple_returns2(int); |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 152 | |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 153 | /// \result Aaa |
| 154 | /// |
| 155 | /// Bbb |
| 156 | /// |
| 157 | /// \result Ccc |
Dmitri Gribenko | d666293 | 2013-06-22 23:03:37 +0000 | [diff] [blame] | 158 | int test_multiple_returns3(int); |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 159 | |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 160 | /// \returns Aaa |
| 161 | /// |
| 162 | /// Bbb |
| 163 | /// |
| 164 | /// \return Ccc |
Dmitri Gribenko | d666293 | 2013-06-22 23:03:37 +0000 | [diff] [blame] | 165 | int test_multiple_returns4(int); |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 166 | |
| 167 | |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 168 | // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}} |
| 169 | /// \param a Blah blah. |
Dmitri Gribenko | f869ad1 | 2013-12-17 19:45:12 +0000 | [diff] [blame] | 170 | int test_param1_backslash; |
| 171 | |
| 172 | // rdar://13066276 |
| 173 | // Check that the diagnostic uses the same command marker as the comment. |
| 174 | // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}} |
| 175 | /// @param a Blah blah. |
| 176 | int test_param1_at; |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 177 | |
| 178 | // expected-warning@+1 {{empty paragraph passed to '\param' command}} |
| 179 | /// \param |
| 180 | /// \param a Blah blah. |
| 181 | int test_param2(int a); |
| 182 | |
| 183 | // expected-warning@+1 {{empty paragraph passed to '\param' command}} |
| 184 | /// \param a |
| 185 | int test_param3(int a); |
| 186 | |
| 187 | /// \param a Blah blah. |
| 188 | int test_param4(int a); |
| 189 | |
| 190 | /// \param [in] a Blah blah. |
| 191 | int test_param5(int a); |
| 192 | |
| 193 | /// \param [out] a Blah blah. |
| 194 | int test_param6(int a); |
| 195 | |
| 196 | /// \param [in,out] a Blah blah. |
| 197 | int test_param7(int a); |
| 198 | |
| 199 | // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}} |
| 200 | /// \param [ in ] a Blah blah. |
| 201 | int test_param8(int a); |
| 202 | |
| 203 | // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}} |
| 204 | /// \param [in, out] a Blah blah. |
| 205 | int test_param9(int a); |
| 206 | |
| 207 | // expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}} |
| 208 | /// \param [ junk] a Blah blah. |
| 209 | int test_param10(int a); |
| 210 | |
Dmitri Gribenko | 3c54128 | 2012-07-24 21:56:59 +0000 | [diff] [blame] | 211 | // expected-warning@+1 {{parameter 'a' not found in the function declaration}} |
Dmitri Gribenko | 5b8a1d4 | 2012-07-24 21:46:24 +0000 | [diff] [blame] | 212 | /// \param a Blah blah. |
| 213 | int test_param11(); |
| 214 | |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 215 | // expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}} |
| 216 | /// \param A Blah blah. |
Dmitri Gribenko | 5b8a1d4 | 2012-07-24 21:46:24 +0000 | [diff] [blame] | 217 | int test_param12(int a); |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 218 | |
| 219 | // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}} |
| 220 | /// \param aab Blah blah. |
Dmitri Gribenko | 5b8a1d4 | 2012-07-24 21:46:24 +0000 | [diff] [blame] | 221 | int test_param13(int aaa, int bbb); |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 222 | |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 223 | // expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}} |
| 224 | /// \param aaa Blah blah. |
| 225 | /// \param aab Blah blah. |
| 226 | int test_param14(int aaa, int bbb); |
| 227 | |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 228 | // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} |
| 229 | /// \param aab Blah blah. |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 230 | int test_param15(int bbb, int ccc); |
| 231 | |
| 232 | // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} |
| 233 | /// \param aab Ccc. |
| 234 | /// \param aaa Aaa. |
| 235 | /// \param bbb Bbb. |
| 236 | int test_param16(int aaa, int bbb); |
| 237 | |
| 238 | // expected-warning@+2 {{parameter 'aab' not found in the function declaration}} |
| 239 | /// \param aaa Aaa. |
| 240 | /// \param aab Ccc. |
| 241 | /// \param bbb Bbb. |
| 242 | int test_param17(int aaa, int bbb); |
| 243 | |
| 244 | // expected-warning@+3 {{parameter 'aab' not found in the function declaration}} |
| 245 | /// \param aaa Aaa. |
| 246 | /// \param bbb Bbb. |
| 247 | /// \param aab Ccc. |
| 248 | int test_param18(int aaa, int bbb); |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 249 | |
| 250 | class C { |
| 251 | // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}} |
| 252 | /// \param aaa Blah blah. |
| 253 | C(int bbb, int ccc); |
| 254 | |
| 255 | // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}} |
| 256 | /// \param aaa Blah blah. |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 257 | int test_param19(int bbb, int ccc); |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 258 | }; |
| 259 | |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 260 | // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} |
| 261 | /// \param aab Blah blah. |
| 262 | template<typename T> |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 263 | void test_param20(int bbb, int ccc); |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 264 | |
Dmitri Gribenko | 8f0f1b0 | 2012-07-24 21:44:16 +0000 | [diff] [blame] | 265 | // expected-warning@+3 {{parameter 'a' is already documented}} |
| 266 | // expected-note@+1 {{previous documentation}} |
| 267 | /// \param a Aaa. |
| 268 | /// \param a Aaa. |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 269 | int test_param21(int a); |
Dmitri Gribenko | 8f0f1b0 | 2012-07-24 21:44:16 +0000 | [diff] [blame] | 270 | |
| 271 | // expected-warning@+4 {{parameter 'x2' is already documented}} |
| 272 | // expected-note@+2 {{previous documentation}} |
| 273 | /// \param x1 Aaa. |
| 274 | /// \param x2 Bbb. |
| 275 | /// \param x2 Ccc. |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 276 | int test_param22(int x1, int x2, int x3); |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 277 | |
Dmitri Gribenko | fa68a57 | 2013-12-17 22:06:11 +0000 | [diff] [blame] | 278 | //===--- |
| 279 | // Test that we treat typedefs to some non-function types as functions for the |
| 280 | // purposes of documentation comment parsing. |
| 281 | //===--- |
| 282 | |
| 283 | namespace foo { |
| 284 | inline namespace bar { |
| 285 | template<typename> |
| 286 | struct function_wrapper {}; |
| 287 | |
| 288 | template<unsigned> |
| 289 | struct not_a_function_wrapper {}; |
| 290 | } |
| 291 | }; |
| 292 | |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 293 | // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} |
Dmitri Gribenko | 907f6b8 | 2012-08-24 00:05:30 +0000 | [diff] [blame] | 294 | /// \param aaa Meow. |
| 295 | /// \param bbb Bbb. |
| 296 | /// \returns aaa. |
Dmitri Gribenko | f869ad1 | 2013-12-17 19:45:12 +0000 | [diff] [blame] | 297 | typedef int test_function_like_typedef1(int aaa, int ccc); |
Dmitri Gribenko | 907f6b8 | 2012-08-24 00:05:30 +0000 | [diff] [blame] | 298 | |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 299 | // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} |
Dmitri Gribenko | 907f6b8 | 2012-08-24 00:05:30 +0000 | [diff] [blame] | 300 | /// \param aaa Meow. |
| 301 | /// \param bbb Bbb. |
| 302 | /// \returns aaa. |
Dmitri Gribenko | f869ad1 | 2013-12-17 19:45:12 +0000 | [diff] [blame] | 303 | typedef int (*test_function_like_typedef2)(int aaa, int ccc); |
Dmitri Gribenko | 907f6b8 | 2012-08-24 00:05:30 +0000 | [diff] [blame] | 304 | |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 305 | // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} |
Dmitri Gribenko | 907f6b8 | 2012-08-24 00:05:30 +0000 | [diff] [blame] | 306 | /// \param aaa Meow. |
| 307 | /// \param bbb Bbb. |
| 308 | /// \returns aaa. |
Dmitri Gribenko | f869ad1 | 2013-12-17 19:45:12 +0000 | [diff] [blame] | 309 | typedef int (* const test_function_like_typedef3)(int aaa, int ccc); |
Dmitri Gribenko | 907f6b8 | 2012-08-24 00:05:30 +0000 | [diff] [blame] | 310 | |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 311 | // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} |
Dmitri Gribenko | 907f6b8 | 2012-08-24 00:05:30 +0000 | [diff] [blame] | 312 | /// \param aaa Meow. |
| 313 | /// \param bbb Bbb. |
| 314 | /// \returns aaa. |
Dmitri Gribenko | f869ad1 | 2013-12-17 19:45:12 +0000 | [diff] [blame] | 315 | typedef int (C::*test_function_like_typedef4)(int aaa, int ccc); |
Dmitri Gribenko | 219bd15 | 2012-08-24 17:45:39 +0000 | [diff] [blame] | 316 | |
Dmitri Gribenko | fa68a57 | 2013-12-17 22:06:11 +0000 | [diff] [blame] | 317 | // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} |
| 318 | /// \param aaa Meow. |
| 319 | /// \param bbb Bbb. |
| 320 | /// \returns aaa. |
| 321 | typedef foo::function_wrapper<int (int aaa, int ccc)> test_function_like_typedef5; |
| 322 | |
| 323 | // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} |
| 324 | /// \param aaa Meow. |
| 325 | /// \param bbb Bbb. |
| 326 | /// \returns aaa. |
| 327 | typedef foo::function_wrapper<int (int aaa, int ccc)> *test_function_like_typedef6; |
| 328 | |
Dmitri Gribenko | e8bc31f | 2013-12-17 22:22:14 +0000 | [diff] [blame^] | 329 | // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} |
| 330 | /// \param aaa Meow. |
| 331 | /// \param bbb Bbb. |
| 332 | /// \returns aaa. |
| 333 | typedef foo::function_wrapper<int (int aaa, int ccc)> &test_function_like_typedef7; |
| 334 | |
| 335 | // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} |
| 336 | /// \param aaa Meow. |
| 337 | /// \param bbb Bbb. |
| 338 | /// \returns aaa. |
| 339 | typedef foo::function_wrapper<int (int aaa, int ccc)> &&test_function_like_typedef8; |
| 340 | |
Dmitri Gribenko | fa68a57 | 2013-12-17 22:06:11 +0000 | [diff] [blame] | 341 | |
Dmitri Gribenko | f869ad1 | 2013-12-17 19:45:12 +0000 | [diff] [blame] | 342 | typedef int (*test_not_function_like_typedef1)(int aaa); |
Dmitri Gribenko | 49fdf8d | 2012-09-15 21:13:36 +0000 | [diff] [blame] | 343 | |
| 344 | // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}} |
| 345 | /// \param aaa Meow. |
Dmitri Gribenko | f869ad1 | 2013-12-17 19:45:12 +0000 | [diff] [blame] | 346 | typedef test_not_function_like_typedef1 test_not_function_like_typedef2; |
Dmitri Gribenko | 49fdf8d | 2012-09-15 21:13:36 +0000 | [diff] [blame] | 347 | |
Dmitri Gribenko | fd5ef42 | 2013-03-04 19:39:33 +0000 | [diff] [blame] | 348 | // rdar://13066276 |
Dmitri Gribenko | f869ad1 | 2013-12-17 19:45:12 +0000 | [diff] [blame] | 349 | // Check that the diagnostic uses the same command marker as the comment. |
Dmitri Gribenko | fd5ef42 | 2013-03-04 19:39:33 +0000 | [diff] [blame] | 350 | // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}} |
| 351 | /// @param aaa Meow. |
Dmitri Gribenko | f869ad1 | 2013-12-17 19:45:12 +0000 | [diff] [blame] | 352 | typedef unsigned int test_not_function_like_typedef3; |
Dmitri Gribenko | fd5ef42 | 2013-03-04 19:39:33 +0000 | [diff] [blame] | 353 | |
Dmitri Gribenko | fa68a57 | 2013-12-17 22:06:11 +0000 | [diff] [blame] | 354 | // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}} |
| 355 | /// \param aaa Meow. |
| 356 | typedef foo::not_a_function_wrapper<1> test_not_function_like_typedef4; |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 357 | |
Dmitri Gribenko | 02489eb | 2013-06-24 04:41:32 +0000 | [diff] [blame] | 358 | /// \param aaa Aaa |
| 359 | /// \param ... Vararg |
| 360 | int test_vararg_param1(int aaa, ...); |
| 361 | |
| 362 | /// \param ... Vararg |
| 363 | int test_vararg_param2(...); |
| 364 | |
| 365 | // expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}} |
| 366 | /// \param ... Vararg |
| 367 | int test_vararg_param3(int aaa); |
| 368 | |
| 369 | // expected-warning@+1 {{parameter '...' not found in the function declaration}} |
| 370 | /// \param ... Vararg |
| 371 | int test_vararg_param4(); |
| 372 | |
| 373 | |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 374 | // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}} |
| 375 | /// \tparam T Aaa |
| 376 | int test_tparam1; |
| 377 | |
| 378 | // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}} |
| 379 | /// \tparam T Aaa |
| 380 | void test_tparam2(int aaa); |
| 381 | |
| 382 | // expected-warning@+1 {{empty paragraph passed to '\tparam' command}} |
| 383 | /// \tparam |
| 384 | /// \param aaa Blah blah |
| 385 | template<typename T> |
| 386 | void test_tparam3(T aaa); |
| 387 | |
| 388 | // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}} |
| 389 | /// \tparam T Aaa |
| 390 | template<typename TT> |
| 391 | void test_tparam4(TT aaa); |
| 392 | |
| 393 | // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}} |
| 394 | /// \tparam T Aaa |
| 395 | template<typename TT> |
| 396 | class test_tparam5 { |
| 397 | // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}} |
| 398 | /// \tparam T Aaa |
| 399 | template<typename TTT> |
| 400 | void test_tparam6(TTT aaa); |
| 401 | }; |
| 402 | |
| 403 | /// \tparam T1 Aaa |
| 404 | /// \tparam T2 Bbb |
| 405 | template<typename T1, typename T2> |
| 406 | void test_tparam7(T1 aaa, T2 bbb); |
| 407 | |
| 408 | // expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}} |
| 409 | /// \tparam SomTy Aaa |
| 410 | /// \tparam OtherTy Bbb |
| 411 | template<typename SomeTy, typename OtherTy> |
| 412 | void test_tparam8(SomeTy aaa, OtherTy bbb); |
| 413 | |
| 414 | // expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}} |
| 415 | /// \tparam T1 Aaa |
| 416 | /// \tparam T1 Bbb |
| 417 | template<typename T1, typename T2> |
| 418 | void test_tparam9(T1 aaa, T2 bbb); |
| 419 | |
| 420 | /// \tparam T Aaa |
| 421 | /// \tparam TT Bbb |
| 422 | template<template<typename T> class TT> |
| 423 | void test_tparam10(TT<int> aaa); |
| 424 | |
| 425 | /// \tparam T Aaa |
| 426 | /// \tparam TT Bbb |
| 427 | /// \tparam TTT Ccc |
| 428 | template<template<template<typename T> class TT, class C> class TTT> |
| 429 | void test_tparam11(); |
| 430 | |
| 431 | /// \tparam I Aaa |
| 432 | template<int I> |
| 433 | void test_tparam12(); |
| 434 | |
Dmitri Gribenko | baeb60e | 2012-08-02 21:36:57 +0000 | [diff] [blame] | 435 | template<typename T, typename U> |
| 436 | class test_tparam13 { }; |
| 437 | |
| 438 | /// \tparam T Aaa |
| 439 | template<typename T> |
| 440 | using test_tparam14 = test_tparam13<T, int>; |
| 441 | |
| 442 | // expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}} |
| 443 | /// \tparam U Aaa |
| 444 | template<typename T> |
| 445 | using test_tparam15 = test_tparam13<T, int>; |
| 446 | |
Dmitri Gribenko | 01b0651 | 2013-01-27 21:18:39 +0000 | [diff] [blame] | 447 | // ---- |
| 448 | |
| 449 | /// \tparam T Aaa |
| 450 | template<typename T> |
| 451 | class test_tparam16 { }; |
| 452 | |
| 453 | typedef test_tparam16<int> test_tparam17; |
| 454 | typedef test_tparam16<double> test_tparam18; |
| 455 | |
| 456 | // ---- |
| 457 | |
| 458 | template<typename T> |
| 459 | class test_tparam19; |
| 460 | |
| 461 | typedef test_tparam19<int> test_tparam20; |
| 462 | typedef test_tparam19<double> test_tparam21; |
| 463 | |
| 464 | /// \tparam T Aaa |
| 465 | template<typename T> |
| 466 | class test_tparam19 { }; |
| 467 | |
| 468 | // ---- |
| 469 | |
Dmitri Gribenko | 05e22f2 | 2013-03-04 20:23:16 +0000 | [diff] [blame] | 470 | // expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}} |
| 471 | /// @tparam T Aaa |
| 472 | int test_tparam22; |
| 473 | |
| 474 | // ---- |
| 475 | |
Dmitri Gribenko | b37d5e8 | 2012-09-13 20:36:01 +0000 | [diff] [blame] | 476 | |
| 477 | /// Aaa |
| 478 | /// \deprecated Bbb |
Dmitri Gribenko | 1da8886 | 2012-09-22 21:47:50 +0000 | [diff] [blame] | 479 | void test_deprecated_1(int a) __attribute__((deprecated)); |
Dmitri Gribenko | b37d5e8 | 2012-09-13 20:36:01 +0000 | [diff] [blame] | 480 | |
| 481 | // We don't want \deprecated to warn about empty paragraph. It is fine to use |
| 482 | // \deprecated by itself without explanations. |
| 483 | |
| 484 | /// Aaa |
| 485 | /// \deprecated |
Dmitri Gribenko | 1da8886 | 2012-09-22 21:47:50 +0000 | [diff] [blame] | 486 | void test_deprecated_2(int a) __attribute__((deprecated)); |
| 487 | |
| 488 | /// Aaa |
| 489 | /// \deprecated |
| 490 | void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4))); |
| 491 | |
| 492 | /// Aaa |
| 493 | /// \deprecated |
| 494 | void test_deprecated_4(int a) __attribute__((unavailable)); |
| 495 | |
| 496 | // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+3 {{add a deprecation attribute to the declaration to silence this warning}} |
| 497 | /// Aaa |
| 498 | /// \deprecated |
| 499 | void test_deprecated_5(int a); |
| 500 | |
| 501 | // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+3 {{add a deprecation attribute to the declaration to silence this warning}} |
| 502 | /// Aaa |
| 503 | /// \deprecated |
| 504 | void test_deprecated_6(int a) { |
| 505 | } |
| 506 | |
| 507 | // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} |
| 508 | /// Aaa |
| 509 | /// \deprecated |
| 510 | template<typename T> |
| 511 | void test_deprecated_7(T aaa); |
Dmitri Gribenko | b37d5e8 | 2012-09-13 20:36:01 +0000 | [diff] [blame] | 512 | |
| 513 | |
Dmitri Gribenko | fd5ef42 | 2013-03-04 19:39:33 +0000 | [diff] [blame] | 514 | // rdar://12397511 |
| 515 | // expected-note@+2 {{previous command '\headerfile' here}} |
| 516 | // expected-warning@+2 {{duplicated command '\headerfile'}} |
| 517 | /// \headerfile "" |
| 518 | /// \headerfile foo.h |
| 519 | int test__headerfile_1(int a); |
| 520 | |
| 521 | |
Dmitri Gribenko | 578865b | 2012-09-14 15:37:29 +0000 | [diff] [blame] | 522 | /// \invariant aaa |
| 523 | void test_invariant_1(int a); |
| 524 | |
| 525 | // expected-warning@+1 {{empty paragraph passed to '\invariant' command}} |
| 526 | /// \invariant |
| 527 | void test_invariant_2(int a); |
| 528 | |
| 529 | |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 530 | // no-warning |
| 531 | /// \returns Aaa |
| 532 | int test_returns_right_decl_1(int); |
| 533 | |
| 534 | class test_returns_right_decl_2 { |
| 535 | // no-warning |
| 536 | /// \returns Aaa |
| 537 | int test_returns_right_decl_3(int); |
| 538 | }; |
| 539 | |
| 540 | // no-warning |
| 541 | /// \returns Aaa |
| 542 | template<typename T> |
| 543 | int test_returns_right_decl_4(T aaa); |
| 544 | |
| 545 | // no-warning |
| 546 | /// \returns Aaa |
| 547 | template<> |
| 548 | int test_returns_right_decl_4(int aaa); |
| 549 | |
| 550 | /// \returns Aaa |
| 551 | template<typename T> |
| 552 | T test_returns_right_decl_5(T aaa); |
| 553 | |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 554 | // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 555 | /// \returns Aaa |
Dmitri Gribenko | f869ad1 | 2013-12-17 19:45:12 +0000 | [diff] [blame] | 556 | int test_returns_wrong_decl_1_backslash; |
| 557 | |
| 558 | // rdar://13066276 |
| 559 | // Check that the diagnostic uses the same command marker as the comment. |
| 560 | // expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}} |
| 561 | /// @returns Aaa |
| 562 | int test_returns_wrong_decl_1_at; |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 563 | |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 564 | // expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 565 | /// \return Aaa |
| 566 | int test_returns_wrong_decl_2; |
| 567 | |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 568 | // expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 569 | /// \result Aaa |
| 570 | int test_returns_wrong_decl_3; |
| 571 | |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 572 | // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 573 | /// \returns Aaa |
| 574 | void test_returns_wrong_decl_4(int); |
| 575 | |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 576 | // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 577 | /// \returns Aaa |
| 578 | template<typename T> |
| 579 | void test_returns_wrong_decl_5(T aaa); |
| 580 | |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 581 | // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 582 | /// \returns Aaa |
| 583 | template<> |
| 584 | void test_returns_wrong_decl_5(int aaa); |
| 585 | |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 586 | // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 587 | /// \returns Aaa |
| 588 | struct test_returns_wrong_decl_6 { }; |
| 589 | |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 590 | // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 591 | /// \returns Aaa |
| 592 | class test_returns_wrong_decl_7 { |
| 593 | // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}} |
| 594 | /// \returns Aaa |
| 595 | test_returns_wrong_decl_7(); |
| 596 | |
| 597 | // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}} |
| 598 | /// \returns Aaa |
| 599 | ~test_returns_wrong_decl_7(); |
| 600 | }; |
| 601 | |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 602 | // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 603 | /// \returns Aaa |
| 604 | enum test_returns_wrong_decl_8 { |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 605 | // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 606 | /// \returns Aaa |
| 607 | test_returns_wrong_decl_9 |
| 608 | }; |
| 609 | |
Dmitri Gribenko | 558babc | 2012-08-06 16:29:26 +0000 | [diff] [blame] | 610 | // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}} |
Dmitri Gribenko | 6430583 | 2012-08-03 21:15:32 +0000 | [diff] [blame] | 611 | /// \returns Aaa |
| 612 | namespace test_returns_wrong_decl_10 { }; |
| 613 | |
Fariborz Jahanian | f4ba35d | 2013-03-05 19:40:47 +0000 | [diff] [blame] | 614 | // rdar://13094352 |
Fariborz Jahanian | 56fe406 | 2013-03-05 22:46:07 +0000 | [diff] [blame] | 615 | // expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}} |
Fariborz Jahanian | f4ba35d | 2013-03-05 19:40:47 +0000 | [diff] [blame] | 616 | /*! @function test_function |
| 617 | */ |
| 618 | typedef unsigned int Base64Flags; |
| 619 | unsigned test_function(Base64Flags inFlags); |
| 620 | |
Fariborz Jahanian | 56fe406 | 2013-03-05 22:46:07 +0000 | [diff] [blame] | 621 | // expected-warning@+1 {{'@callback' command should be used in a comment attached to a pointer to function declaration}} |
Fariborz Jahanian | f4ba35d | 2013-03-05 19:40:47 +0000 | [diff] [blame] | 622 | /*! @callback test_callback |
| 623 | */ |
| 624 | typedef unsigned int BaseFlags; |
| 625 | unsigned (*test_callback)(BaseFlags inFlags); |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 626 | |
Dmitri Gribenko | 76b91c3 | 2012-11-18 00:30:31 +0000 | [diff] [blame] | 627 | // expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}} |
| 628 | /// \endverbatim |
| 629 | int test_verbatim_1(); |
| 630 | |
| 631 | // expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}} |
| 632 | /// \endcode |
| 633 | int test_verbatim_2(); |
| 634 | |
| 635 | // FIXME: we give a bad diagnostic here because we throw away non-documentation |
| 636 | // comments early. |
| 637 | // |
NAKAMURA Takumi | 3424550 | 2012-11-18 02:34:33 +0000 | [diff] [blame] | 638 | // expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}} |
Dmitri Gribenko | 76b91c3 | 2012-11-18 00:30:31 +0000 | [diff] [blame] | 639 | /// \code |
| 640 | // foo |
| 641 | /// \endcode |
| 642 | int test_verbatim_3(); |
| 643 | |
| 644 | |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 645 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 646 | int test1; ///< \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 647 | |
| 648 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 649 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 650 | int test2, ///< \brief\author Aaa |
| 651 | test3; ///< \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 652 | |
| 653 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 654 | int test4; ///< \brief |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 655 | ///< \author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 656 | |
| 657 | |
Dmitri Gribenko | 761f801 | 2013-06-23 23:33:14 +0000 | [diff] [blame] | 658 | class TestRelates {}; |
| 659 | |
| 660 | /// \relates TestRelates |
| 661 | /// \brief Aaa |
| 662 | void test_relates_1(); |
| 663 | |
| 664 | /// \related TestRelates |
| 665 | /// \brief Aaa |
| 666 | void test_relates_2(); |
| 667 | |
| 668 | /// \relatesalso TestRelates |
| 669 | /// \brief Aaa |
| 670 | void test_relates_3(); |
| 671 | |
| 672 | /// \relatedalso TestRelates |
| 673 | /// \brief Aaa |
| 674 | void test_relates_4(); |
| 675 | |
| 676 | |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 677 | // Check that we attach the comment to the declaration during parsing in the |
| 678 | // following cases. The test is based on the fact that we don't parse |
| 679 | // documentation comments that are not attached to anything. |
| 680 | |
| 681 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 682 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 683 | int test_attach1; |
| 684 | |
| 685 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 686 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 687 | int test_attach2(int); |
| 688 | |
| 689 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 690 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 691 | struct test_attach3 { |
| 692 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 693 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 694 | int test_attach4; |
| 695 | |
| 696 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 697 | int test_attach5; ///< \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 698 | |
| 699 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 700 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 701 | int test_attach6(int); |
| 702 | }; |
| 703 | |
| 704 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 705 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 706 | class test_attach7 { |
| 707 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 708 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 709 | int test_attach8; |
| 710 | |
| 711 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 712 | int test_attach9; ///< \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 713 | |
| 714 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 715 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 716 | int test_attach10(int); |
| 717 | }; |
| 718 | |
| 719 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 720 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 721 | enum test_attach9 { |
| 722 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 723 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 724 | test_attach10, |
| 725 | |
| 726 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 727 | test_attach11 ///< \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 728 | }; |
| 729 | |
| 730 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 731 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 732 | struct test_noattach12 *test_attach13; |
| 733 | |
| 734 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 735 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 736 | typedef struct test_noattach14 *test_attach15; |
| 737 | |
| 738 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 739 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 740 | typedef struct test_attach16 { int a; } test_attach17; |
| 741 | |
| 742 | struct S { int a; }; |
| 743 | |
| 744 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 745 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 746 | struct S *test_attach18; |
| 747 | |
| 748 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 749 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 750 | typedef struct S *test_attach19; |
| 751 | |
| 752 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 753 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 754 | struct test_attach20; |
| 755 | |
| 756 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 757 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 758 | typedef struct test_attach21 { |
| 759 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 760 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 761 | int test_attach22; |
| 762 | } test_attach23; |
| 763 | |
| 764 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 765 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 766 | namespace test_attach24 { |
| 767 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 768 | /// \brief\author Aaa |
Dmitri Gribenko | f26054f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 769 | namespace test_attach25 { |
| 770 | } |
| 771 | } |
| 772 | |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 773 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 774 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 775 | /// \tparam T Aaa |
| 776 | template<typename T> |
| 777 | void test_attach26(T aaa); |
| 778 | |
| 779 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 780 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 781 | /// \tparam T Aaa |
| 782 | template<typename T, typename U> |
| 783 | void test_attach27(T aaa, U bbb); |
| 784 | |
| 785 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 786 | // expected-warning@+2 {{template parameter 'T' not found in the template declaration}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 787 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 788 | /// \tparam T Aaa |
| 789 | template<> |
| 790 | void test_attach27(int aaa, int bbb); |
| 791 | |
| 792 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 793 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 794 | /// \tparam T Aaa |
| 795 | template<typename T> |
| 796 | class test_attach28 { |
| 797 | T aaa; |
| 798 | }; |
| 799 | |
| 800 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 801 | /// \brief\author Aaa |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 802 | using test_attach29 = test_attach28<int>; |
| 803 | |
| 804 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 805 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 806 | /// \tparam T Aaa |
| 807 | template<typename T, typename U> |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 808 | class test_attach30 { }; |
| 809 | |
| 810 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 811 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 812 | /// \tparam T Aaa |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 813 | template<typename T> |
| 814 | class test_attach30<T, int> { }; |
| 815 | |
| 816 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 817 | /// \brief\author Aaa |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 818 | template<> |
| 819 | class test_attach30<int, int> { }; |
| 820 | |
| 821 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 822 | /// \brief\author Aaa |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 823 | template<typename T> |
| 824 | using test_attach31 = test_attach30<T, int>; |
| 825 | |
| 826 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 827 | /// \brief\author Aaa |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 828 | /// \tparam T Aaa |
| 829 | template<typename T, typename U, typename V> |
| 830 | class test_attach32 { }; |
| 831 | |
| 832 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 833 | /// \brief\author Aaa |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 834 | /// \tparam T Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 835 | template<typename T, typename U> |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 836 | class test_attach32<T, U, int> { }; |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 837 | |
| 838 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 839 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 840 | /// \tparam T Aaa |
| 841 | template<typename T> |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 842 | class test_attach32<T, int, int> { }; |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 843 | |
| 844 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 845 | // expected-warning@+2 {{template parameter 'T' not found in the template declaration}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 846 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 847 | /// \tparam T Aaa |
| 848 | template<> |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 849 | class test_attach32<int, int, int> { }; |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 850 | |
| 851 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 852 | /// \brief\author Aaa |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 853 | class test_attach33 { |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 854 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 855 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 856 | /// \tparam T Aaa |
| 857 | template<typename T, typename U> |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 858 | void test_attach34(T aaa, U bbb); |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 859 | }; |
| 860 | |
| 861 | template<typename T> |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 862 | class test_attach35 { |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 863 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 864 | // expected-warning@+2 {{template parameter 'T' not found in the template declaration}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 865 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 866 | /// \tparam T Aaa |
| 867 | template<typename TT, typename UU> |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 868 | void test_attach36(TT aaa, UU bbb); |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 869 | }; |
| 870 | |
| 871 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 872 | // expected-warning@+2 {{template parameter 'T' not found in the template declaration}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 873 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 874 | /// \tparam T Aaa |
| 875 | template<> template<> |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 876 | void test_attach35<int>::test_attach36(int aaa, int bbb) {} |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 877 | |
| 878 | template<typename T> |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 879 | class test_attach37 { |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 880 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 881 | // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 882 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 883 | /// \tparam T Aaa |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 884 | void test_attach38(int aaa, int bbb); |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 885 | |
Dmitri Gribenko | b261088 | 2012-08-14 17:17:18 +0000 | [diff] [blame] | 886 | void test_attach39(int aaa, int bbb); |
| 887 | }; |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 888 | |
| 889 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 890 | // expected-warning@+2 {{template parameter 'T' not found in the template declaration}} |
Dmitri Gribenko | 5ec0c75 | 2012-08-06 17:08:27 +0000 | [diff] [blame] | 891 | /// \brief\author Aaa |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 892 | /// \tparam T Aaa |
| 893 | template<> |
Dmitri Gribenko | 7f4b377 | 2012-08-02 20:49:51 +0000 | [diff] [blame] | 894 | void test_attach37<int>::test_attach38(int aaa, int bbb) {} |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 895 | |
Dmitri Gribenko | b261088 | 2012-08-14 17:17:18 +0000 | [diff] [blame] | 896 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 897 | /// \brief\author Aaa |
| 898 | /// \tparam T Aaa |
| 899 | template<typename T> |
| 900 | void test_attach37<T>::test_attach39(int aaa, int bbb) {} |
| 901 | |
Dmitri Gribenko | 4ae66a3 | 2012-08-16 18:19:43 +0000 | [diff] [blame] | 902 | // We used to emit warning that parameter 'a' is not found because we parsed |
| 903 | // the comment in context of the redeclaration which does not have parameter |
| 904 | // names. |
| 905 | template <typename T> |
| 906 | struct test_attach38 { |
| 907 | /*! |
| 908 | \param a First param |
| 909 | \param b Second param |
| 910 | */ |
| 911 | template <typename B> |
| 912 | void test_attach39(T a, B b); |
| 913 | }; |
| 914 | |
| 915 | template <> |
| 916 | template <typename B> |
| 917 | void test_attach38<int>::test_attach39(int, B); |
Dmitri Gribenko | b261088 | 2012-08-14 17:17:18 +0000 | [diff] [blame] | 918 | |
Dmitri Gribenko | 34df220 | 2012-07-31 22:37:06 +0000 | [diff] [blame] | 919 | |
Dmitri Gribenko | 66a00c7 | 2012-07-20 20:18:53 +0000 | [diff] [blame] | 920 | // PR13411, reduced. We used to crash on this. |
| 921 | /** |
| 922 | * @code Aaa. |
| 923 | */ |
| 924 | void test_nocrash1(int); |
| 925 | |
Dmitri Gribenko | 1ba47ca | 2012-07-30 18:05:28 +0000 | [diff] [blame] | 926 | // We used to crash on this. |
| 927 | // expected-warning@+2 {{empty paragraph passed to '\param' command}} |
| 928 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 929 | /// \param\brief |
| 930 | void test_nocrash2(int); |
| 931 | |
Dmitri Gribenko | b261088 | 2012-08-14 17:17:18 +0000 | [diff] [blame] | 932 | // PR13593, example 1 and 2 |
Douglas Gregor | 35ceb27 | 2012-08-13 16:37:30 +0000 | [diff] [blame] | 933 | |
| 934 | /** |
| 935 | * Bla. |
| 936 | */ |
| 937 | template <typename> |
| 938 | void test_nocrash3(); |
| 939 | |
| 940 | /// Foo |
| 941 | template <typename, typename> |
| 942 | void test_nocrash4() { } |
| 943 | |
| 944 | template <typename> |
| 945 | void test_nocrash3() |
| 946 | { |
| 947 | } |
Dmitri Gribenko | b261088 | 2012-08-14 17:17:18 +0000 | [diff] [blame] | 948 | |
| 949 | // PR13593, example 3 |
| 950 | |
| 951 | /** |
| 952 | * aaa |
| 953 | */ |
| 954 | template <typename T> |
| 955 | inline T test_nocrash5(T a1) |
| 956 | { |
| 957 | return a1; |
| 958 | } |
| 959 | |
| 960 | /// |
| 961 | //, |
| 962 | |
| 963 | inline void test_nocrash6() |
| 964 | { |
| 965 | test_nocrash5(1); |
| 966 | } |
| 967 | |
| 968 | // We used to crash on this. |
| 969 | |
| 970 | /*! |
| 971 | Blah. |
| 972 | */ |
| 973 | typedef const struct test_nocrash7 * test_nocrash8; |
| 974 | |
Dmitri Gribenko | 9304d86 | 2012-09-11 19:22:03 +0000 | [diff] [blame] | 975 | // We used to crash on this. |
| 976 | |
Fariborz Jahanian | 5b63707 | 2013-05-03 23:15:20 +0000 | [diff] [blame] | 977 | // expected-warning@+1 {{unknown command tag name}} |
Dmitri Gribenko | 9304d86 | 2012-09-11 19:22:03 +0000 | [diff] [blame] | 978 | /// aaa \unknown aaa \unknown aaa |
| 979 | int test_nocrash9; |
| 980 | |
Dmitri Gribenko | 7146930 | 2013-01-26 00:36:14 +0000 | [diff] [blame] | 981 | // We used to crash on this. PR15068 |
| 982 | |
Fariborz Jahanian | d499636 | 2013-03-01 22:51:30 +0000 | [diff] [blame] | 983 | // expected-warning@+2 {{empty paragraph passed to '@param' command}} |
| 984 | // expected-warning@+2 {{empty paragraph passed to '@param' command}} |
Dmitri Gribenko | 7146930 | 2013-01-26 00:36:14 +0000 | [diff] [blame] | 985 | ///@param x |
| 986 | ///@param y |
| 987 | int test_nocrash10(int x, int y); |
| 988 | |
Fariborz Jahanian | d499636 | 2013-03-01 22:51:30 +0000 | [diff] [blame] | 989 | // expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}} |
| 990 | // expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}} |
Dmitri Gribenko | 7146930 | 2013-01-26 00:36:14 +0000 | [diff] [blame] | 991 | ///@param x |
| 992 | ///@param y |
| 993 | int test_nocrash11(); |
| 994 | |
Fariborz Jahanian | d499636 | 2013-03-01 22:51:30 +0000 | [diff] [blame] | 995 | // expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}} |
| 996 | // expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}} |
Dmitri Gribenko | 7146930 | 2013-01-26 00:36:14 +0000 | [diff] [blame] | 997 | /** |
| 998 | @param x |
| 999 | @param y |
| 1000 | **/ |
| 1001 | int test_nocrash12(); |
| 1002 | |
Fariborz Jahanian | d499636 | 2013-03-01 22:51:30 +0000 | [diff] [blame] | 1003 | // expected-warning@+2 {{empty paragraph passed to '@param' command}} |
| 1004 | // expected-warning@+1 {{empty paragraph passed to '@param' command}} |
Dmitri Gribenko | 7146930 | 2013-01-26 00:36:14 +0000 | [diff] [blame] | 1005 | ///@param x@param y |
| 1006 | int test_nocrash13(int x, int y); |
Fariborz Jahanian | a649eee | 2013-03-07 23:33:11 +0000 | [diff] [blame] | 1007 | |
| 1008 | // rdar://12379114 |
| 1009 | // expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}} |
| 1010 | /*! |
| 1011 | @union U This is new |
| 1012 | */ |
| 1013 | struct U { int iS; }; |
| 1014 | |
| 1015 | /*! |
| 1016 | @union U1 |
| 1017 | */ |
| 1018 | union U1 {int i; }; |
| 1019 | |
| 1020 | // expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}} |
| 1021 | /*! |
| 1022 | @struct S2 |
| 1023 | */ |
| 1024 | union S2 {}; |
| 1025 | |
| 1026 | /*! |
| 1027 | @class C1 |
| 1028 | */ |
| 1029 | class C1; |
| 1030 | |
| 1031 | /*! |
| 1032 | @struct S3; |
| 1033 | */ |
| 1034 | class S3; |
Fariborz Jahanian | c0607ed | 2013-06-19 18:08:03 +0000 | [diff] [blame] | 1035 | |
| 1036 | // rdar://14124702 |
| 1037 | //---------------------------------------------------------------------- |
| 1038 | /// @class Predicate Predicate.h "lldb/Host/Predicate.h" |
| 1039 | /// @brief A C++ wrapper class for providing threaded access to a value |
| 1040 | /// of type T. |
| 1041 | /// |
| 1042 | /// A templatized class. |
| 1043 | /// specified values. |
| 1044 | //---------------------------------------------------------------------- |
| 1045 | template <class T, class T1> |
| 1046 | class Predicate |
| 1047 | { |
| 1048 | }; |
| 1049 | |
| 1050 | //---------------------------------------------------------------------- |
| 1051 | /// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h" |
| 1052 | /// @brief A C++ wrapper class for providing threaded access to a value |
| 1053 | /// of type T. |
| 1054 | /// |
| 1055 | /// A template specilization class. |
| 1056 | //---------------------------------------------------------------------- |
| 1057 | template<> class Predicate<int, char> |
| 1058 | { |
| 1059 | }; |
| 1060 | |
| 1061 | //---------------------------------------------------------------------- |
| 1062 | /// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h" |
| 1063 | /// @brief A C++ wrapper class for providing threaded access to a value |
| 1064 | /// of type T. |
| 1065 | /// |
| 1066 | /// A partial specialization template class. |
| 1067 | //---------------------------------------------------------------------- |
| 1068 | template<class T> class Predicate<T, int> |
| 1069 | { |
| 1070 | }; |
| 1071 | |
| 1072 | /*! @function test_function |
| 1073 | */ |
| 1074 | template <class T> T test_function (T arg); |
| 1075 | |
| 1076 | /*! @function test_function<int> |
| 1077 | */ |
| 1078 | template <> int test_function<int> (int arg); |