[LLVMdev] Clang passes

Chandler Carruth chandlerc at google.com
Sun Feb 12 18:34:32 PST 2012


On Sat, Feb 11, 2012 at 9:32 AM, Михаил <neonomaly.x at gmail.com> wrote:

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

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 slides[1] and video[2] 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

[1]: http://www.llvm.org/devmtg/2011-11/Gregor_ExtendingClang.pdf
[2]: http://devimages.apple.com/llvm/videos/ExtendingClang.m4v
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120212/7d7d4ae8/attachment.html>


More information about the llvm-dev mailing list