Clang passes

Hi.

I’ve tried to search the way to write a pass for clang like a pass for opt, but I haven’t find it. Is it possible?

I need to save class inheritance of the program being processed to external file.

Thanks!

Yours sincerely,
Kadysev Mikhail

Clang doesn’t work exactly like opt in this regard, however, check out the ASTConsumer interface and the RecursiveASTVisitor. These allow you to write pass-like code that walks an AST. The slides1 and video2 of a talk by Doug Gregor at the last developer’s meeting may help you understand how to employ these tools in Clang as they don’t work quite like passes.

-Chandler