Commit Graph

15 Commits

Author SHA1 Message Date
Fariborz Jahanian e400cb70d4 Some refactoring in my patch on document
command source fidelity. // rdar://13066276

llvm-svn: 176401
2013-03-02 02:39:57 +00:00
Dmitri Gribenko 7acbf00f96 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.

llvm-svn: 163540
2012-09-10 20:32:42 +00:00
Dmitri Gribenko 75eea89920 CommentBriefParser: allow paragraphs to be separated by line of whitespace.
Skip paragraphs that contain only whitespace.

llvm-svn: 162315
2012-08-21 21:15:34 +00:00
Dmitri Gribenko ca7f80ada0 Comment parsing: extract TableGen'able pieces into new CommandTraits class.
llvm-svn: 161548
2012-08-09 00:03:17 +00:00
Dmitri Gribenko 34df220410 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.

llvm-svn: 161087
2012-07-31 22:37:06 +00:00
Dmitri Gribenko af03ef7cce CommentBriefParser: coding style fix
llvm-svn: 160551
2012-07-20 17:02:25 +00:00
Dmitri Gribenko 77369eead6 CommentBriefParser: use \returns if we can't find the \brief or just a plain
paragraph.

llvm-svn: 160550
2012-07-20 17:01:34 +00:00
Dmitri Gribenko c4eb9752d4 CommentBriefParser: use StringSwitch::Cases to group synonyms. Thanks Jordan!
llvm-svn: 160396
2012-07-17 21:21:55 +00:00
Dmitri Gribenko 3e242d6d3c CommentBriefParser: make \short should equivalent to \brief, per Doxygen manual.
llvm-svn: 160383
2012-07-17 18:35:14 +00:00
Dmitri Gribenko 767ea0ff4a CommentBriefParser: remove dead store. Found by Clang Analyzer.
llvm-svn: 159673
2012-07-03 18:10:20 +00:00
Dmitri Gribenko 025d518e3e Factor out a check for block commands (that implicitly start a new paragraph) into a separate function.
llvm-svn: 159444
2012-06-29 18:19:20 +00:00
Dmitri Gribenko 0743f94671 Cleanup \brief comment. Since it is a single paragraph, no need to save newlines there.
llvm-svn: 159325
2012-06-28 01:38:21 +00:00
Dmitri Gribenko a1e9c8e783 Teach \brief parser about commands that start a new paragraph implicitly
llvm-svn: 159309
2012-06-28 00:01:41 +00:00
Dmitri Gribenko 99e0942cd9 Simplify logic in BriefParser::Parse(), per Jordan's comment.
llvm-svn: 159247
2012-06-27 01:17:34 +00:00
Dmitri Gribenko 5188c4b9cc Implement a lexer for structured comments.
llvm-svn: 159223
2012-06-26 20:39:18 +00:00