[cfe-commits] [PATCH] Comment AST and parser

Dmitri Gribenko gribozavr at gmail.com
Tue Jul 3 15:14:07 PDT 2012


Hello,

The proposed patch implements AST classes for comments, a real parser
for Doxygen comments and a very simple semantic analysis that just
builds the AST.  It also includes some minor changes for lexer to pick
up source locations I didn't think about before.

I decided to model the comments AST along the ideas of HTML AST: block
and inline content.

* Block content is a paragraph or a command that has a paragraph as an
argument or verbatim command.
* Inline content is placed within some block.  Inline content includes
plain text, inline commands and HTML as tag soup.

Here are the AST nodes:

$ cat include/clang/Basic/CommentNodes.td
class Comment<bit abstract = 0> {
  bit Abstract = abstract;
}

class DComment<Comment base, bit abstract = 0> : Comment<abstract> {
  Comment Base = base;
}

def InlineContentComment : Comment<1>;
  def TextComment : DComment<InlineContentComment>;
  def InlineCommandComment : DComment<InlineContentComment>;
  def HTMLTagComment : DComment<InlineContentComment, 1>;
    def HTMLOpenTagComment : DComment<HTMLTagComment>;
    def HTMLCloseTagComment : DComment<HTMLTagComment>;

def BlockContentComment : Comment<1>;
  def ParagraphComment : DComment<BlockContentComment>;
  def BlockCommandComment : DComment<BlockContentComment>;
    def ParamCommandComment : DComment<BlockCommandComment>;
    def VerbatimBlockComment : DComment<BlockCommandComment>;
    def VerbatimLineComment : DComment<BlockCommandComment>;

def VerbatimBlockLineComment : Comment;

def FullComment : Comment;

More example ASTs attached.

Not implemented in this patch:
* a real iterator for Comment child nodes (but do we need one?)
* diagnostics during parsing and semantic analysis;
* finding and resolving declaration references in comment text;
* TableGen-based generation of Doxygen command properties.

Please review.

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>*/
-------------- next part --------------
[----------] 26 tests from CommentParserTest
[ RUN      ] CommentParserTest.Basic1
=== Source:
//
=== AST:
(FullComment 0x7ffe13006410 <<invalid loc>>)
[       OK ] CommentParserTest.Basic1 (0 ms)
[ RUN      ] CommentParserTest.Basic2
=== Source:
// Meow
=== AST:
(FullComment 0x7ffe13006060 <:1:3, :1:8>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:8>
    (TextComment 0x7ffe13006010 <:1:3, :1:8> Text=" Meow")))
[       OK ] CommentParserTest.Basic2 (0 ms)
[ RUN      ] CommentParserTest.Basic3
=== Source:
// Aaa
// Bbb
=== AST:
(FullComment 0x7ffe13006080 <:1:3, :2:7>
  (ParagraphComment 0x7ffe13006050 <:1:3, :2:7>
    (TextComment 0x7ffe13006010 <:1:3, :1:7> Text=" Aaa")
    (TextComment 0x7ffe13006030 <:2:3, :2:7> Text=" Bbb")))
[       OK ] CommentParserTest.Basic3 (0 ms)
[ RUN      ] CommentParserTest.Paragraph1
=== Source:
// Aaa
//
// Bbb
=== AST:
(FullComment 0x7ffe130060b0 <:1:3, :3:7>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:7>
    (TextComment 0x7ffe13006010 <:1:3, :1:7> Text=" Aaa"))
  (ParagraphComment 0x7ffe13006080 <:3:3, :3:7>
    (TextComment 0x7ffe13006060 <:3:3, :3:7> Text=" Bbb")))
=== Source:
// Aaa
//
//
// Bbb
=== AST:
(FullComment 0x7ffe13006180 <:1:3, :4:7>
  (ParagraphComment 0x7ffe13006100 <:1:3, :1:7>
    (TextComment 0x7ffe130060e0 <:1:3, :1:7> Text=" Aaa"))
  (ParagraphComment 0x7ffe13006150 <:4:3, :4:7>
    (TextComment 0x7ffe13006130 <:4:3, :4:7> Text=" Bbb")))
