diff options
Diffstat (limited to 'test/Sema/warn-documentation.cpp')
-rw-r--r-- | test/Sema/warn-documentation.cpp | 136 |
1 files changed, 129 insertions, 7 deletions
diff --git a/test/Sema/warn-documentation.cpp b/test/Sema/warn-documentation.cpp index d99520b..5678fd9 100644 --- a/test/Sema/warn-documentation.cpp +++ b/test/Sema/warn-documentation.cpp @@ -38,13 +38,13 @@ int test_html7(int); int test_html8(int); // expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}} -/** Aaa bbb<ccc ddd eee +/** Aaa bbb<img ddd eee * fff ggg. */ int test_html9(int); // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} -/** Aaa bbb<ccc ddd eee 42% +/** Aaa bbb<img ddd eee 42% * fff ggg. */ int test_html10(int); @@ -218,9 +218,32 @@ int test_param12(int a); /// \param aab Blah blah. int test_param13(int aaa, int bbb); +// expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}} +/// \param aaa Blah blah. +/// \param aab Blah blah. +int test_param14(int aaa, int bbb); + // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} /// \param aab Blah blah. -int test_param14(int bbb, int ccc); +int test_param15(int bbb, int ccc); + +// expected-warning@+1 {{parameter 'aab' not found in the function declaration}} +/// \param aab Ccc. +/// \param aaa Aaa. +/// \param bbb Bbb. +int test_param16(int aaa, int bbb); + +// expected-warning@+2 {{parameter 'aab' not found in the function declaration}} +/// \param aaa Aaa. +/// \param aab Ccc. +/// \param bbb Bbb. +int test_param17(int aaa, int bbb); + +// expected-warning@+3 {{parameter 'aab' not found in the function declaration}} +/// \param aaa Aaa. +/// \param bbb Bbb. +/// \param aab Ccc. +int test_param18(int aaa, int bbb); class C { // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}} @@ -229,26 +252,56 @@ class C { // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}} /// \param aaa Blah blah. - int test_param15(int bbb, int ccc); + int test_param19(int bbb, int ccc); }; // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} /// \param aab Blah blah. template<typename T> -void test_param16(int bbb, int ccc); +void test_param20(int bbb, int ccc); // expected-warning@+3 {{parameter 'a' is already documented}} // expected-note@+1 {{previous documentation}} /// \param a Aaa. /// \param a Aaa. -int test_param17(int a); +int test_param21(int a); // expected-warning@+4 {{parameter 'x2' is already documented}} // expected-note@+2 {{previous documentation}} /// \param x1 Aaa. /// \param x2 Bbb. /// \param x2 Ccc. -int test_param18(int x1, int x2, int x3); +int test_param22(int x1, int x2, int x3); + +// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} +/// \param aaa Meow. +/// \param bbb Bbb. +/// \returns aaa. +typedef int test_param23(int aaa, int ccc); + +// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} +/// \param aaa Meow. +/// \param bbb Bbb. +/// \returns aaa. +typedef int (*test_param24)(int aaa, int ccc); + +// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} +/// \param aaa Meow. +/// \param bbb Bbb. +/// \returns aaa. +typedef int (* const test_param25)(int aaa, int ccc); + +// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}} +/// \param aaa Meow. +/// \param bbb Bbb. +/// \returns aaa. +typedef int (C::*test_param26)(int aaa, int ccc); + +typedef int (*test_param27)(int aaa); + +// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}} +/// \param aaa Meow. +typedef test_param27 test_param28; // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}} @@ -324,6 +377,52 @@ using test_tparam14 = test_tparam13<T, int>; template<typename T> using test_tparam15 = test_tparam13<T, int>; + +/// Aaa +/// \deprecated Bbb +void test_deprecated_1(int a) __attribute__((deprecated)); + +// We don't want \deprecated to warn about empty paragraph. It is fine to use +// \deprecated by itself without explanations. + +/// Aaa +/// \deprecated +void test_deprecated_2(int a) __attribute__((deprecated)); + +/// Aaa +/// \deprecated +void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4))); + +/// Aaa +/// \deprecated +void test_deprecated_4(int a) __attribute__((unavailable)); + +// 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}} +/// Aaa +/// \deprecated +void test_deprecated_5(int a); + +// 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}} +/// Aaa +/// \deprecated +void test_deprecated_6(int a) { +} + +// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} +/// Aaa +/// \deprecated +template<typename T> +void test_deprecated_7(T aaa); + + +/// \invariant aaa +void test_invariant_1(int a); + +// expected-warning@+1 {{empty paragraph passed to '\invariant' command}} +/// \invariant +void test_invariant_2(int a); + + // no-warning /// \returns Aaa int test_returns_right_decl_1(int); @@ -403,6 +502,24 @@ enum test_returns_wrong_decl_8 { namespace test_returns_wrong_decl_10 { }; +// expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}} +/// \endverbatim +int test_verbatim_1(); + +// expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}} +/// \endcode +int test_verbatim_2(); + +// FIXME: we give a bad diagnostic here because we throw away non-documentation +// comments early. +// +// expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}} +/// \code +// foo +/// \endcode +int test_verbatim_3(); + + // expected-warning@+1 {{empty paragraph passed to '\brief' command}} int test1; ///< \brief\author Aaa @@ -714,3 +831,8 @@ inline void test_nocrash6() */ typedef const struct test_nocrash7 * test_nocrash8; +// We used to crash on this. + +/// aaa \unknown aaa \unknown aaa +int test_nocrash9; + |