The Clang AST - a Tutorial

preview_player
Показать описание
If you always wanted to know more about about Clang's AST [1], for example because you want to implement an awesome tool [2, 3] based on Clang, or simply because you want to start contributing, this talk is for you.

Make sure to watch in HD to be able to read the font in the terminal!

The semantic code completion in the vim session is powered by YCM [4], and the quick formatting is done by clang-format [5].

Рекомендации по теме
Комментарии
Автор

Thank you whoever subtitled 45 minutes of video!

kim
Автор

Thank you! A truly great intro into the clang AST. I'm trying to fix a clang bug I discovered and contribute and this has really helped to inject a lot of base knowledge very quickly.

jc
Автор

My tutorial on Clang's AST from the LLVM Euro 2013 conference. If you're new to Clang, this gives you the very basics to get you started.

Make sure to watch in HD to be able to read the code in the terminal session. Featuring YCM code completion and clang-format in action :)

ManuelKlimek
Автор

Hey Manuel, great talk! Really enjoyed it. Always interesting to see how C++ compilers look like on the inside.

zbjet
Автор

Nico159: captions added - let me know if something doesn't work :)

ManuelKlimek
Автор

Great presentation, thanks. Saved to see later, so I can rewatch it as learning the AST Lang.

mrc-kit
Автор

I'm using ycm (see link [4]) which uses libclang for code completion and has pluggable build system support for compilation databases (we're using a different compilation database integration for our internal server based build system).

ManuelKlimek
Автор

Awesome work Manuel, we need more efforts like yours to push C++ into the future. So it can become not only more powerful and performant but also more accessible and easy to use!

patlecat
Автор

On AST matchers and triggering on expressions, isn’t the main thing that you want to do with expressions is to have a control flow tree starting from main? Yeah, expressions in a separate source file might be needed. But, I’d say the most useful thing is to traverse main.

xealit
Автор

Also, would be nice to see an example for a full multi-file program. Not just 1 source file.

xealit
Автор

Are you using clang_complete for auto-completion?

dsamvelyan
Автор

Hi, I am working on coding conventions using clang compiler. I can check variable declaration by using class varDecl.
What I do clang::Vardecl *a
StringRef s=a->getName();
Now I can put the condition on s.
 Like this Suppose I want to check #ifndef and other things as Cout what are the classes I have to use and how to fetch the function?

advance_sci_tech_SK_IITBombay
Автор

Thanks for your response, ycm is awesome :)
And thanks for your video. I'm planning to develop some specific code quality checking tools for our team, and this video is good entry point to AST.

dsamvelyan
Автор

It seems at 13:40 there is a possible error. I think that getCaller() method returns the Var. getCallee() returns the function().

konstantinrebrov
Автор

Hi Manuel! Are there any tutorials on how to add synthetic AST nodes? Thanks!

insoaryt
Автор

good presentation, but for someone just starting with clang and llvm(like me), all this is too much to grasp, any chance of future more dumbed down videos with examples?

duminicad
Автор

May I have the lecture slides as PDF or powerpoint?

konstantinrebrov
Автор

Is there a place that explains how to setup the tools to start developing with the Clang AST?

josemartins
Автор

Nico159: kk, working on it

duminicad: what would you want examples about? If you're into tooling, I think the best place to start is the step-by-step tutorials:

And then dive into the ast matchers:

If you want to dive into the compiler, the best way is to visit the IRC channel and ask for good tasks to pick up, or put a mail to cfe-dev (for clang) or llvmdev (for llvm).

ManuelKlimek
Автор

In case you want this captioned, please let me know in the comments.

ManuelKlimek