[cfe-commits] [PATCH] Structured comment parsing, retaining comments in AST

Dmitri Gribenko gribozavr at gmail.com
Fri Jun 15 16:00:42 PDT 2012


Now with a patch.

On Fri, Jun 15, 2012 at 3:59 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> Hello,
>
> Here is a new version of the patch, which addresses all the comments,
> except for one: I did not implement the optimized per-module search
> for comments.  Unfortunately, I did not found any documentation about
> how modules work in clang (and what are global, local IDs, submodules
> and how they differ from modules etc.)
>
> Changes from v1 include:
>
> * new library libComments, which will contain all related lexing and
> parsing code;
>
> * class RawComment, which represents a single comment;
>
> * class RawCommentList, which is populated during parsing.  It merges
> consecutive comments on the fly.
>
> * implements a warning "not a Doxygen member comment", which should
> catch typos //< and /*< (instead of ///< and /**<).  We had a few in
> our codebase, which I fixed manually: r158241, r158248.
>
> Questions:
> * should I split RawCommentList.h into RawComment.h and RawCommentList.h?
>
> * should I remove the LANGOPT ParseComments?
>
> Next steps:
> * Implementing lexer, parser and AST classes for the comment text.
> * Expose comment AST through libclang.
> * We will need semantic analysis as well, for example, to match \param
> names with actual function parameters.
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: retain-comments-in-ast-v2.patch
Type: application/octet-stream
Size: 55487 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120615/d9d884ae/attachment.obj>


More information about the cfe-commits mailing list