aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/CommentSema.cpp
AgeCommit message (Collapse)AuthorFilesLines
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
2012-08-31Comment HTML tag name machers: move from StringSwitch to an efficientDmitri Gribenko1-25/+4
TableGen-generated string matcher. llvm-svn: 162969
2012-08-24Comment diagnostics: for unresolved parameters, do not suggest parameter fixitDmitri Gribenko1-52/+88
with parameter that is documented. Fixes PR13670, <rdar://problem/12155840>. llvm-svn: 162570
2012-08-09Comment parsing: extract TableGen'able pieces into new CommandTraits class.Dmitri Gribenko1-55/+7
llvm-svn: 161548
2012-08-06Comment AST: DeclInfo: collapse a bunch of boolean flags into an enum.Dmitri Gribenko1-4/+4
llvm-svn: 161352
2012-08-06Comment parser and sema: remove useless return valuesDmitri Gribenko1-43/+30
llvm-svn: 161331
2012-08-06Comment diagnostics: warn on duplicate \brief and \return commands.Dmitri Gribenko1-3/+40
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-1/+4
ObjC methods. llvm-svn: 161324
2012-08-03Comment diagnostics: warn if \returns is used in a non-function comment or ifDmitri Gribenko1-5/+40
the function returns void. llvm-svn: 161261
2012-08-02Comments AST: refactor DeclInfo to use an enum for decl kind instead ofDmitri Gribenko1-1/+1
separate flags. llvm-svn: 161217
2012-08-01Initialize flag in DeclInfo.Dmitri Gribenko1-0/+1
llvm-svn: 161141
2012-08-01Comment AST: add DeclInfo to store information about the declaration. Sema wasDmitri Gribenko1-67/+22
already extracting most of this, but discarding at the end of semantic analysis. llvm-svn: 161140
2012-07-31Comment parsing: add support for \tparam command on all levels.Dmitri Gribenko1-23/+258
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-27CommentSema.cpp: remove extra semicolonDmitri Gribenko1-1/+1
llvm-svn: 160901
2012-07-27Comment Sema: don't try to typo-correct a \param when function has zeroDmitri Gribenko1-0/+4
arguments. Just an optimization, no functional change. llvm-svn: 160896
2012-07-24Comment diagnostics: add warning for multiple \param commands with duplicateDmitri Gribenko1-1/+11
parameter names. llvm-svn: 160696
2012-07-24CommentSema: simplify functions, per Jordan's comment.Dmitri Gribenko1-8/+4
llvm-svn: 160689
2012-07-23Comment Sema: refactor handling of 'ParmVarDecl's and save them in Sema members.Dmitri Gribenko1-26/+49
llvm-svn: 160634
2012-07-23Comment AST: add InlineContentComment::RenderKind to specify a defaultDmitri Gribenko1-10/+28
rendering mode for clients that don't want to interpret Doxygen commands. Also add a libclang API to query this information. llvm-svn: 160633
2012-07-19CommentSema: add more inline commands to tablesDmitri Gribenko1-2/+3
llvm-svn: 160481
2012-07-18CommentSema: \short is the same as \brief.Dmitri Gribenko1-2/+2
llvm-svn: 160414
2012-07-13Comment AST nodes: rename getXXXCount() methods to getNumXXXs() to be in ↵Dmitri Gribenko1-3/+3
line with Statement AST nodes. llvm-svn: 160182
2012-07-13Comment parsing: repaint the bikesched: rename 'HTML open tags' to 'HTML ↵Dmitri Gribenko1-38/+36
start tags' and 'HTML close tags' to 'HTML end tags' according to HTML spec. llvm-svn: 160153
2012-07-12Make concepts of optional and forbidden end tags separate. Thanks Jordan ↵Dmitri Gribenko1-7/+30
for pointing this! llvm-svn: 160149
2012-07-12AST/CommentSema.cpp: Fix signess in abs() to appease msvc. It would not make ↵NAKAMURA Takumi1-1/+2
sense to pass (unsigned)-(unsigned) to abs(). llvm-svn: 160097
2012-07-11Fix warning.Richard Smith1-1/+1
llvm-svn: 160087
2012-07-11Enable comment parsing and semantic analysis to emit diagnostics. A fewDmitri Gribenko1-61/+253
diagnostics implemented -- see testcases. I created a new TableGen file for comment diagnostics, DiagnosticCommentKinds.td, because comment diagnostics don't logically fit into AST diagnostics file. But I don't feel strongly about it. This also implements support for self-closing HTML tags in comment lexer and parser (for example, <br />). In order to issue precise diagnostics CommentSema needs to know the declaration the comment is attached to. There is no easy way to find a decl by comment, so we match comments and decls in lockstep: after parsing one declgroup we check if we have any new, not yet attached comments. If we do -- then we do the usual comment-finding process. It is interesting that this automatically handles trailing comments. We pick up not only comments that precede the declaration, but also comments that *follow* the declaration -- thanks to the lookahead in the lexer: after parsing the declgroup we've consumed the semicolon and looked ahead through comments. Added -Wdocumentation-html flag for semantic HTML errors to allow the user to disable only HTML warnings (but not HTML parse errors, which we emit as warnings in -Wdocumentation). llvm-svn: 160078
2012-07-06Implement AST classes for comments, a real parser for Doxygen comments and aDmitri Gribenko1-0/+268
very simple semantic analysis that just builds the AST; minor changes for lexer to pick up source locations I didn't think about before. Comments AST is modelled along the ideas of HTML AST: block and inline content. * Block content is a paragraph or a command that has a paragraph as an argument or verbatim command. * Inline content is placed within some block. Inline content includes plain text, inline commands and HTML as tag soup. llvm-svn: 159790