aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Sema/warn-documentation.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-07-02fix trivial typos in comments; NFCHiroshi Inoue1-1/+1
llvm-svn: 306969
2017-04-21[PR32667] -Wdocumentation should allow @param/@returns for fields/variablesAlex Lorenz1-0/+72
that have a function/block pointer type This commit improves the -Wdocumentation warning by making sure that @param and @returns commands won't trigger warnings when used for fields, variables, or properties whose type is a function/block pointer type. The function/block pointer type must be specified directly with the declaration, and when a typedef is used the warning is still emitted. In the future we might also want to handle the std::function type as well. rdar://24978538 llvm-svn: 300981
2016-08-25[Sema][Comments] Add support for TypeAliasTemplateBruno Cardoso Lopes1-0/+32
Emit proper diagnostics when -Wdocumentation is used with constructs such as: template<typename T> using fn = int(T aaa, int ccc); Previously clang wouldn't recognize the function and complain with 'comment that is not attached to a function declaration'. Differential Revision: https://reviews.llvm.org/D23860 rdar://problem/27300695 llvm-svn: 279754
2016-08-24[Sema][Comments] Support @param with c++ 'using' keywordBruno Cardoso Lopes1-0/+63
Give appropriate warnings with -Wdocumentation for @param comments that refer to function aliases defined with 'using'. Very similar to typedef's behavior. This does not add support for TypeAliasTemplateDecl yet. Differential Revision: https://reviews.llvm.org/D23783 rdar://problem/27300695 llvm-svn: 279662
2015-04-15Comment parsing: fix an assertion failure on a verbatim block terminated ↵Dmitri Gribenko1-0/+6
with "**/" llvm-svn: 235057
2014-04-22Comment parsing: in the generated XML file, mark HTML that is safe to passDmitri Gribenko1-0/+13
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. llvm-svn: 206882
2014-03-19Comment parsing: recognize \param ... on function templates with variadicDmitri Gribenko1-0/+20
parameters Patch by Joe Ranieri. llvm-svn: 204235
2013-12-17Documentation comment parsing: when checking if we have typedef to somethingDmitri Gribenko1-0/+12
that we consider a function for the purposes of checking \param and \returns, look through reference types. llvm-svn: 197530
2013-12-17Documentation comment parsing: allow \param and \returns on std::function,Dmitri Gribenko1-0/+31
boost::function and similar function-like objects llvm-svn: 197528
2013-12-17Documentation comment parsing: rearrange tests to clarify the intent of ↵Dmitri Gribenko1-14/+22
these tests llvm-svn: 197517
2013-06-24Comment parsing: allow "\param ..." to describe variadic argumentsDmitri Gribenko1-0/+16
Original patch by Fariborz Jahanian; extended by me. Fixes rdar://14124644 llvm-svn: 184688
2013-06-23Documentation parsing: recognize \relates, \related, \relatesonly, \relatedonlyDmitri Gribenko1-0/+19
so that -Wdocumentation-unknown-command does not warn on these commands. Fixes PR16092. llvm-svn: 184676
2013-06-22Comment parsing: followup to r184610: allow multiple \returnsDmitri Gribenko1-4/+4
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>). llvm-svn: 184652
2013-06-21[document parsing]: Allow multiple adjacent \return and the likeFariborz Jahanian1-4/+0
commands. Render them properly in XML output. // rdar://14207725 llvm-svn: 184610
2013-06-19documentation parsing: patch to make @class work forFariborz Jahanian1-0/+44
class templates; and similarly, @function works for function templates. // rdar://14124702 llvm-svn: 184329
2013-05-03[Doc parsing] Provide diagnostics for unknown documentation Fariborz Jahanian1-1/+1
commands. // rdar://12381408 llvm-svn: 181071
2013-03-07HeaderDoc: Support more of HeaderDoc documentation Fariborz Jahanian1-0/+28
commands; top level tags such as @interface and their 2nd level tags such as @coclass, etc. // rdar://12379114 llvm-svn: 176667
2013-03-05doc. parsing. Improve on diagnostics on my last patch.Fariborz Jahanian1-2/+2
// rdar://13094352. llvm-svn: 176525
2013-03-05doc parsing. Add @method and @callback forFariborz Jahanian1-10/+12
checkings and few other refactoring/cleanup. // rdar://13094352. llvm-svn: 176509
2013-03-05doc parsing. We want to issue a strong warning whenFariborz Jahanian1-0/+9
an @function comment is not followed by a function decl. // rdar://13094352 llvm-svn: 176468
2013-03-04Comment parsing tests: move a test into a group of similar testsDmitri Gribenko1-4/+6
llvm-svn: 176449
2013-03-04[comment parsing] source fidelity for tparam command too.Fariborz Jahanian1-0/+4
// rdar://13066276 llvm-svn: 176448
2013-03-04warn-documentation.cpp: reorganize testsDmitri Gribenko1-28/+18
Tests are ordered by command in this file. It is nice to keep it that way. llvm-svn: 176445
2013-03-04comment parsing. Missed a case of referringFariborz Jahanian1-0/+8
to original command in diagnostic. // rdar://13066276 llvm-svn: 176444
2013-03-01comment parsing. Keep the original command format Fariborz Jahanian1-8/+20
in AST for source fidelity and use it in diagnostics to refer to the original format. // rdar://13066276 llvm-svn: 176387
2013-01-31[Comment parsing] Add support for recognizingFariborz Jahanian1-0/+8
\headerfile command and representing it in an xml document. Patch reviewed by Dmitri Gribenko. // rdar://12397511 llvm-svn: 174109
2013-01-27Comment parsing: attach any tag type's documentation to its typedef if latterDmitri Gribenko1-0/+23
does not have one of its own. // rdar://13067629 Original patch (r173586 and r173587) by Fariborz Jahanian, modified by me. llvm-svn: 173626
2013-01-26Comment parsing: actually check for a block command after "\param x"Dmitri Gribenko1-0/+28
This fixes PR15068. llvm-svn: 173539
2012-11-18clang/test/Sema/warn-documentation.cpp: Try to fix up the testcase in r168277.NAKAMURA Takumi1-1/+1
llvm-svn: 168278
2012-11-18Documentation parsing: propely handle a lone '\endverbatim' and emit a warning.Dmitri Gribenko1-0/+18
We actually used to assert on this. Thanks to NAKAMURA Takumi for noticing this! llvm-svn: 168277
2012-09-22Comment sema: warn when comment has \deprecated but declaration does not have aDmitri Gribenko1-2/+27
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. llvm-svn: 164467
2012-09-15Comment parsing: don't treat typedef to a typedef to a function as aDmitri Gribenko1-0/+6
'function-like' type that can be annotated with \param. Thanks to Eli Friedman for noticing! llvm-svn: 163985
2012-09-14Comment parsing: support the "\invariant" command.Dmitri Gribenko1-0/+8
llvm-svn: 163905
2012-09-13Comment parsing: handle \deprecated command. It is a block command, but itDmitri Gribenko1-0/+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. llvm-svn: 163836
2012-09-11Comment parsing: handle non-builtin commands correctly. After semanticDmitri Gribenko1-0/+5
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. llvm-svn: 163646
2012-08-24Comment diagnostics: for unresolved parameters, do not suggest parameter fixitDmitri Gribenko1-13/+37
with parameter that is documented. Fixes PR13670, <rdar://problem/12155840>. llvm-svn: 162570
2012-08-24Comment semantic analysis: treat function typedefs as functions so that one canDmitri Gribenko1-0/+23
use \param and \returns in documentation. Fixes PR13533. llvm-svn: 162507
2012-08-22Comment parsing: parse "<blah" as an HTML tag only if "blah" is a known tagDmitri Gribenko1-2/+2
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. llvm-svn: 162407
2012-08-16Attaching comments to declarations: parse the comment in context of theDmitri Gribenko1-0/+16
declaration it was attached to. llvm-svn: 162033
2012-08-14Attaching comments to redeclarations: fix wrong assumptionsDmitri Gribenko1-7/+37
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. llvm-svn: 161878
2012-08-13When looking for the comment associated with a declaration, adjust theDouglas Gregor1-0/+16
'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. llvm-svn: 161762
2012-08-07libclang API for comment-to-xml conversion.Dmitri Gribenko1-0/+4
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! llvm-svn: 161431
2012-08-06Comment diagnostics: warn on duplicate \brief and \return commands.Dmitri Gribenko1-52/+110
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. llvm-svn: 161325
2012-08-06Comment diagnostics: \return in void function: specialize diagnostic text forDmitri Gribenko1-11/+11
ObjC methods. llvm-svn: 161324
2012-08-03Comment diagnostics: warn if \returns is used in a non-function comment or ifDmitri Gribenko1-0/+78
the function returns void. llvm-svn: 161261
2012-08-02Comments: handle template paramter documentation in alias-declarationDmitri Gribenko1-0/+12
templates. llvm-svn: 161215
2012-08-02Attaching comments to declarations: handle using-declaration.Dmitri Gribenko1-17/+26
llvm-svn: 161211
2012-07-31Comment parsing: add support for \tparam command on all levels.Dmitri Gribenko1-2/+189
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. llvm-svn: 161087
2012-07-30Comment parser: don't crash on a completely empty \param followed by a blockDmitri Gribenko1-0/+6
command llvm-svn: 160975
2012-07-24Comment parsing tests: fix testDmitri Gribenko1-1/+1
llvm-svn: 160700