History log of /external/clang/lib/AST/Comment.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
bafe46fe35ff58cc10487ba8bdcbcccd6d3319e7 11-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Add unused markings to suppress warnings.

trunk clang is a bit more aggressive about emitting unused-declaration
warnings, so adjust some AST code to match. Specifically, use
LLVM_ATTRIBUTE_UNUSED for declarations which are never supposed to be
referenced, and turn references to declarations which are supposed to be
referenced into odr-uses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190443 91177308-0d34-0410-b5e6-96231b3b80d8
3520868fcffb6e3405014cd47973bfa757487a40 23-Aug-2013 Dmitri Gribenko <gribozavr@gmail.com> Use CharInfo.h routines in TextComment::isWhitespaceNoCache

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189115 91177308-0d34-0410-b5e6-96231b3b80d8
eb9c55fdfa25d97f61c04f4f06fd499d988045c0 06-Jul-2013 Fariborz Jahanian <fjahanian@apple.com> [comment parsing]: Removes an unsafe API whose
use can cause crash. No test is available. It is uncovered
by code browsing. // rdar://14348205

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185732 91177308-0d34-0410-b5e6-96231b3b80d8
c5b0054693b3b3cafe6a13549358c22e07fcd4ff 24-Jun-2013 Dmitri Gribenko <gribozavr@gmail.com> Comment parsing: allow "\param ..." to describe variadic arguments

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
5543169296beeb183b9c9392debc774fcf493eeb 05-May-2013 Dmitri Gribenko <gribozavr@gmail.com> Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef constructor from None

Patch by Robert Wilhelm.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181139 91177308-0d34-0410-b5e6-96231b3b80d8
39e6ab4be93d9c5e729a578ddd9d415cd2d49872 18-Feb-2013 David Blaikie <dblaikie@gmail.com> Replace TypeLoc llvm::cast support to be well-defined.

The TypeLoc hierarchy used the llvm::cast machinery to perform undefined
behavior by casting pointers/references to TypeLoc objects to derived types
and then using the derived copy constructors (or even returning pointers to
derived types that actually point to the original TypeLoc object).

Some context is in this thread:
Though it's spread over a few months which can be hard to read in the mail

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175462 91177308-0d34-0410-b5e6-96231b3b80d8
acd356e18ecb8213d65f1454bb3c1bb4f6892bab 14-Jan-2013 Alexander Kornienko <alexfh@google.com> Dump comments in -ast-dump.

