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

Dmitri Gribenko gribozavr at gmail.com
Fri Jun 15 15:59:22 PDT 2012


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



More information about the cfe-commits mailing list