diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-26 19:24:09 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-26 19:24:09 +0000 |
| commit | f0c55418e2b09eaab37c820d3756cc1b4584d084 (patch) | |
| tree | 9263bf60f263bb5a7aaa4d2c1be43e5fc4d942e0 /test/Sema/warn-documentation.cpp | |
| parent | 583e75cce441388bc562fa225d23499261a0091e (diff) | |
Notes
Diffstat (limited to 'test/Sema/warn-documentation.cpp')
| -rw-r--r-- | test/Sema/warn-documentation.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/Sema/warn-documentation.cpp b/test/Sema/warn-documentation.cpp index 34d8f5fd2da2..0c92b2aa029f 100644 --- a/test/Sema/warn-documentation.cpp +++ b/test/Sema/warn-documentation.cpp @@ -1210,3 +1210,75 @@ template <class T> T test_function (T arg); /*! @function test_function<int> */ template <> int test_function<int> (int arg); + +namespace AllowParamAndReturnsOnFunctionPointerVars { + +/** + * functionPointerVariable + * + * @param i is integer. + * @returns integer. + */ +int (*functionPointerVariable)(int i); + +struct HasFields { + /** + * functionPointerField + * + * @param i is integer. + * @returns integer. + */ + int (*functionPointerField)(int i); +}; + +// expected-warning@+5 {{'\returns' command used in a comment that is attached to a function returning void}} +/** + * functionPointerVariable + * + * \param p not here. + * \returns integer. + */ +void (*functionPointerVariableThatLeadsNowhere)(); + +// Still warn about param/returns commands for variables that don't specify +// the type directly: + +/** + * FunctionPointerTypedef + * + * \param i is integer. + * \returns integer. + */ +typedef int (*FunctionPointerTypedef)(int i); + +/** + * FunctionPointerTypealias + * + * \param i is integer. + * \returns integer. + */ +using FunctionPointerTypealias = int (*)(int i); + +// expected-warning@+5 {{'@param' command used in a comment that is not attached to a function declaration}} +// expected-warning@+5 {{'@returns' command used in a comment that is not attached to a function or method declaration}} +/** + * functionPointerVariable + * + * @param i is integer. + * @returns integer. + */ +FunctionPointerTypedef functionPointerTypedefVariable; + +struct HasMoreFields { + // expected-warning@+5 {{'\param' command used in a comment that is not attached to a function declaration}} + // expected-warning@+5 {{'\returns' command used in a comment that is not attached to a function or method declaration}} + /** + * functionPointerTypealiasField + * + * \param i is integer. + * \returns integer. + */ + FunctionPointerTypealias functionPointerTypealiasField; +}; + +} |
