summaryrefslogtreecommitdiff
path: root/test/Sema/warn-documentation.cpp
Commit message (Collapse)AuthorAge
* Comment parsing: in the generated XML file, mark HTML that is safe to passDmitri Gribenko2014-04-22
| | | | | | | | | | | | through to the output even if the input comment comes from an untrusted source Attribute filtering is currently based on a blacklist, which right now includes all event handler attributes (they contain JavaScipt code). It should be switched to a whitelist, but going over all of the HTML5 spec requires a significant amount of time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206882 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: recognize \param ... on function templates with variadicDmitri Gribenko2014-03-19
| | | | | | | | | parameters Patch by Joe Ranieri. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204235 91177308-0d34-0410-b5e6-96231b3b80d8
* Documentation comment parsing: when checking if we have typedef to somethingDmitri Gribenko2013-12-17
| | | | | | | | that we consider a function for the purposes of checking \param and \returns, look through reference types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197530 91177308-0d34-0410-b5e6-96231b3b80d8
* Documentation comment parsing: allow \param and \returns on std::function,Dmitri Gribenko2013-12-17
| | | | | | | boost::function and similar function-like objects git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197528 91177308-0d34-0410-b5e6-96231b3b80d8
* Documentation comment parsing: rearrange tests to clarify the intent of ↵Dmitri Gribenko2013-12-17
| | | | | | these tests git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197517 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: allow "\param ..." to describe variadic argumentsDmitri Gribenko2013-06-24
| | | | | | | | | Original patch by Fariborz Jahanian; extended by me. Fixes rdar://14124644 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184688 91177308-0d34-0410-b5e6-96231b3b80d8
* Documentation parsing: recognize \relates, \related, \relatesonly, \relatedonlyDmitri Gribenko2013-06-23
| | | | | | | | so that -Wdocumentation-unknown-command does not warn on these commands. Fixes PR16092. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184676 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: followup to r184610: allow multiple \returnsDmitri Gribenko2013-06-22
| | | | | | | | | | Remove unneeded member in CommentSema, add a test for the XML schema (the schema already allowed multiple paragraphs in <ResultDiscussion>, but there were no tests for that), fix HTML generation (it is not allowed to have <p> inside <dl>). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184652 91177308-0d34-0410-b5e6-96231b3b80d8
* [document parsing]: Allow multiple adjacent \return and the likeFariborz Jahanian2013-06-21
| | | | | | | | commands. Render them properly in XML output. // rdar://14207725 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184610 91177308-0d34-0410-b5e6-96231b3b80d8
* documentation parsing: patch to make @class work forFariborz Jahanian2013-06-19
| | | | | | | | class templates; and similarly, @function works for function templates. // rdar://14124702 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184329 91177308-0d34-0410-b5e6-96231b3b80d8
* [Doc parsing] Provide diagnostics for unknown documentation Fariborz Jahanian2013-05-03
| | | | | | | commands. // rdar://12381408 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181071 91177308-0d34-0410-b5e6-96231b3b80d8
* HeaderDoc: Support more of HeaderDoc documentation Fariborz Jahanian2013-03-07
| | | | | | | | | commands; top level tags such as @interface and their 2nd level tags such as @coclass, etc. // rdar://12379114 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176667 91177308-0d34-0410-b5e6-96231b3b80d8
* doc. parsing. Improve on diagnostics on my last patch.Fariborz Jahanian2013-03-05
| | | | | | | // rdar://13094352. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176525 91177308-0d34-0410-b5e6-96231b3b80d8
* doc parsing. Add @method and @callback forFariborz Jahanian2013-03-05
| | | | | | | | checkings and few other refactoring/cleanup. // rdar://13094352. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176509 91177308-0d34-0410-b5e6-96231b3b80d8
* doc parsing. We want to issue a strong warning whenFariborz Jahanian2013-03-05
| | | | | | | | an @function comment is not followed by a function decl. // rdar://13094352 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176468 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing tests: move a test into a group of similar testsDmitri Gribenko2013-03-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176449 91177308-0d34-0410-b5e6-96231b3b80d8
* [comment parsing] source fidelity for tparam command too.Fariborz Jahanian2013-03-04
| | | | | | | // rdar://13066276 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176448 91177308-0d34-0410-b5e6-96231b3b80d8
* warn-documentation.cpp: reorganize testsDmitri Gribenko2013-03-04
| | | | | | | Tests are ordered by command in this file. It is nice to keep it that way. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176445 91177308-0d34-0410-b5e6-96231b3b80d8
* comment parsing. Missed a case of referringFariborz Jahanian2013-03-04
| | | | | | | to original command in diagnostic. // rdar://13066276 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176444 91177308-0d34-0410-b5e6-96231b3b80d8
* comment parsing. Keep the original command format Fariborz Jahanian2013-03-01
| | | | | | | | in AST for source fidelity and use it in diagnostics to refer to the original format. // rdar://13066276 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176387 91177308-0d34-0410-b5e6-96231b3b80d8
* [Comment parsing] Add support for recognizingFariborz Jahanian2013-01-31
| | | | | | | | | \headerfile command and representing it in an xml document. Patch reviewed by Dmitri Gribenko. // rdar://12397511 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174109 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: attach any tag type's documentation to its typedef if latterDmitri Gribenko2013-01-27
| | | | | | | | | does not have one of its own. // rdar://13067629 Original patch (r173586 and r173587) by Fariborz Jahanian, modified by me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173626 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: actually check for a block command after "\param x"Dmitri Gribenko2013-01-26
| | | | | | | This fixes PR15068. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173539 91177308-0d34-0410-b5e6-96231b3b80d8
* clang/test/Sema/warn-documentation.cpp: Try to fix up the testcase in r168277.NAKAMURA Takumi2012-11-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168278 91177308-0d34-0410-b5e6-96231b3b80d8
* Documentation parsing: propely handle a lone '\endverbatim' and emit a warning.Dmitri Gribenko2012-11-18
| | | | | | | | | We actually used to assert on this. Thanks to NAKAMURA Takumi for noticing this! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168277 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment sema: warn when comment has \deprecated but declaration does not have aDmitri Gribenko2012-09-22
| | | | | | | | | | deprecation attribute ('deprecated', 'availability' or 'unavailable'). This warning is under a separate flag, -Wdocumentation-deprecated-sync, so it can be turned off easily while leaving other -Wdocumentation warnings on. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164467 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: don't treat typedef to a typedef to a function as aDmitri Gribenko2012-09-15
| | | | | | | | | 'function-like' type that can be annotated with \param. Thanks to Eli Friedman for noticing! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163985 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: support the "\invariant" command.Dmitri Gribenko2012-09-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163905 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: handle \deprecated command. It is a block command, but itDmitri Gribenko2012-09-13
| | | | | | | | should be fine to use it without further explanations in the attached paragraph, so the warning about empty paragraph was turned off for it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163836 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: handle non-builtin commands correctly. After semanticDmitri Gribenko2012-09-11
| | | | | | | | | | | | analysis registers a command, it becomes a "known" command for the lexer, since it has an ID. Having this freedom of choice to register a command is a good thing since BriefParser does not need this. But the parser should still invoke the correct semantic analysis method (actOnUnknownCommand) in this case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163646 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment diagnostics: for unresolved parameters, do not suggest parameter fixitDmitri Gribenko2012-08-24
| | | | | | | | | with parameter that is documented. Fixes PR13670, <rdar://problem/12155840>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162570 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment semantic analysis: treat function typedefs as functions so that one canDmitri Gribenko2012-08-24
| | | | | | | | | use \param and \returns in documentation. Fixes PR13533. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162507 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: parse "<blah" as an HTML tag only if "blah" is a known tagDmitri Gribenko2012-08-22
| | | | | | | | | | | name. This should reduce the amount of warning false positives about bad HTML in comments when the comment author intended to put a reference to a template. This change will also enable us parse the comment as intended in these cases. Fixes part 1 of PR13374. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162407 91177308-0d34-0410-b5e6-96231b3b80d8
* Attaching comments to declarations: parse the comment in context of theDmitri Gribenko2012-08-16
| | | | | | | declaration it was attached to. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162033 91177308-0d34-0410-b5e6-96231b3b80d8
* Attaching comments to redeclarations: fix wrong assumptionsDmitri Gribenko2012-08-14
| | | | | | | | | | | | | | | | | | | The reason for the recent fallout for "attaching comments to any redeclaration" change are two false assumptions: (1) a RawComment is attached to a single decl (not true for 'typedef struct X *Y' where we want the comment to be attached to both X and Y); (2) the whole redeclaration chain has only a single comment (obviously false, the user can put a separate comment for each redeclaration). To fix (1) I revert the part of the recent change where a 'Decl*' member was introduced to RawComment. Now ASTContext has a separate DenseMap for mapping 'Decl*' to 'FullComment*'. To fix (2) I just removed the test with this assumption. We might not parse every comment in redecl chain if we already parsed at least one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161878 91177308-0d34-0410-b5e6-96231b3b80d8
* When looking for the comment associated with a declaration, adjust theDouglas Gregor2012-08-13
| | | | | | | | | 'templated' declaration for a function or class template to refer to the function or class template itself, to which the documentation will be attached. Fixes PR13593. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161762 91177308-0d34-0410-b5e6-96231b3b80d8
* libclang API for comment-to-xml conversion.Dmitri Gribenko2012-08-07
| | | | | | | | | | | | | The implementation also includes a Relax NG schema and tests for the schema itself. The schema is used in c-index-test to verify that XML documents we produce are valid. In order to do the validation, we add an optional libxml2 dependency for c-index-test. Credits for CMake part go to Doug Gregor. Credits for Autoconf part go to Eric Christopher. Thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161431 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment diagnostics: warn on duplicate \brief and \return commands.Dmitri Gribenko2012-08-06
| | | | | | | | | | | Doxygen manual claims that multiple \brief or \returns commands will be merged together, but actual behavior is different (second \brief command becomes a part of a discussion, second \returns becomes a "Returns: blah" paragraph on its own). Anyway, it seems to be a bad idea to use multiple \brief or \returns commands in a single command. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161325 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment diagnostics: \return in void function: specialize diagnostic text forDmitri Gribenko2012-08-06
| | | | | | | ObjC methods. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161324 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment diagnostics: warn if \returns is used in a non-function comment or ifDmitri Gribenko2012-08-03
| | | | | | | the function returns void. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161261 91177308-0d34-0410-b5e6-96231b3b80d8
* Comments: handle template paramter documentation in alias-declarationDmitri Gribenko2012-08-02
| | | | | | | templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161215 91177308-0d34-0410-b5e6-96231b3b80d8
* Attaching comments to declarations: handle using-declaration.Dmitri Gribenko2012-08-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161211 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: add support for \tparam command on all levels.Dmitri Gribenko2012-07-31
| | | | | | | | | | | The only caveat is renumbering CXCommentKind enum for aesthetic reasons -- this breaks libclang binary compatibility, but should not be a problem since API is so new. This also fixes PR13372 as a side-effect. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161087 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parser: don't crash on a completely empty \param followed by a blockDmitri Gribenko2012-07-30
| | | | | | | command git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160975 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing tests: fix testDmitri Gribenko2012-07-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160700 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment diagnostics tests: add a function with zero arguments, for completeness.Dmitri Gribenko2012-07-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160697 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment diagnostics: add warning for multiple \param commands with duplicateDmitri Gribenko2012-07-24
| | | | | | | parameter names. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160696 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR13411: Comment parsing: failed assertion on unterminated verbatim block.Dmitri Gribenko2012-07-20
| | | | | | | | | | | The assertion was wrong in case we have a verbatim block without a closing command. Also add tests for closing command name in a verbatim block, since now it can be empty in such cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160568 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix ParagraphComment::isWhitespace(): a paragraph without a non-whitespaceDmitri Gribenko2012-07-19
| | | | | | | | TextComment node was considered whitespace even if it contained other child nodes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160474 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: repaint the bikesched: rename 'HTML open tags' to 'HTML ↵Dmitri Gribenko2012-07-13
| | | | | | start tags' and 'HTML close tags' to 'HTML end tags' according to HTML spec. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160153 91177308-0d34-0410-b5e6-96231b3b80d8