[cfe-commits] [PATCH] More Docs: Mastering the Clang AST

Richard Smith richard at metafoo.co.uk
Thu Jul 19 13:46:47 PDT 2012


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.

> $ 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 :(

> 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 :)

>  declaration statement that delcares our result variable

Typo: 'delcares'

> 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.

> 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.

I think the document could do with some discussion of the Type hierarchy,
QualType, canonical types and type sugar.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120719/31bd0f63/attachment.html>


More information about the cfe-commits mailing list