"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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172409 91177308-0d34-0410-b5e6-96231b3b80d8
8cfabf2cb278efc1f694f1d9aab76888a60ee3ac 19-Oct-2012 Dmitri Gribenko <gribozavr@gmail.com> Remove const_casts by propagating constness down to called functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166287 91177308-0d34-0410-b5e6-96231b3b80d8
262e60c1ccb5197e8e2ea49ada1196ed65183734 18-Oct-2012 Fariborz Jahanian <fjahanian@apple.com> [doc parsing] use getParamName to access parameter
for current(rewritten) comment and getParamNameAsWritten
to access param name coming with \param marker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166231 91177308-0d34-0410-b5e6-96231b3b80d8
1bfb00dabf83d8c8b95b7276b4c0ae3fd64832c8 17-Oct-2012 Fariborz Jahanian <fjahanian@apple.com> [Doc parsing]: This patch adds <Declaration> tag to
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166130 91177308-0d34-0410-b5e6-96231b3b80d8
88d285cc0fc4ecdbc88d1779dcd2da968aa8b191 15-Oct-2012 Fariborz Jahanian <fjahanian@apple.com> Fixes location of overriding declaration with no comment
of their own.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165972 91177308-0d34-0410-b5e6-96231b3b80d8
6553c686cb419b22b4c79d05a422fb1e96f6e122 15-Oct-2012 Fariborz Jahanian <fjahanian@apple.com> structured document comment: patch to provide comment for overriding function
template when comment is comming from overridden declaration.
// rdar://12378793

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165953 91177308-0d34-0410-b5e6-96231b3b80d8
749ace614b6ea1ae11d194a60b18e1e43e1db243 12-Oct-2012 Fariborz Jahanian <fjahanian@apple.com> search for overridden methods with comment when overriding method
has none of its own. Factor in Doug's comments.
// rdar://12378793

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165771 91177308-0d34-0410-b5e6-96231b3b80d8
bf967be66ea8c51b66c61659c23240f762a56dbe 10-Oct-2012 Fariborz Jahanian <fjahanian@apple.com> [Doc parsing] This patch searches overridden objc/c++
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165643 91177308-0d34-0410-b5e6-96231b3b80d8
ec504e0d677594fe975e29b25d6d47be54038baf 15-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment parsing: don't treat typedef to a typedef to a function as a
'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
e4330a302ac20b41b9800267ebd4b5b01f8553f8 10-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.

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

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163540 91177308-0d34-0410-b5e6-96231b3b80d8
70ff1091315c60fed68d7197c637ec8c588e67a1 24-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment semantic analysis: treat function typedefs as functions so that one can
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
cff339a60a571a606a7510548f661dc6a719368d 07-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment AST: DeclInfo: add a special kind for enums.
Comment XML: add a root node kind for enums.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161442 91177308-0d34-0410-b5e6-96231b3b80d8
dd7b803e6ce5b8e61cf3b14af2c57199e5e991d9 07-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment AST: treat enumerators as "variables" in DeclInfo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161435 91177308-0d34-0410-b5e6-96231b3b80d8
04bf29eb1b197e0a103139ab5d63b0b97432f004 06-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment AST: DeclInfo: collapse a bunch of boolean flags into an enum.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161352 91177308-0d34-0410-b5e6-96231b3b80d8
88815f3f81361692dd281000e3e46bf163b2f28b 06-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment diagnostics: \return in void function: specialize diagnostic text for
ObjC methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161324 91177308-0d34-0410-b5e6-96231b3b80d8
89ab7d0012ffe02a335b765eeb9b48977a5ecd79 03-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment diagnostics: warn if \returns is used in a non-function comment or if
the function returns void.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161261 91177308-0d34-0410-b5e6-96231b3b80d8
5b32a08abe5530e9294b7b373cc70199b9e2fca4 03-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment AST: convert a huge if -- else if statement on Decl's type into a
switch. Thanks Sean Silva for suggestion!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161225 91177308-0d34-0410-b5e6-96231b3b80d8
af19a6aaa2959ef5e76f19d51e87ef523bdeedde 02-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Comments AST: refactor DeclInfo to use an enum for decl kind instead of
separate flags.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161217 91177308-0d34-0410-b5e6-96231b3b80d8
967e5d7ebb775a93f9c200d19d557d18bf945f10 02-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Comments: handle template paramter documentation in alias-declaration

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161215 91177308-0d34-0410-b5e6-96231b3b80d8
1ca7ecc8854ffea215c033a0d8482551bf1b73f0 02-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment AST: add DeclInfo to store information about the declaration. Sema was
already extracting most of this, but discarding at the end of semantic analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161140 91177308-0d34-0410-b5e6-96231b3b80d8
858e69fe1305bdffb76a200c0f498685f11e65ae 19-Jul-2012 Dmitri Gribenko <gribozavr@gmail.com> Fix ParagraphComment::isWhitespace(): a paragraph without a non-whitespace
TextComment node was considered whitespace even if it contained other child

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160474 91177308-0d34-0410-b5e6-96231b3b80d8
0f7f10bd0ea08abf56c69fea9316275a1ee0e40c 18-Jul-2012 Dmitri Gribenko <gribozavr@gmail.com> Add caching for TextComment::isWhitespace(), ParagraphComment::isWhitespace().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160452 91177308-0d34-0410-b5e6-96231b3b80d8
fb3643a7509dcde7fb0fb7290e4b3b42b317700c 18-Jul-2012 Dmitri Gribenko <gribozavr@gmail.com> On Darwin, the linker removes functions in CommentDumper.o (Comment::dump())
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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160437 91177308-0d34-0410-b5e6-96231b3b80d8
a5ef44ff5d93a3be6ca67782828157a71894cf0c 11-Jul-2012 Dmitri Gribenko <gribozavr@gmail.com> Enable comment parsing and semantic analysis to emit diagnostics. A few
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160078 91177308-0d34-0410-b5e6-96231b3b80d8
4d48b5c1d58c381e6e0c719701ef433b530e0e1a 06-Jul-2012 Matt Beaumont-Gay <matthewbg@google.com> Sprinkle llvm_unreachable around to placate GCC's -Wreturn-type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159860 91177308-0d34-0410-b5e6-96231b3b80d8
8d3ba23f2d9e6c87794d059412a0808c9cbacb25 06-Jul-2012 Dmitri Gribenko <gribozavr@gmail.com> Implement AST classes for comments, a real parser for Doxygen comments and a
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159790 91177308-0d34-0410-b5e6-96231b3b80d8