[cfe-commits] Comment AST and parser
Dmitri Gribenko
gribozavr at gmail.com
Tue Jul 3 10:40:50 PDT 2012
On Mon, Jul 2, 2012 at 3:10 PM, Douglas Gregor <dgregor at apple.com> wrote:
> On Jul 2, 2012, at 3:04 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>> Turning a newline node into a bit on inline content seems a good idea,
>> except that it makes all inline content nodes larger…
>
> There are free bits in the Comment base class you could use, which makes the bit essentially free (and eliminates the overhead of the NewlineComment nodes).
Awesome idea, done!
>>> Index: utils/TableGen/TableGen.cpp
>>> ===================================================================
>>> --- utils/TableGen/TableGen.cpp (revision 159471)
>>> +++ utils/TableGen/TableGen.cpp (working copy)
>>> @@ -38,6 +38,7 @@
>>> GenClangDiagsDefs,
>>> GenClangDiagGroups,
>>> GenClangDiagsIndexName,
>>> + GenClangCommentNodes,
>>> GenClangDeclNodes,
>>> GenClangStmtNodes,
>>> GenClangSACheckers,
>>> @@ -86,6 +87,8 @@
>>> clEnumValN(GenClangDiagsIndexName,
>>> "gen-clang-diags-index-name",
>>> "Generate Clang diagnostic name index"),
>>> + clEnumValN(GenClangCommentNodes, "gen-clang-comment-nodes",
>>> + "Generate Clang AST comment nodes"),
>>> clEnumValN(GenClangDeclNodes, "gen-clang-decl-nodes",
>>> "Generate Clang AST declaration nodes"),
>>> clEnumValN(GenClangStmtNodes, "gen-clang-stmt-nodes",
>>> @@ -148,6 +151,9 @@
>>> case GenClangDiagsIndexName:
>>> EmitClangDiagsIndexName(Records, OS);
>>> break;
>>> + case GenClangCommentNodes:
>>> + EmitClangASTNodes(Records, OS, "Comment", "");
>>> + break;
>>> case GenClangDeclNodes:
>>> EmitClangASTNodes(Records, OS, "Decl", "Decl");
>>> EmitClangDeclContext(Records, OS);
>>>
>>> Is there more that you intend to do with TableGen for the AST nodes themselves? It looks like all we're getting is the list of node names, but TableGen is a pretty heavyweight way to keep that up-to-date.
>>
>> Currently we tablegen'ing clang/AST/CommentNodes.inc. I plan to
>> tablegen a list of supported commands with two attributes: command
>> kind (inline/block/verbatim block/verbatim line) and number of
>> arguments.
>
> It seems to me like this will be a different set of TableGen classes with different generators. If that's indeed true, using TableGen to generate CommentNodes.inc is rather excessive. A .def file would be simpler in such cases.
Seems like I am misunderstanding you. Currently I use TableGen to
generate CommentNodes.inc that describes inheritance tree of AST nodes
and it does not seem like an overkill.
A list of recognized Doxygen commands is a separate thing.
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