[       OK ] CommentParserTest.Paragraph1 (0 ms)
[ RUN      ] CommentParserTest.Paragraph2
=== Source:
// \brief Aaa
//
// Bbb
=== AST:
(FullComment 0x7ffe13006180 <:1:3, :3:7>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:4>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" "))
  (BlockCommandComment 0x7ffe13006060 <:1:4, :1:14> Name="brief"
    (ParagraphComment 0x7ffe13006100 <:1:10, :1:14>
      (TextComment 0x7ffe130060e0 <:1:10, :1:14> Text=" Aaa")))
  (ParagraphComment 0x7ffe13006150 <:3:3, :3:7>
    (TextComment 0x7ffe13006130 <:3:3, :3:7> Text=" Bbb")))
[       OK ] CommentParserTest.Paragraph2 (1 ms)
[ RUN      ] CommentParserTest.Paragraph3
=== Source:
// \brief \author
=== AST:
(FullComment 0x7ffe130061d0 <:1:3, <invalid loc>>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:4>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" "))
  (BlockCommandComment 0x7ffe13006060 <:1:4, :1:11> Name="brief"
    (ParagraphComment 0x7ffe13006100 <:1:10, :1:11>
      (TextComment 0x7ffe130060e0 <:1:10, :1:11> Text=" ")))
  (BlockCommandComment 0x7ffe13006130 <:1:11, <invalid loc>> Name="author"
    (ParagraphComment 0x7ffe130061b0 <<invalid loc>>)))
[       OK ] CommentParserTest.Paragraph3 (0 ms)
[ RUN      ] CommentParserTest.Paragraph4
=== Source:
// \brief Aaa
// Bbb \author
// Ccc
=== AST:
(FullComment 0x7ffe13006220 <:1:3, :3:7>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:4>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" "))
  (BlockCommandComment 0x7ffe13006060 <:1:4, :2:8> Name="brief"
    (ParagraphComment 0x7ffe13006120 <:1:10, :2:8>
      (TextComment 0x7ffe130060e0 <:1:10, :1:14> Text=" Aaa")
      (TextComment 0x7ffe13006100 <:2:3, :2:8> Text=" Bbb ")))
  (BlockCommandComment 0x7ffe13006150 <:2:8, :3:7> Name="author"
    (ParagraphComment 0x7ffe130061f0 <:3:3, :3:7>
      (TextComment 0x7ffe130061d0 <:3:3, :3:7> Text=" Ccc"))))
[       OK ] CommentParserTest.Paragraph4 (0 ms)
[ RUN      ] CommentParserTest.ParamCommand1
=== Source:
// \param aaa
// \param [in] aaa
// \param [out] aaa
// \param [in,out] aaa
// \param [in, out] aaa

=== AST:
(FullComment 0x7ffe130064b0 <:1:3, <invalid loc>>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:4>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" "))
  (ParamCommandComment 0x7ffe13006060 <:1:4, :2:4> [in] implicitly Param="aaa"
    (ParagraphComment 0x7ffe13006110 <:2:3, :2:4>
      (TextComment 0x7ffe130060f0 <:2:3, :2:4> Text=" ")))
  (ParamCommandComment 0x7ffe13006140 <:2:4, :3:4> [in] explicitly Param="aaa"
    (ParagraphComment 0x7ffe130061f0 <:3:3, :3:4>
      (TextComment 0x7ffe130061d0 <:3:3, :3:4> Text=" ")))
  (ParamCommandComment 0x7ffe13006220 <:3:4, :4:4> [out] explicitly Param="aaa"
    (ParagraphComment 0x7ffe130062d0 <:4:3, :4:4>
      (TextComment 0x7ffe130062b0 <:4:3, :4:4> Text=" ")))
  (ParamCommandComment 0x7ffe13006300 <:4:4, :5:4> [in,out] explicitly Param="aaa"
    (ParagraphComment 0x7ffe130063c0 <:5:3, :5:4>
      (TextComment 0x7ffe130063a0 <:5:3, :5:4> Text=" ")))
  (ParamCommandComment 0x7ffe130063f0 <:5:4, <invalid loc>> [in,out] explicitly Param="aaa"
    (ParagraphComment 0x7ffe13006490 <<invalid loc>>)))
