Граф коммитов

38 Коммитов

Автор SHA1 Сообщение Дата
Chandler Carruth 55fc873017 Sort all of Clang's files under 'lib', and fix up the broken headers
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 09:13:33 +00:00
Benjamin Kramer 2fa67efeaf Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169092 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 15:09:41 +00:00
Fariborz Jahanian 262e60c1cc [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
2012-10-18 21:42:42 +00:00
Fariborz Jahanian 749ace614b 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
2012-10-11 23:52:50 +00:00
Fariborz Jahanian bf967be66e [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
2012-10-10 18:34:52 +00:00
Dmitri Gribenko 1952354bd3 Move the 'find macro by spelling' infrastructure to the Preprocessor class and
use it to suggest appropriate macro for __attribute__((deprecated)) in
-Wdocumentation-deprecated-sync.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164892 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-29 11:40:46 +00:00
Dmitri Gribenko 0bd9838751 Comment sema: warn when comment has \deprecated but declaration does not have a
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164467 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-22 21:47:50 +00:00
Dmitri Gribenko abcf0dccc9 Comment parsing: handle \deprecated command. It is a block command, but it
should be fine to use it without further explanations in the attached
paragraph, so the warning about empty paragraph was turned off for it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163836 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-13 20:36:01 +00:00
Dmitri Gribenko b0b8a96df2 Comment parsing: handle non-builtin commands correctly. After semantic
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163646 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 19:22:03 +00:00
Dmitri Gribenko 1ad23d6200 Remove redundant semicolons which are null statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163546 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 21:20:09 +00:00
Dmitri Gribenko e4330a302a 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
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163540 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 20:32:42 +00:00
Dmitri Gribenko c24a76e376 Comment HTML tag name machers: move from StringSwitch to an efficient
TableGen-generated string matcher.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162969 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31 02:21:44 +00:00
Dmitri Gribenko 9edd2c8a2f Comment diagnostics: for unresolved parameters, do not suggest parameter fixit
with parameter that is documented.

Fixes PR13670, <rdar://problem/12155840>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162570 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 17:45:39 +00:00
Dmitri Gribenko aa58081902 Comment parsing: extract TableGen'able pieces into new CommandTraits class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161548 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09 00:03:17 +00:00
Dmitri Gribenko 04bf29eb1b 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
2012-08-06 21:31:15 +00:00
Dmitri Gribenko 7d9b511079 Comment parser and sema: remove useless return values
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161331 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 19:03:12 +00:00
Dmitri Gribenko 9443c57150 Comment diagnostics: warn on duplicate \brief and \return commands.
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161325 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 17:08:27 +00:00
Dmitri Gribenko 88815f3f81 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
2012-08-06 16:29:26 +00:00
Dmitri Gribenko 89ab7d0012 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
2012-08-03 21:15:32 +00:00
Dmitri Gribenko af19a6aaa2 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
2012-08-02 21:45:39 +00:00
Dmitri Gribenko 651f8ce530 Initialize flag in DeclInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161141 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01 23:21:57 +00:00
Dmitri Gribenko 1ca7ecc885 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
2012-08-01 23:08:09 +00:00
Dmitri Gribenko 96b0986749 Comment parsing: add support for \tparam command on all levels.
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161087 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31 22:37:06 +00:00
Dmitri Gribenko 0ba5880d6b CommentSema.cpp: remove extra semicolon
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160901 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 23:26:26 +00:00
Dmitri Gribenko bbb7af301e Comment Sema: don't try to typo-correct a \param when function has zero
arguments.  Just an optimization, no functional change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160896 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 21:34:43 +00:00
Dmitri Gribenko 6582277bfc Comment diagnostics: add warning for multiple \param commands with duplicate
parameter names.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160696 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-24 21:44:16 +00:00
Dmitri Gribenko 00c59f7ed2 CommentSema: simplify functions, per Jordan's comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160689 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-24 20:58:46 +00:00
Dmitri Gribenko 8487c524fd Comment Sema: refactor handling of 'ParmVarDecl's and save them in Sema members.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160634 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 17:40:30 +00:00
Dmitri Gribenko 2d66a5016d Comment AST: add InlineContentComment::RenderKind to specify a default
rendering mode for clients that don't want to interpret Doxygen commands.

Also add a libclang API to query this information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160633 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 16:43:01 +00:00
Dmitri Gribenko c48dd8e7b4 CommentSema: add more inline commands to tables
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160481 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-19 00:21:03 +00:00
Dmitri Gribenko 3d3d22c74b CommentSema: \short is the same as \brief.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160414 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-18 00:44:55 +00:00
Dmitri Gribenko 0eaf69d9a1 Comment AST nodes: rename getXXXCount() methods to getNumXXXs() to be in line with Statement AST nodes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160182 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 19:02:42 +00:00
Dmitri Gribenko 3f38bf2d44 Comment parsing: repaint the bikesched: rename 'HTML open tags' to 'HTML start tags' and 'HTML close tags' to 'HTML end tags' according to HTML spec.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160153 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 00:44:24 +00:00
Dmitri Gribenko 3d986980bd Make concepts of optional and forbidden end tags separate. Thanks Jordan for pointing this!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160149 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 23:37:09 +00:00
NAKAMURA Takumi dc5796cb3e AST/CommentSema.cpp: Fix signess in abs() to appease msvc. It would not make sense to pass (unsigned)-(unsigned) to abs().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160097 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 00:45:08 +00:00
Richard Smith 18b7f95bdb Fix warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160087 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 22:33:59 +00:00
Dmitri Gribenko a5ef44ff5d 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
2012-07-11 21:38:39 +00:00
Dmitri Gribenko 8d3ba23f2d 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
2012-07-06 00:28:32 +00:00