Skip to content

Commit aede186

Browse files
author
Heesoo Yang
committed
Rename to unstable_ir, add docs
1 parent 00df467 commit aede186

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

docs.md

+9
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,18 @@ cbindgen = "0.24.0"
9494

9595
If you'd like to use a `build.rs` script with a `cbindgen.toml`, consider using [`cbindgen::generate()`](https://docs.rs/cbindgen/*/cbindgen/fn.generate.html) instead.
9696

97+
## Internal Representation
9798

99+
Some users may find it useful to access the **unstable** internal representation (IR) that cbindgen uses to parse and generate code. By default, the IR is private, but you can access it by enabling the `"unstable_ir"` feature flag like so:
98100

101+
```
102+
[build-dependencies]
103+
cbindgen = { version = "0.27.0", features = ["unstable_ir"] }
104+
```
105+
106+
This opens up the `cbindgen::bindgen::ir` module.
99107

108+
Please remember that the IR is **not stable**, so if you use this feature, you will need to pin cbindgen to avoid breakages.
100109

101110
# Writing Your C API
102111

src/bindgen/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ mod config;
4545
mod declarationtyperesolver;
4646
mod dependencies;
4747
mod error;
48-
#[cfg(feature = "ir")]
48+
#[cfg(feature = "unstable_ir")]
4949
pub mod ir;
50-
#[cfg(not(feature = "ir"))]
50+
#[cfg(not(feature = "unstable_ir"))]
5151
mod ir;
5252
mod language_backend;
5353
mod library;

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ extern crate quote;
1414
extern crate syn;
1515
extern crate toml;
1616

17-
#[cfg(feature = "ir")]
17+
#[cfg(feature = "unstable_ir")]
1818
pub mod bindgen;
19-
#[cfg(not(feature = "ir"))]
19+
#[cfg(not(feature = "unstable_ir"))]
2020
mod bindgen;
2121

2222
pub use crate::bindgen::*;

0 commit comments

Comments
 (0)