[       OK ] CommentParserTest.ParamCommand1 (1 ms)
[ RUN      ] CommentParserTest.InlineCommand1
=== Source:
// \c
=== AST:
(FullComment 0x7ffe130060c0 <:1:3, :1:6>
  (ParagraphComment 0x7ffe13006090 <:1:3, :1:6>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" ")
    (InlineCommandComment 0x7ffe13006030 <:1:4, :1:6>)))
[       OK ] CommentParserTest.InlineCommand1 (0 ms)
[ RUN      ] CommentParserTest.InlineCommand2
=== Source:
// \c 
=== AST:
(FullComment 0x7ffe130060f0 <:1:3, :1:7>
  (ParagraphComment 0x7ffe130060b0 <:1:3, :1:7>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" ")
    (InlineCommandComment 0x7ffe13006030 <:1:4, :1:6>)
    (TextComment 0x7ffe13006090 <:1:6, :1:7> Text=" ")))
[       OK ] CommentParserTest.InlineCommand2 (0 ms)
[ RUN      ] CommentParserTest.InlineCommand3
=== Source:
// \c aaa

=== AST:
(FullComment 0x7ffe130060d0 <:1:3, :1:6>
  (ParagraphComment 0x7ffe130060a0 <:1:3, :1:6>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" ")
    (InlineCommandComment 0x7ffe13006040 <:1:4, :1:6> Arg[0]="aaa")))
[       OK ] CommentParserTest.InlineCommand3 (0 ms)
[ RUN      ] CommentParserTest.InlineCommand4
=== Source:
// \c aaa bbb
=== AST:
(FullComment 0x7ffe13006100 <:1:3, :1:14>
  (ParagraphComment 0x7ffe130060c0 <:1:3, :1:14>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" ")
    (InlineCommandComment 0x7ffe13006040 <:1:4, :1:6> Arg[0]="aaa")
    (TextComment 0x7ffe130060a0 <:1:10, :1:14> Text=" bbb")))
[       OK ] CommentParserTest.InlineCommand4 (0 ms)
[ RUN      ] CommentParserTest.InlineCommand5
=== Source:
// \unknown aaa

=== AST:
(FullComment 0x7ffe130060f0 <:1:3, :1:16>
  (ParagraphComment 0x7ffe130060b0 <:1:3, :1:16>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" ")
    (InlineCommandComment 0x7ffe13006030 <:1:4, :1:12>)
    (TextComment 0x7ffe13006090 <:1:12, :1:16> Text=" aaa")))
[       OK ] CommentParserTest.InlineCommand5 (0 ms)
[ RUN      ] CommentParserTest.HTML1
=== Source:
// <a
=== AST:
(FullComment 0x7ffe130060e0 <:1:3, <invalid loc>>
  (ParagraphComment 0x7ffe130060b0 <:1:3, <invalid loc>>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" ")
    (HTMLOpenTagComment 0x7ffe13006030 <:1:4, <invalid loc>> Name="a")))
=== Source:
// <a>
=== AST:
(FullComment 0x7ffe130061e0 <:1:3, <invalid loc>>
  (ParagraphComment 0x7ffe130061b0 <:1:3, <invalid loc>>
    (TextComment 0x7ffe13006110 <:1:3, :1:4> Text=" ")
    (HTMLOpenTagComment 0x7ffe13006130 <:1:4, <invalid loc>> Name="a")))
=== Source:
// <a >
=== AST:
(FullComment 0x7ffe130062e0 <:1:3, <invalid loc>>
  (ParagraphComment 0x7ffe130062b0 <:1:3, <invalid loc>>
    (TextComment 0x7ffe13006210 <:1:3, :1:4> Text=" ")
    (HTMLOpenTagComment 0x7ffe13006230 <:1:4, <invalid loc>> Name="a")))
