ClangIR (CIR)

ClangIR is a high-level representation in Clang that reflects aspects of the C/C++ languages and their extensions. It is implemented using MLIR and occupies a position between Clang's AST and LLVM IR.

The project is incubated under LLVM's GitHub umbrella and is being upstreamed to the llvm-project (LLVM's official main repository).

GitHub incubator repo: llvm/clangir.

Check out the current status for updates and ClangIR in practice for a tool overview. Also see motivation and history for extra context about the project.

Talks and posts

RFCs

Where to go from here?

Check out the docs for contributing to the project and dive into the CIR Dialect, list of CIR passes in Clang or the ClangIR pipeline.

Inspiration

ClangIR is inspired in the success of other languages that greatly benefit from a middle-level IR, such as Swift and Rust. Particularly, optionally attaching AST nodes to CIR operations is inspired by SIL references to AST nodes in Swift.

Last updated: Mon Aug 25 21:50:24 PDT 2025