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

Manuel Klimek klimek at google.com
Mon Jun 11 08:48:59 PDT 2012


Very high level remark:
I guess the reason we don't try to associate declarations with comments in
general in the AST and do the parsing of doxygen completely lazily (and
perhaps by code that doesn't need to be part of the AST libraries at all)
is the multi-declaration-spanning comment stuff?

I'm just a little sad that this is not more orthogonal, but probably
there's no easy way out.

Cheers,
/Manuel

On Fri, Jun 8, 2012 at 10:46 PM, Dmitri Gribenko <gribozavr at gmail.com>wrote:

> Hello,
>
> I'm working on getting clang parse Doxygen comments and expose them in
> AST, via libclang APIs etc.
>
> The first step is to save comments during parsing.  Most of this work
> was already done by Doug Gregor, [1] but it was reverted because it
> was not used. [2]  I modified this patch so that it applies to ToT.
>
> The patch exposes raw comment text via libclang so that the feature
> can be tested with c-index-test.
>
> Other modifications include:
> * Introduced LangOpt.ParseComments.  As we don't want to regress on
> parsing time or increase memory footprint during normal compilation,
> comments are only saved when this option is enabled.  I made this
> option a LANGOPT, but maybe it should be a BENIGN_LANGOPT?
>
> * Reworked AST serialization/deserialization because approach to that
> has changed since [1] was written.
>
> * Renamed Preprocessor::{Add,Remove}CommentHandler to match coding
> standards.
>
> * Added lots of tests.
>
> [1]
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090629/018718.html
> [2]
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100315/028560.html
>
> --
> 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>*/
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120611/6a009200/attachment.html>


More information about the cfe-commits mailing list