aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/CommentSema.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-04-26-Wdocumentation should not check the @returns command for Objective-CAlex Lorenz1-2/+4
function/block pointer properties The commit r300981 allowed @param/@return commands for function/block pointer property declarations. This meant that -Wdocumentation started warning about @return that was used to document properties whose function/block type returned void. However, prior to that commit, we allowed @return for all property declarations, because it can be used to document the value that's returned by the property getter. This commit restores the previous behaviour: now the @return command can be used to document all properties without warnings. rdar://24978538 llvm-svn: 301402
2017-04-21[PR32667] -Wdocumentation should allow @param/@returns for fields/variablesAlex Lorenz1-2/+26
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-28AST: improve layout of SimpleTypoCorrectorSaleem Abdulrasool1-6/+5
Add the "explicit" specifier to the single-argument constructor of SimpleTypoCorrector. Reorder the fields to remove excessive padding (8 bytes). Patch by Alexander Shaposhnikov! llvm-svn: 279946
2016-02-10Fix some Clang-tidy readability-redundant-control-flow warnings; other minor ↵Eugene Zelenko1-7/+4
fixes. Differential revision: http://reviews.llvm.org/D17060 llvm-svn: 260414
2014-05-12[C++11] Use 'nullptr'. AST edition.Craig Topper1-5/+6
llvm-svn: 208517
2014-04-30Comment parsing: remove HTML attribute validationDmitri Gribenko1-13/+8
Since the community says that a blacklist is not good enough, and I don't have enough time now to implement a proper whitelist, let's just remove the attribute validation. But, nevertheless, we can still communicate in the generated XML if our parser found an issue with the HTML. But this bit is best-effort and is specifically called out in the schema as such. llvm-svn: 207712
2014-04-22Comment parsing: in the generated XML file, mark HTML that is safe to passDmitri Gribenko1-4/+29
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-1/+4
parameters Patch by Joe Ranieri. llvm-svn: 204235
2014-01-27Comment parsing: don't crash while parsing \deprecated in a standalone commentDmitri Gribenko1-2/+11
(comment without a decl). I think this can not happen during normal compilation with -Wdocumentation, only while using Clang APIs to parse comments outside of a source file. Based on a patch by Olivier Goffart. llvm-svn: 200230
2014-01-25Rename getResultType() on function and method declarations to getReturnType()Alp Toker1-1/+1
A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. llvm-svn: 200082
2013-12-17Fix strange indentation and remove trailing whitespace on empty linesDmitri Gribenko1-10/+10
llvm-svn: 197513
2013-11-10Avoid double StringMap lookups. No functionality change.Benjamin Kramer1-5/+3
llvm-svn: 194355
2013-11-10CommentSema: Factor code better. No functionality change.Benjamin Kramer1-44/+28
llvm-svn: 194354
2013-08-23Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm1-2/+1
No functionality change intended. llvm-svn: 189112
2013-06-24Comment parsing: allow "\param ..." to describe variadic argumentsDmitri Gribenko1-1/+19
Original patch by Fariborz Jahanian; extended by me. Fixes rdar://14124644 llvm-svn: 184688
2013-06-24Move comment on Sema::isFunctionPointerVarDecl() to the header fileDmitri Gribenko1-3/+1
llvm-svn: 184677
2013-06-22Comment parsing: followup to r184610: allow multiple \returnsDmitri Gribenko1-7/+1
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-3/+2
commands. Render them properly in XML output. // rdar://14207725 llvm-svn: 184610
2013-06-19documentation parsing: patch to make @class work forFariborz Jahanian1-3/+21
class templates; and similarly, @function works for function templates. // rdar://14124702 llvm-svn: 184329
2013-06-19Revert r184249, "doc. parsing: Allow parameter name "..." for variadic ↵NAKAMURA Takumi1-15/+1
functions/methods." It crashes in the case; /// Without any "param"s in the description. int printf(const char *format, ...); llvm-svn: 184283
2013-06-18doc. parsing: Allow parameter name "..." for variadic functions/methods.Fariborz Jahanian1-1/+15
// rdar://14124644 llvm-svn: 184249
2013-05-20doc. parsing. HeaderDoc documentaton allows use ofFariborz Jahanian1-0/+5
@class command on an @interface declaration. Turn off the warning for this case. // rdar://13927330 llvm-svn: 182334
2013-03-18documentation comment parsing. Added couple of Fariborz Jahanian1-2/+8
top-level HeaderDoc tags @functiongroup and @methodgroup to doc. tags recognized. // rdar://12379114 llvm-svn: 177358
2013-03-08Documentation parsing. Some refactoring and codeFariborz Jahanian1-36/+81
improvements per Dmtiri's comments. // rdar://12379114 llvm-svn: 176739
2013-03-07HeaderDoc: Support more of HeaderDoc documentation Fariborz Jahanian1-2/+100
commands; top level tags such as @interface and their 2nd level tags such as @coclass, etc. // rdar://12379114 llvm-svn: 176667
2013-03-06say objective-C in the warning and streamlineFariborz Jahanian1-9/+8
several diagnostics into one. // rdar://13094352 llvm-svn: 176560
2013-03-05fix a missing check in my last patch.Fariborz Jahanian1-3/+11
// rdar://13094352 llvm-svn: 176529
2013-03-05doc. parsing. Improve on diagnostics on my last patch.Fariborz Jahanian1-7/+19
// rdar://13094352. llvm-svn: 176525
2013-03-05Fix this checkin.Fariborz Jahanian1-1/+1
llvm-svn: 176510
2013-03-05doc parsing. Add @method and @callback forFariborz Jahanian1-3/+21
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: refactor handling of command markers in ASTDmitri Gribenko1-23/+29
* Use the term 'command marker', because the semantics of 'backslash' and 'at' commands are the same. (Talking about 'at commands' makes them look like a special entity.) * Sink the flag down into bitfields, reducing the size of AST nodes. * Change the flag into an enum for clarity. Boolean function parameters are not very clear. * Add unittests for new tok::at_command tokens. llvm-svn: 176461
2013-03-04[comment parsing] source fidelity for tparam command too.Fariborz Jahanian1-0/+1
// rdar://13066276 llvm-svn: 176448
2013-03-04comment parsing. Missed a case of referringFariborz Jahanian1-0/+1
to original command in diagnostic. // rdar://13066276 llvm-svn: 176444
2013-03-02Some refactoring in my patch on documentFariborz Jahanian1-12/+15
command source fidelity. // rdar://13066276 llvm-svn: 176401
2013-03-01comment parsing. Keep the original command format Fariborz Jahanian1-0/+6
in AST for source fidelity and use it in diagnostics to refer to the original format. // rdar://13066276 llvm-svn: 176387
2013-02-27comment parsing: Properties are considered like methods, and people Fariborz Jahanian1-0/+11
think of them as having return values that may be computed. Don't warn when using @return in their comment. // rdar://13189938 llvm-svn: 176147
2013-01-31[Comment parsing] Add support for recognizingFariborz Jahanian1-1/+8
\headerfile command and representing it in an xml document. Patch reviewed by Dmitri Gribenko. // rdar://12397511 llvm-svn: 174109
2013-01-12Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko1-3/+3
brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth1-1/+1
uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
2012-12-01Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't ↵Benjamin Kramer1-1/+2
pull in all the generated Attr code. Required to pull some functions out of line, but this shouldn't have a perf impact. No functionality change. llvm-svn: 169092
2012-10-18[doc parsing] use getParamName to access parameter Fariborz Jahanian1-2/+2
for current(rewritten) comment and getParamNameAsWritten to access param name coming with \param marker. llvm-svn: 166231
2012-10-11search for overridden methods with comment when overriding methodFariborz Jahanian1-1/+1
has none of its own. Factor in Doug's comments. // rdar://12378793 llvm-svn: 165771
2012-10-10[Doc parsing] This patch searches overridden objc/c++Fariborz Jahanian1-6/+6
methods looking for documentation on a particular base class inherited by any method that overrides the base class. In case of redeclaration, as when objc method is defined in the implementation, it also looks up for documentation in class/class extension being redeclared. llvm-svn: 165643
2012-09-29Move the 'find macro by spelling' infrastructure to the Preprocessor class andDmitri Gribenko1-3/+21
use it to suggest appropriate macro for __attribute__((deprecated)) in -Wdocumentation-deprecated-sync. llvm-svn: 164892
2012-09-22Comment sema: warn when comment has \deprecated but declaration does not have aDmitri Gribenko1-0/+34
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-13Comment parsing: handle \deprecated command. It is a block command, but itDmitri Gribenko1-0/+3
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-2/+8
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-09-10Remove redundant semicolons which are null statements.Dmitri Gribenko1-1/+1
llvm-svn: 163546
2012-09-10Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.Dmitri Gribenko1-34/+40
Now we have a list of all commands. This is a good thing in itself, but it also enables us to easily implement typo correction for command names. With this change we have objects that contain information about each command, so it makes sense to resolve command name just once during lexing (currently we store command names as strings and do a linear search every time some property value is needed). Thus comment token and AST nodes were changed to contain a command ID -- index into a tables of builtin and registered commands. Unknown commands are registered during parsing and thus are also uniformly assigned an ID. Using an ID instead of a StringRef is also a nice memory optimization since ID is a small integer that fits into a common bitfield in Comment class. This change implies that to get any information about a command (even a command name) we need a CommandTraits object to resolve the command ID to CommandInfo*. Currently a fresh temporary CommandTraits object is created whenever it is needed since it does not have any state. But with this change it has state -- new commands can be registered, so a CommandTraits object was added to ASTContext. Also, in libclang CXComment has to be expanded to include a CXTranslationUnit so that all functions working on comment AST nodes can get a CommandTraits object. This breaks binary compatibility of CXComment APIs. Now clang_FullComment_getAsXML(CXTranslationUnit TU, CXComment CXC) doesn't need TU parameter anymore, so it was removed. This is a source-incompatible change for this C API. llvm-svn: 163540