aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/Comment.cpp
AgeCommit message (Collapse)AuthorFilesLines
2013-01-14Dump comments in -ast-dump.Alexander Kornienko1-14/+0
http://llvm-reviews.chandlerc.com/D269 "Added dumping of declaration comments in ASTDumper. This required moving the comment dumping code from CommentDumper so that the indentation is correct." Patch by Philip Craig! llvm-svn: 172409
2012-10-19Remove const_casts by propagating constness down to called functions.Dmitri Gribenko1-3/+3
llvm-svn: 166287
2012-10-18[doc parsing] use getParamName to access parameter Fariborz Jahanian1-13/+11
for current(rewritten) comment and getParamNameAsWritten to access param name coming with \param marker. llvm-svn: 166231
2012-10-17[Doc parsing]: This patch adds <Declaration> tag to Fariborz Jahanian1-1/+1
XML comment for declarations which pretty-prints declaration. I had to XFAIL one test annotate-comments.cpp. This test is currently unmaintainable as written. Dmitri G., can you see what we can do about this test. We should change this test such that adding a new tag does not wreck havoc to the test. llvm-svn: 166130
2012-10-15Fixes location of overriding declaration with no commentFariborz Jahanian1-1/+2
of their own. llvm-svn: 165972
2012-10-15structured document comment: patch to provide comment for overriding functionFariborz Jahanian1-0/+15
template when comment is comming from overridden declaration. // rdar://12378793 llvm-svn: 165953
2012-10-11search for overridden methods with comment when overriding methodFariborz Jahanian1-0/+6
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-10/+10
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-15Comment parsing: don't treat typedef to a typedef to a function as aDmitri Gribenko1-8/+0
'function-like' type that can be annotated with \param. Thanks to Eli Friedman for noticing! llvm-svn: 163985
2012-09-10Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.Dmitri Gribenko1-3/+5
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-24Comment semantic analysis: treat function typedefs as functions so that one canDmitri Gribenko1-1/+52
use \param and \returns in documentation. Fixes PR13533. llvm-svn: 162507
2012-08-07Comment AST: DeclInfo: add a special kind for enums.Dmitri Gribenko1-0/+3
Comment XML: add a root node kind for enums. llvm-svn: 161442
2012-08-07Comment AST: treat enumerators as "variables" in DeclInfo.Dmitri Gribenko1-0/+1
llvm-svn: 161435
2012-08-06Comment AST: DeclInfo: collapse a bunch of boolean flags into an enum.Dmitri Gribenko1-12/+7
llvm-svn: 161352
2012-08-06Comment diagnostics: \return in void function: specialize diagnostic text forDmitri Gribenko1-0/+2
ObjC methods. llvm-svn: 161324
2012-08-03Comment diagnostics: warn if \returns is used in a non-function comment or ifDmitri Gribenko1-2/+7
the function returns void. llvm-svn: 161261
2012-08-03Comment AST: convert a huge if -- else if statement on Decl's type into aDmitri Gribenko1-17/+56
switch. Thanks Sean Silva for suggestion! llvm-svn: 161225
2012-08-02Comments AST: refactor DeclInfo to use an enum for decl kind instead ofDmitri Gribenko1-4/+17
separate flags. llvm-svn: 161217
2012-08-02Comments: handle template paramter documentation in alias-declarationDmitri Gribenko1-0/+4
templates. llvm-svn: 161215
2012-08-01Comment AST: add DeclInfo to store information about the declaration. Sema wasDmitri Gribenko1-0/+64
already extracting most of this, but discarding at the end of semantic analysis. llvm-svn: 161140
2012-07-19Fix ParagraphComment::isWhitespace(): a paragraph without a non-whitespaceDmitri Gribenko1-1/+2
TextComment node was considered whitespace even if it contained other child nodes. llvm-svn: 160474
2012-07-18Add caching for TextComment::isWhitespace(), ParagraphComment::isWhitespace().Dmitri Gribenko1-2/+2
llvm-svn: 160452
2012-07-18On Darwin, the linker removes functions in CommentDumper.o (Comment::dump())Dmitri Gribenko1-0/+14
despite __attribute__(__used__). As explained by Argyrios, > .a archive files do some stripping of their own and they remove .o files that > contain functions that are not referenced by any other .o file. The fix is to use these functions from another .o file. Thanks, Argyrios! llvm-svn: 160437
2012-07-11Enable comment parsing and semantic analysis to emit diagnostics. A fewDmitri Gribenko1-0/+32
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-06Sprinkle llvm_unreachable around to placate GCC's -Wreturn-type.Matt Beaumont-Gay1-1/+2
llvm-svn: 159860
2012-07-06Implement AST classes for comments, a real parser for Doxygen comments and aDmitri Gribenko1-0/+90
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