Age | Commit message (Collapse) | Author |
|
|
|
|
|
item: Consider replaced items hidden.
Fixes #81
r? @nox
|
|
|
|
|
|
Most flags have a blank line between them, but some did not. Now they
all do.
|
|
The flag is no longer used since the bindgen rewrite.
|
|
|
|
|
|
|
|
|
|
I switched to the consuming builder pattern, as that seemed the
easiest, and ditched the phantom markers while I was at it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Signed-off-by: Emilio Cobos Álvarez <ecoal95@gmail.com>
|
|
This fixes union_with_nesting.h
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
This commit switches bindgen over to using the docopt crate for argument parsing
instead of manual argument parsing. This required two notable changes in the
arguments and flags style:
1. All flags of the form `-foo` are now of the form `--foo`.
2. We can no longer pass unknown flags straight through to clang. Instead, the
user appends `--` after the bindgen flags and input header, after which point
any more flags and arguments get collected and passed to clang. This required
changes to the test runner and the `// bindgen-flags` comments.
|
|
|
|
This is kind of unfortunate, but we weren't taking into account explicit
destructors.
|
|
down the hack version.
|
|
by Rc<T>s
|
|
|
|
parameters in general that don't use the template argument.
|
|
since I introduced support for anonymous structs.
|
|
|
|
|
|
Fixes #22
|
|
method
|
|
There's no easy way to get the current target triple from the clang-c
bindings. Make this simple and require an option to be passed when
generating bindings for msvc, using the x86_64-pc-win32 target (or i686)
|
|
bindings
|
|
This is not needed at least for Clang 3.9 (which is required to parse
stdlib headers of MSVC 2015). This hack leads to incorrect mangling
result there.
|
|
Otherwise it would be hard to write uniform blacklist header list
across platforms, especially given that on Windows, some part of
path could be using '/' while others use '\'.
|
|
|
|
This is the same that we do in components/style in servo.
|
|
|