2017-01-22 11:58:12 +00:00
|
|
|
[package]
|
|
|
|
authors = [
|
|
|
|
"Jyun-Yan You <jyyou.tw@gmail.com>",
|
|
|
|
"Emilio Cobos Álvarez <emilio@crisal.io>",
|
2017-01-23 18:39:34 +00:00
|
|
|
"Nick Fitzgerald <fitzgen@gmail.com>",
|
2017-01-22 11:58:12 +00:00
|
|
|
"The Servo project developers",
|
Rewrite the core of the binding generator.
TL;DR: The binding generator is a mess as of right now. At first it was funny
(in a "this is challenging" sense) to improve on it, but this is not
sustainable.
The truth is that the current architecture of the binding generator is a huge
pile of hacks, so these few days I've been working on rewriting it with a few
goals.
1) Have the hacks as contained and identified as possible. They're sometimes
needed because how clang exposes the AST, but ideally those hacks are well
identified and don't interact randomly with each others.
As an example, in the current bindgen when scanning the parameters of a
function that references a struct clones all the struct information, then if
the struct name changes (because we mangle it), everything breaks.
2) Support extending the bindgen output without having to deal with clang. The
way I'm aiming to do this is separating completely the parsing stage from
the code generation one, and providing a single id for each item the binding
generator provides.
3) No more random mutation of the internal representation from anywhere. That
means no more Rc<RefCell<T>>, no more random circular references, no more
borrow_state... nothing.
4) No more deduplication of declarations before code generation.
Current bindgen has a stage, called `tag_dup_decl`[1], that takes care of
deduplicating declarations. That's completely buggy, and for C++ it's a
complete mess, since we YOLO modify the world.
I've managed to take rid of this using the clang canonical declaration, and
the definition, to avoid scanning any type/item twice.
5) Code generation should not modify any internal data structure. It can lookup
things, traverse whatever it needs, but not modifying randomly.
6) Each item should have a canonical name, and a single source of mangling
logic, and that should be computed from the inmutable state, at code
generation.
I've put a few canonical_name stuff in the code generation phase, but it's
still not complete, and should change if I implement namespaces.
Improvements pending until this can land:
1) Add support for missing core stuff, mainly generating functions (note that
we parse the signatures for types correctly though), bitfields, generating
C++ methods.
2) Add support for the necessary features that were added to work around some
C++ pitfalls, like opaque types, etc...
3) Add support for the sugar that Manish added recently.
4) Optionally (and I guess this can land without it, because basically nobody
uses it since it's so buggy), bring back namespace support.
These are not completely trivial, but I think I can do them quite easily with
the current architecture.
I'm putting the current state of affairs here as a request for comments... Any
thoughts? Note that there are still a few smells I want to eventually
re-redesign, like the ParseError::Recurse thing, but until that happens I'm
way happier with this kind of architecture.
I'm keeping the old `parser.rs` and `gen.rs` in tree just for reference while I
code, but they will go away.
[1]: https://github.com/Yamakaky/rust-bindgen/blob/master/src/gen.rs#L448
2016-08-21 05:32:16 +00:00
|
|
|
]
|
2017-01-23 18:39:34 +00:00
|
|
|
description = "Automatically generates Rust FFI bindings to C and C++ libraries."
|
2017-01-22 11:58:12 +00:00
|
|
|
keywords = ["bindings", "ffi", "code-generation"]
|
2017-01-23 18:39:34 +00:00
|
|
|
categories = ["external-ffi-bindings", "development-tools::ffi"]
|
2017-01-22 11:58:12 +00:00
|
|
|
license = "BSD-3-Clause"
|
|
|
|
name = "bindgen"
|
|
|
|
readme = "README.md"
|
2017-07-25 23:29:03 +00:00
|
|
|
repository = "https://github.com/rust-lang-nursery/rust-bindgen"
|
2017-01-23 15:29:41 +00:00
|
|
|
documentation = "https://docs.rs/bindgen"
|
2018-03-25 18:22:06 +00:00
|
|
|
version = "0.35.0"
|
2017-01-22 11:58:12 +00:00
|
|
|
build = "build.rs"
|
|
|
|
|
2017-08-13 23:09:01 +00:00
|
|
|
include = [
|
|
|
|
"Cargo.toml",
|
|
|
|
"build.rs",
|
|
|
|
"src/*.rs",
|
2017-08-17 14:11:49 +00:00
|
|
|
"src/**/*.rs",
|
2017-04-10 20:29:49 +00:00
|
|
|
]
|
2017-02-04 01:29:32 +00:00
|
|
|
|
2017-01-23 15:29:41 +00:00
|
|
|
[badges]
|
2017-07-25 23:29:03 +00:00
|
|
|
travis-ci = { repository = "rust-lang-nursery/rust-bindgen" }
|
2017-01-23 15:29:41 +00:00
|
|
|
|
2017-01-22 11:58:12 +00:00
|
|
|
[lib]
|
|
|
|
path = "src/lib.rs"
|
|
|
|
|
|
|
|
[[bin]]
|
|
|
|
name = "bindgen"
|
|
|
|
path = "src/main.rs"
|
2017-04-06 20:29:58 +00:00
|
|
|
doc = false
|
2017-01-22 11:58:12 +00:00
|
|
|
|
|
|
|
[dev-dependencies]
|
|
|
|
diff = "0.1"
|
|
|
|
clap = "2"
|
|
|
|
shlex = "0.1"
|
|
|
|
|
|
|
|
[dependencies]
|
|
|
|
cexpr = "0.2"
|
|
|
|
cfg-if = "0.1.0"
|
2017-08-23 01:53:55 +00:00
|
|
|
# This kinda sucks: https://github.com/rust-lang/cargo/issues/1982
|
|
|
|
clap = "2"
|
2018-03-13 08:55:18 +00:00
|
|
|
clang-sys = { version = "0.22.0", features = ["runtime", "clang_3_9"] }
|
2017-12-04 20:30:10 +00:00
|
|
|
lazy_static = "1"
|
2017-05-17 23:37:06 +00:00
|
|
|
peeking_take_while = "0.1.2"
|
2018-02-14 18:15:29 +00:00
|
|
|
quote = "0.3.15"
|
2017-01-22 11:58:12 +00:00
|
|
|
regex = "0.2"
|
2017-08-11 15:59:32 +00:00
|
|
|
which = "1.0.2"
|
2017-01-22 11:58:12 +00:00
|
|
|
|
|
|
|
[dependencies.env_logger]
|
|
|
|
optional = true
|
2018-02-13 12:00:41 +00:00
|
|
|
version = "0.5"
|
2017-01-22 11:58:12 +00:00
|
|
|
|
|
|
|
[dependencies.log]
|
|
|
|
optional = true
|
2018-02-13 12:00:41 +00:00
|
|
|
version = "0.4"
|
2017-01-22 11:58:12 +00:00
|
|
|
|
|
|
|
[features]
|
|
|
|
default = ["logging"]
|
|
|
|
logging = ["env_logger", "log"]
|
|
|
|
static = []
|
2017-04-06 21:38:05 +00:00
|
|
|
|
|
|
|
# These features only exist for CI testing -- don't use them if you're not hacking
|
|
|
|
# on bindgen!
|
|
|
|
testing_only_docs = []
|
2017-04-06 22:21:33 +00:00
|
|
|
testing_only_extra_assertions = []
|
2017-05-25 00:31:32 +00:00
|
|
|
testing_only_libclang_4 = []
|
|
|
|
testing_only_libclang_3_9 = []
|
|
|
|
testing_only_libclang_3_8 = []
|