r206882 - Comment parsing: in the generated XML file, mark HTML that is safe to pass

Dmitri Gribenko gribozavr at gmail.com
Tue Apr 22 09:49:35 PDT 2014


On Tue, Apr 22, 2014 at 5:14 PM, Alp Toker <alp at nuanti.com> wrote:
> I've been studying what's there and have some bite-sized suggestions:
>
> 1) RawComment::extractBriefText() introduces a dependency from the
> lightweight comment handling into the full comment AST. Could you extract
> this to a function like extractBriefText(RawComment&, ASTContext &Context)?

I am not sure how this is helpful... extractBriefText will still
depend on comments::Lexer.  And it is a private helper function
anyway.

> 2) Split out comment AST C API in libclang from Index.h into CXComment.h.
> For now, include CXComment.h but this makes it easier to develop
> alternatives (and easier for libclang users to understand the separation of
> concerns).

This is reasonable.

> (... and more items like, you get the idea)

Not really, please continue.

> By the way, my numbers don't agree with yours. I have a patch* here to
> remove the doc comment functionality with all other tests passing:
>
>   138 files changed, 655 insertions(+), 17760 deletions(-)
>
> That's about one fifth the size of the whole libAST to use your benchmark
> :-)

Does that patch include tests?  libclang?..  Anyway...

And why did you prepare the patch?  Is comment parsing slowing down
your use case?

> So, if we shake things up a little we can reuse most of this work while
> addressing some of the issues. I'd bee keen to help out on this and have
> patches.

Reuse for what?  Alp, it seems like you have some usecase in mind that
you don't mention in your email.  It is hard to understand for me what
kind of improvements you would like to see.

> Ultimately I believe the Actions and AST style approach needs to go away in
> favour of something more direct and appropriate for parsing comments that
> can be run after initial AST generation / compilation.

I am not sure what approach would be better.  The AST approach for
comments works well right now.  And the comment AST generation is
actually lazy: unless you pass -Wdocumentation, not even a single
comment will be parsed.

Alp, sorry, but your email in unclear to me (apart from the suggestion
to move comment APIs in libclang to a separate file).

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>*/



More information about the cfe-commits mailing list