[       OK ] CommentParserTest.HTML1 (1 ms)
[ RUN      ] CommentParserTest.HTML2
=== Source:
// <a href
=== AST:
(FullComment 0x7ffe130060e0 <:1:3, <invalid loc>>
  (ParagraphComment 0x7ffe130060b0 <:1:3, <invalid loc>>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" ")
    (HTMLOpenTagComment 0x7ffe13006030 <:1:4, <invalid loc>> Name="a" Attrs:  "href="")))
=== Source:
// <a href 
=== AST:
(FullComment 0x7ffe130061e0 <:1:3, <invalid loc>>
  (ParagraphComment 0x7ffe130061b0 <:1:3, <invalid loc>>
    (TextComment 0x7ffe13006110 <:1:3, :1:4> Text=" ")
    (HTMLOpenTagComment 0x7ffe13006130 <:1:4, <invalid loc>> Name="a" Attrs:  "href="")))
=== Source:
// <a href>
=== AST:
(FullComment 0x7ffe130062e0 <:1:3, :1:11>
  (ParagraphComment 0x7ffe130062b0 <:1:3, :1:11>
    (TextComment 0x7ffe13006210 <:1:3, :1:4> Text=" ")
    (HTMLOpenTagComment 0x7ffe13006230 <:1:4, :1:11> Name="a" Attrs:  "href="")))
=== Source:
// <a href >
=== AST:
(FullComment 0x7ffe130063e0 <:1:3, :1:12>
  (ParagraphComment 0x7ffe130063b0 <:1:3, :1:12>
    (TextComment 0x7ffe13006310 <:1:3, :1:4> Text=" ")
    (HTMLOpenTagComment 0x7ffe13006330 <:1:4, :1:12> Name="a" Attrs:  "href="")))
[       OK ] CommentParserTest.HTML2 (0 ms)
[ RUN      ] CommentParserTest.HTML3
=== Source:
// <a href="bbb"
=== AST:
(FullComment 0x7ffe130060e0 <:1:3, <invalid loc>>
  (ParagraphComment 0x7ffe130060b0 <:1:3, <invalid loc>>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" ")
    (HTMLOpenTagComment 0x7ffe13006030 <:1:4, <invalid loc>> Name="a" Attrs:  "href="bbb")))
=== Source:
// <a href="bbb">
=== AST:
(FullComment 0x7ffe130061e0 <:1:3, :1:17>
  (ParagraphComment 0x7ffe130061b0 <:1:3, :1:17>
    (TextComment 0x7ffe13006110 <:1:3, :1:4> Text=" ")
    (HTMLOpenTagComment 0x7ffe13006130 <:1:4, :1:17> Name="a" Attrs:  "href="bbb")))
[       OK ] CommentParserTest.HTML3 (0 ms)
[ RUN      ] CommentParserTest.HTML4
=== Source:
// </a
=== AST:
(FullComment 0x7ffe13006090 <:1:3, <invalid loc>>
  (ParagraphComment 0x7ffe13006060 <:1:3, <invalid loc>>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" ")
    (HTMLCloseTagComment 0x7ffe13006030 <:1:4, <invalid loc>> Name="a")))
=== Source:
// </a>
=== AST:
(FullComment 0x7ffe13006140 <:1:3, :1:7>
  (ParagraphComment 0x7ffe13006110 <:1:3, :1:7>
    (TextComment 0x7ffe130060c0 <:1:3, :1:4> Text=" ")
    (HTMLCloseTagComment 0x7ffe130060e0 <:1:4, :1:7> Name="a")))
=== Source:
// </a >
=== AST:
(FullComment 0x7ffe130061f0 <:1:3, :1:8>
  (ParagraphComment 0x7ffe130061c0 <:1:3, :1:8>
    (TextComment 0x7ffe13006170 <:1:3, :1:4> Text=" ")
    (HTMLCloseTagComment 0x7ffe13006190 <:1:4, :1:8> Name="a")))
[       OK ] CommentParserTest.HTML4 (1 ms)
[ RUN      ] CommentParserTest.HTML5
=== Source:
// <pre>
// Aaa
// Bbb
// </pre>

=== AST:
(FullComment 0x7ffe13006190 <:1:3, :4:9>
  (ParagraphComment 0x7ffe13006140 <:1:3, :4:9>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" ")
    (HTMLOpenTagComment 0x7ffe13006030 <:1:4, <invalid loc>> Name="pre")
    (TextComment 0x7ffe130060b0 <:2:3, :2:7> Text=" Aaa")
    (TextComment 0x7ffe130060d0 <:3:3, :3:7> Text=" Bbb")
    (TextComment 0x7ffe130060f0 <:4:3, :4:4> Text=" ")
    (HTMLCloseTagComment 0x7ffe13006110 <:4:4, :4:9> Name="pre")))
[       OK ] CommentParserTest.HTML5 (0 ms)
[ RUN      ] CommentParserTest.VerbatimBlock1
=== Source:
// \verbatim\endverbatim

=== AST:
(FullComment 0x7ffe13006100 <:1:3, :1:13>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:4>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" "))
  (VerbatimBlockComment 0x7ffe13006060 <:1:4, :1:13> Name="verbatim" CloseName="endverbatim"))
[       OK ] CommentParserTest.VerbatimBlock1 (0 ms)
[ RUN      ] CommentParserTest.VerbatimBlock2
=== Source:
// \verbatim Aaa \endverbatim

=== AST:
(FullComment 0x7ffe13006130 <:1:3, :1:13>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:4>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" "))
  (VerbatimBlockComment 0x7ffe13006060 <:1:4, :1:13> Name="verbatim" CloseName="endverbatim"
    (VerbatimBlockLineComment 0x7ffe13006100 <:1:13, :1:18> Text=" Aaa ")))
[       OK ] CommentParserTest.VerbatimBlock2 (0 ms)
[ RUN      ] CommentParserTest.VerbatimBlock3
=== Source:
//\verbatim
//\endverbatim

=== AST:
(FullComment 0x7ffe130060b0 <:1:3, :1:12>
  (VerbatimBlockComment 0x7ffe13006010 <:1:3, :1:12> Name="verbatim" CloseName="endverbatim"))
[       OK ] CommentParserTest.VerbatimBlock3 (0 ms)
[ RUN      ] CommentParserTest.VerbatimBlock4
=== Source:
//\verbatim
// Aaa
//\endverbatim

=== AST:
(FullComment 0x7ffe130060e0 <:1:3, :1:12>
  (VerbatimBlockComment 0x7ffe13006010 <:1:3, :1:12> Name="verbatim" CloseName="endverbatim"
    (VerbatimBlockLineComment 0x7ffe130060b0 <:2:3, :2:7> Text=" Aaa")))
=== Source:
/*\verbatim
 * Aaa
 *\endverbatim*/
=== AST:
(FullComment 0x7ffe130061e0 <:1:3, :1:12>
  (VerbatimBlockComment 0x7ffe13006110 <:1:3, :1:12> Name="verbatim" CloseName="endverbatim"
    (VerbatimBlockLineComment 0x7ffe130061b0 <:2:3, :2:7> Text=" Aaa")))
[       OK ] CommentParserTest.VerbatimBlock4 (1 ms)
[ RUN      ] CommentParserTest.VerbatimBlock5
=== Source:
// \verbatim
// Aaa
// \endverbatim

=== AST:
(FullComment 0x7ffe13006150 <:1:3, :1:13>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:4>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" "))
  (VerbatimBlockComment 0x7ffe13006060 <:1:4, :1:13> Name="verbatim" CloseName="endverbatim"
    (VerbatimBlockLineComment 0x7ffe13006100 <:2:3, :2:7> Text=" Aaa")
    (VerbatimBlockLineComment 0x7ffe13006120 <:3:3, :3:4> Text=" ")))
=== Source:
/* \verbatim
 * Aaa
 * \endverbatim*/
=== AST:
(FullComment 0x7ffe130062c0 <:1:3, :1:13>
  (ParagraphComment 0x7ffe130061a0 <:1:3, :1:4>
    (TextComment 0x7ffe13006180 <:1:3, :1:4> Text=" "))
  (VerbatimBlockComment 0x7ffe130061d0 <:1:4, :1:13> Name="verbatim" CloseName="endverbatim"
    (VerbatimBlockLineComment 0x7ffe13006270 <:2:3, :2:7> Text=" Aaa")
    (VerbatimBlockLineComment 0x7ffe13006290 <:3:3, :3:4> Text=" ")))
[       OK ] CommentParserTest.VerbatimBlock5 (0 ms)
[ RUN      ] CommentParserTest.VerbatimBlock6
=== Source:
// \verbatim
// Aaa
//
// Bbb
// \endverbatim

=== AST:
(FullComment 0x7ffe130061a0 <:1:3, :1:13>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:4>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" "))
  (VerbatimBlockComment 0x7ffe13006060 <:1:4, :1:13> Name="verbatim" CloseName="endverbatim"
    (VerbatimBlockLineComment 0x7ffe13006100 <:2:3, :2:7> Text=" Aaa")
    (VerbatimBlockLineComment 0x7ffe13006120 <:3:3> Text="")
    (VerbatimBlockLineComment 0x7ffe13006140 <:4:3, :4:7> Text=" Bbb")
    (VerbatimBlockLineComment 0x7ffe13006160 <:5:3, :5:4> Text=" ")))
=== Source:
/* \verbatim
 * Aaa
 *
 * Bbb
 * \endverbatim*/
=== AST:
(FullComment 0x7ffe13006360 <:1:3, :1:13>
  (ParagraphComment 0x7ffe130061f0 <:1:3, :1:4>
    (TextComment 0x7ffe130061d0 <:1:3, :1:4> Text=" "))
  (VerbatimBlockComment 0x7ffe13006220 <:1:4, :1:13> Name="verbatim" CloseName="endverbatim"
    (VerbatimBlockLineComment 0x7ffe130062c0 <:2:3, :2:7> Text=" Aaa")
    (VerbatimBlockLineComment 0x7ffe130062e0 <:3:3> Text="")
    (VerbatimBlockLineComment 0x7ffe13006300 <:4:3, :4:7> Text=" Bbb")
    (VerbatimBlockLineComment 0x7ffe13006320 <:5:3, :5:4> Text=" ")))
[       OK ] CommentParserTest.VerbatimBlock6 (0 ms)
[ RUN      ] CommentParserTest.VerbatimLine1
=== Source:
// \fn
=== AST:
(FullComment 0x7ffe130060f0 <:1:3, :1:7>
  (ParagraphComment 0x7ffe13006030 <:1:3, :1:4>
    (TextComment 0x7ffe13006010 <:1:3, :1:4> Text=" "))
  (VerbatimLineComment 0x7ffe13006060 <:1:4, :1:7> Text=""))
=== Source:
// \fn

=== AST:
(FullComment 0x7ffe13006200 <:1:3, :1:7>
  (ParagraphComment 0x7ffe13006140 <:1:3, :1:4>
    (TextComment 0x7ffe13006120 <:1:3, :1:4> Text=" "))
  (VerbatimLineComment 0x7ffe13006170 <:1:4, :1:7> Text=""))
[       OK ] CommentParserTest.VerbatimLine1 (1 ms)
[ RUN      ] CommentParserTest.VerbatimLine2
=== Source:
/// \fn void *foo(const char *zzz = "\$");
//
=== AST:
(FullComment 0x7ffe130060f0 <:1:4, :1:43>
  (ParagraphComment 0x7ffe13006030 <:1:4, :1:5>
    (TextComment 0x7ffe13006010 <:1:4, :1:5> Text=" "))
  (VerbatimLineComment 0x7ffe13006060 <:1:5, :1:43> Text=" void *foo(const char *zzz = "\$");"))
=== Source:
/** \fn void *foo(const char *zzz = "\$");*/
=== AST:
(FullComment 0x7ffe13006200 <:1:4, :1:43>
  (ParagraphComment 0x7ffe13006140 <:1:4, :1:5>
    (TextComment 0x7ffe13006120 <:1:4, :1:5> Text=" "))
  (VerbatimLineComment 0x7ffe13006170 <:1:5, :1:43> Text=" void *foo(const char *zzz = "\$");"))
[       OK ] CommentParserTest.VerbatimLine2 (0 ms)
[----------] 26 tests from CommentParserTest (6 ms total)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: comments-parser-v1.patch
Type: application/octet-stream
Size: 126511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120703/0090f296/attachment.obj>


More information about the cfe-commits mailing list