[cfe-dev] AST Matchers tutorial

Sean Silva silvas at purdue.edu
Tue Jul 31 20:14:17 PDT 2012


Thank you for writing this up! :)

A couple things:

Since you're assuming zero Clang experience, I think you can leave out
the git-svn stuff (since AFAIK that is only relevant for people with
commit access). A simpler way to just checkout LLVM/Clang is

$ git clone http://llvm.org/git/llvm.git
$ cd source/tools
$ git clone http://llvm.org/git/clang.git

The git-svn checkout stuff that you are doing looks kind of fearsome.
It's easier for a newcomer to just use pure git workflow.

Also, you may want to touch on the scenario that a person already has
CMake installed. E.g., that it should be a certain version, needs to
be compiled with certain flags, etc.

> Ninja dependency resolver.

I would call this "Ninja build tool".


You should probably link to the LLVM commandline library docs
<http://llvm.org/docs/CommandLine.html> in the relevant part of the
document.

> the loop’s index variable is compared against N - 1

generally aren't half-open loops comparing against N, and not N-1? e.g.
for (int I = 0, N = 10; I != N; ++I)


I think that just a little bit more explanation about the use of
FoldingSetNodeID in areSameExpr() would be good. (just explain roughly
what it does, links to docs, etc)


On Tue, Jul 31, 2012 at 6:34 PM, Sam Panzer <panzer at google.com> wrote:
> Hello, again!
>
> As suggested by a few people, I have been writing up my experiences starting
> development on Clang, and specifically working with Clang-based refactoring
> tools. The repository where my loop converter will live doesn't exist yet,
> so I will use the tutorial as a chance to start offering patches for review
> (they can be rebased to other locations later).
>
> My intention was to begin assuming zero Clang experience and work towards
> building a slightly simplified version of the loop converter through a
> series of fully-explained patches to Clang to a unit-tested functional tool.
> Because the Getting Started page is aimed at people who want to use Clang
> rather than develop for it, I began with cloning clang+llvm from the git
> mirrors and preparing a cmake+ninja build.
>
> What I have so far is currently available as a Google Doc here:
> https://docs.google.com/document/d/1oTkVLhCdRJUEH1_LDaQdXqe8-aOqT5GLDL9e4MhoFF8/edit
> If enough people think that the tutorial is useful, I can eventually convert
> it to a nicer format (i.e. HTML with prettier code formatting). I expect to
> have made mistakes, especially in the section about obtaining and building
> Clang :)
>
> Thoughts?
> -Sam
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list