[cfe-commits] [PATCH] More Docs: Mastering the Clang AST
Richard Smith
richard at metafoo.co.uk
Tue Jul 24 12:38:03 PDT 2012
LGTM
On Tue, Jul 24, 2012 at 6:08 AM, Manuel Klimek <klimek at google.com> wrote:
> On Mon, Jul 23, 2012 at 9:44 PM, Richard Smith <richard at metafoo.co.uk>
> wrote:
> > On Mon, Jul 23, 2012 at 2:24 AM, Manuel Klimek <klimek at google.com>
> wrote:
> >>
> >> On Thu, Jul 19, 2012 at 10:46 PM, Richard Smith <richard at metafoo.co.uk>
> >> wrote:
> >> > On Thu, Jul 19, 2012 at 1:26 AM, Manuel Klimek <klimek at google.com>
> >> > wrote:
> >> >>
> >> >> Any comments on the content of the doc, or do you guys think it's
> fine
> >> >> to go in? :)
> >> >
> >> >
> >> > 'targetted': the more common spelling is with only 2 't's.
> >>
> >> Done
> >>
> >> >
> >> >> $ clang -cc1 -ast-dump-xml test.cc
> >> >> ... cutting out internal declarations of clang ...
> >> >
> >> > I'd suggest also adding -undef to this command, to reduce the bulk of
> >> > the
> >> > internal declarations. In an ideal world, that'd remove all of them,
> but
> >> > we
> >> > still include __int64_t and friends in that mode :(
> >>
> >> Done
> >>
> >> >
> >> >> In general, -ast-dump-xml dumps declarations as XML and statements as
> >> >> S-expressions.
> >> >
> >> > This promises more than we deliver. ... "dumps declarations in an
> >> > XML-style
> >> > format and statements in an S-expression-style format" is closer to
> the
> >> > truth :)
> >>
> >> Done
> >>
> >> >
> >> >> declaration statement that delcares our result variable
> >> >
> >> > Typo: 'delcares'
> >>
> >> Done
> >>
> >> >
> >> >> Clang's AST nodes are modeled on a type hierarchy that does not have
> a
> >> >> common ancestor.
> >> >
> >> > s/type/class/, to avoid confusion with clang::Type.
> >>
> >> Done
> >>
> >> >
> >> >> Instead, there are multiple larger hierarchies for basic node types
> >> >> like
> >> >> Decl and Stmt.
> >> >
> >> > It might be useful to say that many of the important AST nodes derive
> >> > from
> >> > Type, Decl, DeclContext or Stmt, with some classes deriving from both
> >> > Decl
> >> > and DeclContext.
> >>
> >> Done
> >>
> >> >
> >> > I think the document could do with some discussion of the Type
> >> > hierarchy,
> >> > QualType, canonical types and type sugar.
> >>
> >> Next iteration? :)
> >
> >
> > OK :)
> >
> >> It is targeted at Developers
> >
> > Lowercase 'd'.
>
> Done.
>
> >
> >> Clang's AST is different from ASTs of other languages in that it closely
> >> resembles both the written C++ code and the C++ standard.
> >
> > Perhaps this should say 'Clang's AST is different from ASTs produced by
> some
> > other compilers'? I can't imagine any other language would have a
> compiler
> > whose AST closely resembles C++ code and the C++ standard ;)
>
> Done.
>
> >
> >> Clang has a builtin AST-dump mode, which can be enabled with the flags
> >> -ast-dump and -ast-dump-xml.
> >
> > [...] has built-in AST-dump mode*s* ?
>
> Done.
>
> >
> > You should mention that a debug build is necessary for -ast-dump-xml to
> > produce output.
>
> Done.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120724/7985a342/attachment.html>
More information about the cfe-commits
mailing list