[cfe-commits] [PATCH] Structured comment parsing, retaining comments in AST
Dmitri Gribenko
gribozavr at gmail.com
Fri Jun 8 13:46:32 PDT 2012
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>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: retain-comments-in-ast-v1.patch
Type: application/octet-stream
Size: 28508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120608/ca6b4109/attachment.obj>
More information about the cfe-commits
mailing list