一句话:SAF 用 Rust 内核加 Python/WASM 接口、YAML 规格语言与智能体技能,让 AI 编码智能体可端到端构建 LLVM IR 静态检查器。
现有面向 LLVM IR 的全程序分析框架(如 SVF、Phasar、Lotus)只暴露 C++ API,使用者必须继承子类、重新编译并锁定特定 LLVM 版本,上手周期以月计;CodeQL 虽以查询语言替代 C++ API,但同样不是为日益参与软件工程任务的 AI 编码智能体设计的。本文提出 Static Analyzer Factory(SAF):以 Rust 实现分析内核,通过 PyO3 零拷贝绑定暴露给 Python;提供基于 WebAssembly 与 Pyodide 的浏览器 playground,无需安装即可运行同一套 SDK;引入声明式 YAML 函数规格语言,供内置检查器在运行时消费;并发布两个可装入 Claude Code 与 Codex 的编码智能体技能。作为示例,SAF 自带的内存安全检查器即由 Claude Code(Opus 4.6)依此工作流端到端编写。在 NIST Juliet C/C++ 基准上,这些检查器在四类内存安全 CWE 中的三类取得最佳 F1,对比对象为 SVF 与 Lotus 中各自提供对应检查器的实现。
Static program analysis finds bugs before software ships, and modern checkers for C/C++ depend on whole-program infrastructure: pointer analysis, value-flow tracking, taint analysis, and IFDS-based data flow on top of LLVM. Today’s LLVM-IR frameworks fall short. SVF, Phasar, and Lotus expose their analyses through C++ APIs that require subclassing, recompilation, and pinned LLVM builds; onboarding takes months. CodeQL replaces the C++ API with a domain-specific query language. None is designed for the AI coding agents that increasingly drive software-engineering work. We present the Static Analyzer Factory (SAF), an LLVM-IR analysis framework that combines a Rust kernel exposed to Python through PyO3 zero-copy bindings, a WebAssembly and Pyodide browser playground that runs the same SDK with no install, a declarative YAML language for function specifications that the built-in checkers consume at runtime, and two shipped coding-agent skills installable in Claude Code and Codex. As an illustrative case, SAF’s bundled memory-safety checkers were themselves authored end-to-end through this workflow using Claude Code on the Opus 4.6 model. On the NIST Juliet C/C++ benchmark, these checkers achieve the best F1 on three of four memory-safety CWEs, each measured against whichever of SVF and Lotus ships a corresponding checker. Code: https://github.com/Static-Analyzer-Factory/static-analyzer-factory. Documentation and browser playground: https://static-analyzer-factory.github.io/static-analyzer-factory/. Demo video: https://youtu.be/Cj58VvNCrlw.