# meta/infer architecture

> Architecture diagram of the GitHub repository meta/infer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/meta/infer
- Repository: https://github.com/meta/infer

## Overview

Infer is documented as a static analyzer for Java, C++, Objective-C, and C. The supplied tree exposes only parts of that product: annotation definitions and C++ AST-export tooling, alongside the Rust-to-LLBC Charon tool. Charon’s visible workflow is CLI invocation, Rustc-driver translation, AST transformation, then JSON serialization. The main Infer analysis engine is not present in the sampled files, so this graph describes only the evidenced components and does not infer links to that missing engine.

Main entry points: [`dependencies/charon/charon/src/bin/charon-driver/main.rs`](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/bin/charon-driver/main.rs) (Rustc driver), [`dependencies/charon/charon/src/transform/mod.rs`](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/transform/mod.rs) (Transform passes), [`facebook-clang-plugins/libtooling/ASTExporter.h`](https://github.com/meta/infer/blob/main/facebook-clang-plugins/libtooling/ASTExporter.h) (AST exporter), [`dependencies/charon/charon/src/bin/charon/main.rs`](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/bin/charon/main.rs) (Charon CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_infer_support["Infer support"]
  node_infer_annotations["Java annotations<br/>[Nullsafe.java]"]
end

subgraph group_clang_export["C++ AST export"]
  node_clang_action["Clang plugin action"]
  node_clang_exporter["AST exporter<br/>[ASTExporter.h]"]
  node_atd_writer["ATD writer<br/>[ATDWriter.h]"]
end

subgraph group_charon_frontend["Charon translation"]
  node_charon_cli["Charon CLI<br/>[main.rs]"]
  node_charon_driver["Rustc driver<br/>[main.rs]"]
  node_rust_translation["Rust translation<br/>[translate_crate.rs]"]
end

subgraph group_charon_ir["Charon IR processing"]
  node_charon_ast["LLBC AST<br/>[expressions.rs]"]
  node_ast_visitor["AST visitor<br/>[visitor.rs]"]
  node_transform_passes["Transform passes<br/>[mod.rs]"]
  node_transform_context["Transform context<br/>[ctx.rs]"]
  node_associated_types["Associated types"]
  node_control_flow["Control-flow recovery<br/>[ullbc_to_llbc.rs]"]
  node_json_output["JSON output<br/>[export.rs]"]
end

node_user(("Developer"))

node_user -->|"invokes"| node_charon_cli
node_charon_cli -->|"wraps Rustc"| node_charon_driver
node_charon_driver -->|"translates crate"| node_rust_translation
node_charon_driver -->|"runs passes"| node_transform_passes
node_transform_passes -->|"transforms through"| node_transform_context
node_transform_passes -->|"includes pass"| node_associated_types
node_transform_passes -->|"includes pass"| node_control_flow
node_charon_driver -.->|"serializes result"| node_json_output
node_clang_action -.->|"runs exporter"| node_clang_exporter
node_clang_exporter -->|"emits structure"| node_atd_writer

click node_infer_annotations "https://github.com/meta/infer/blob/main/infer/annotations/src/main/java/com/facebook/infer/annotation/Nullsafe.java"
click node_clang_action "https://github.com/meta/infer/blob/main/facebook-clang-plugins/libtooling/SimplePluginASTAction.h"
click node_clang_exporter "https://github.com/meta/infer/blob/main/facebook-clang-plugins/libtooling/ASTExporter.h"
click node_atd_writer "https://github.com/meta/infer/blob/main/facebook-clang-plugins/libtooling/atdlib/ATDWriter.h"
click node_charon_cli "https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/bin/charon/main.rs"
click node_charon_driver "https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/bin/charon-driver/main.rs"
click node_rust_translation "https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/bin/charon-driver/translate/translate_crate.rs"
click node_charon_ast "https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/ast/expressions.rs"
click node_ast_visitor "https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/ast/visitor.rs"
click node_transform_passes "https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/transform/mod.rs"
click node_transform_context "https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/transform/ctx.rs"
click node_associated_types "https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/transform/expand_associated_types.rs"
click node_control_flow "https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/transform/ullbc_to_llbc.rs"
click node_json_output "https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/export.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_infer_annotations toneBlue
class node_clang_action,node_clang_exporter,node_atd_writer toneAmber
class node_charon_cli,node_charon_driver,node_rust_translation toneMint
class node_charon_ast,node_ast_visitor,node_transform_passes,node_transform_context,node_associated_types,node_control_flow,node_json_output toneRose
class node_user toneIndigo
```

## Components

### Infer support

- [Java annotations](https://github.com/meta/infer/blob/main/infer/annotations/src/main/java/com/facebook/infer/annotation/Nullsafe.java): `infer/annotations/src/main/java/com/facebook/infer/annotation/Nullsafe.java`

### C++ AST export

- [Clang plugin action](https://github.com/meta/infer/blob/main/facebook-clang-plugins/libtooling/SimplePluginASTAction.h): `facebook-clang-plugins/libtooling/SimplePluginASTAction.h`
- [AST exporter](https://github.com/meta/infer/blob/main/facebook-clang-plugins/libtooling/ASTExporter.h): `facebook-clang-plugins/libtooling/ASTExporter.h`
- [ATD writer](https://github.com/meta/infer/blob/main/facebook-clang-plugins/libtooling/atdlib/ATDWriter.h): `facebook-clang-plugins/libtooling/atdlib/ATDWriter.h`

### Charon translation

- [Charon CLI](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/bin/charon/main.rs): `dependencies/charon/charon/src/bin/charon/main.rs`
- [Rustc driver](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/bin/charon-driver/main.rs): `dependencies/charon/charon/src/bin/charon-driver/main.rs`
- [Rust translation](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/bin/charon-driver/translate/translate_crate.rs): `dependencies/charon/charon/src/bin/charon-driver/translate/translate_crate.rs`

### Charon IR processing

- [LLBC AST](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/ast/expressions.rs): `dependencies/charon/charon/src/ast/expressions.rs`
- [AST visitor](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/ast/visitor.rs): `dependencies/charon/charon/src/ast/visitor.rs`
- [Transform passes](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/transform/mod.rs): `dependencies/charon/charon/src/transform/mod.rs`
- [Transform context](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/transform/ctx.rs): `dependencies/charon/charon/src/transform/ctx.rs`
- [Associated types](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/transform/expand_associated_types.rs): `dependencies/charon/charon/src/transform/expand_associated_types.rs`
- [Control-flow recovery](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/transform/ullbc_to_llbc.rs): `dependencies/charon/charon/src/transform/ullbc_to_llbc.rs`
- [JSON output](https://github.com/meta/infer/blob/main/dependencies/charon/charon/src/export.rs): `dependencies/charon/charon/src/export.rs`

### Other components

- **Developer**

## Connections

- Developer → Charon CLI: invokes (evidence: `dependencies/charon/charon/src/bin/charon/main.rs`)
- Charon CLI → Rustc driver: wraps Rustc (evidence: `dependencies/charon/charon/src/bin/charon/main.rs`)
- Rustc driver → Rust translation: translates crate (evidence: `dependencies/charon/charon/src/bin/charon-driver/main.rs`)
- Rustc driver → Transform passes: runs passes (evidence: `dependencies/charon/charon/src/bin/charon-driver/main.rs`)
- Transform passes → Transform context: transforms through (evidence: `dependencies/charon/charon/src/transform/mod.rs`)
- Transform passes → Associated types: includes pass (evidence: `dependencies/charon/charon/src/transform/mod.rs`)
- Transform passes → Control-flow recovery: includes pass (evidence: `dependencies/charon/charon/src/transform/mod.rs`)
- Rustc driver → JSON output: serializes result
- Clang plugin action → AST exporter: runs exporter (evidence: `facebook-clang-plugins/libtooling/ASTExporter.h`)
- AST exporter → ATD writer: emits structure (evidence: `facebook-clang-plugins/libtooling/ASTExporter.h`)
