summaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2017-01-31Add initial Objective C supportMikko Lehtonen
It parses interfaces and protocol but ignores base classes, and their methods which don’t have arguments, the method signature is currently ignored. Also you can pass objc class instances to C functions. Next steps are inheritance/base classes, method signatures, properties, categories. Then check with system headers what is missing.
2017-01-30ir: Cleanup name duplication in aliases and named types.Emilio Cobos Álvarez
It's just dumb.
2017-01-30codegen: ignore aliases for decltypes we can't resolve.Emilio Cobos Álvarez
We do the same for template parameters with `typename` on aliases. This is not great, but it's better than generating invalid code.
2017-01-30Force copy for incomplete arrays.Emilio Cobos Álvarez
These aren't extremely great, since this usually requires extra bookkeeping. But C allows it, so let's keep the same semantics.
2017-01-29extract unsafe ZeroedSizeArray traitFlier Lu
2017-01-28generate helper class to access incomplete arrayFlier Lu
2017-01-27Remove recently-added assertion pending investigation.Emilio Cobos Álvarez
This fails under BaseErrorResult in Stylo builds. I have no idea right now why that isn't whitelisted (should be, given we're calling it from TErrorResult's code generation). Let's disable this pending further investigation since I don't have time to dig into it right now.
2017-01-27codegen: Derive stuff in forward declarations.Emilio Cobos Álvarez
So Rust is happy when you use them in template parameters, since the Derive implementations can't catch this otherwise.
2017-01-26Assert that if we generating code for an item, than it is whitelistedNick Fitzgerald
This is a useful debugging tool for us to catch when code generation and whitelisting have different understandings of the world.
2017-01-26codegen: Add an option to skip comment generation.Emilio Cobos Álvarez
This is mostly a work around https://github.com/servo/rust-bindgen/issues/426, until we implement the proper fix.
2017-01-26Auto merge of #370 - cynicaldevil:detect-forward, r=emiliobors-servo
Forward declared structs now generate opaque enums @emilio : I checked the test outputs again, and it seems that these changes are affecting struct *definitions* as well. Hence, I have not committed the test changes yet. Fixes #62
2017-01-26Forward declared structs now generate opaque enumsNikhil Shagrithaya
2017-01-24Auto merge of #437 - emilio:constify-all-enums, r=fitzgenbors-servo
codegen: Respect original repr for bitfield-like enums, add a constifying variant. r? @fitzgen Fixes #430
2017-01-24codegen: Respect original repr for bitfield-like enums, add a constifying ↵Emilio Cobos Álvarez
variant.
2017-01-24codegen: don't generate extra use statements for non-enums.Emilio Cobos Álvarez
There's just no advantage in doing so.
2017-01-24Make it work in rust stable, and incidentally fix #425Emilio Cobos Álvarez
The problem with #425 was the following: We were parsing the methods after reaching the JS::Value definition. Those methods contained a JSWhyMagic that we hadn't seen, so we parsed it as being in the JS:: module.
2017-01-24codegen: Factor out some bits of root_import.Emilio Cobos Álvarez
2017-01-24codegen: Fix typedef re-export in namespaces when bindings aren't at the root.Emilio Cobos Álvarez
2017-01-23Unify under the `bindgen` name.Emilio Cobos Álvarez
2016-11-16Transition to libbindgen sub-crateJeff Waugh
- The root crate is the `bindgen` binary - Rust-ify the test suite, no more subprocesses! - Update Travis config to test both crates
2016-11-15ir: Make the id local to the context.Emilio Cobos Álvarez
2016-11-14codegen: Always implement debug for __BindgenUnionField.Emilio Cobos Álvarez
Our debug-detection code assumes so. Fixes #246 r? @fitzgen
2016-11-13codegen: Special-case i64::MIN since it produces a overflow on aster.Emilio Cobos Álvarez
Proper fix on aster soon, still worth to get this in I guess. r? @fitzgen
2016-11-11Auto merge of #240 - fitzgen:overloads, r=emiliobors-servo
Add support for bindings to overloaded functions This commit (re)adds support for generating bindings to overloaded functions. First, we use the symbol name instead of the canonical name when checking if we have already generated bindings for a given function. Second, we add a map from canonical names to number of times we have generated a function with that canonical name. We increment this number every time we generate a function. When the number is greater than zero, we append it to the function name so that overloaded functions get a unique Rust symbol. Fixes #239 r? @emilio
2016-11-11Add support for bindings to overloaded functionsNick Fitzgerald
This commit (re)adds support for generating bindings to overloaded functions. First, we use the symbol name instead of the canonical name when checking if we have already generated bindings for a given function. Second, we add a map from canonical names to number of times we have generated a function with that canonical name. We increment this number every time we generate a function. When the number is greater than zero, we append it to the function name so that overloaded functions get a unique Rust symbol.
2016-11-11Use __BindegenComplex for C Complex Fix #72Jean-Philippe DUFRAIGNE
C complex only exists for floating point types. C Complex are built in types long double _Complex is not supported. Long double would be an f128, runing generated binding test produces: assertion failed: `(left == right)` (left: `16`, right: `32`)', tests/expectations/tests/complex.rs:72 We test global long double _Complex because it does not require layout tests. Handle all the different way a complex can be present in BindgenContext calling generated_bindegen_complex to indicate that __BindgenContext will need to be added.
2016-11-11Add rudimentary support for `__float128`Nick Fitzgerald
This adds `__float128` as a builtin type, and generates an opaque array of 16 `u8`s to represent it in the generated bindings since Rust doesn't have an `f128` type. Context and motivation: Somehow `__float128` is getting pulled into SpiderMonkey headers from somewhere, and the lack of `__float128` support was causing bindgen to hard fail in bindings generation.
2016-11-08Auto merge of #219 - emilio:macros, r=fitzgenbors-servo
Parse macro expressions. Clang is trolling me really hard so I'm going to see if the extra token I'm always getting is LLVM 3.9 specific.
2016-11-08Address review comments.Emilio Cobos Álvarez
2016-11-08Add a finer-grane and more generic API for choosing macro types.Emilio Cobos Álvarez
2016-11-08codegen: Simplify bitfield logic a bit, make it work for unnamed enums, generateEmilio Cobos Álvarez
default BitOr implementation.
2016-11-08Add an option to generate bitfield-like typesafe enums.Emilio Cobos Álvarez
2016-11-08Fix --use-core for functions, since we used the aster helper.Emilio Cobos Álvarez
Signed-off-by: Emilio Cobos Álvarez <ecoal95@gmail.com>
2016-11-07Auto merge of #221 - emilio:dont-override-float, r=fitzgenbors-servo
Add an option to avoid converting to f32/f64 automatically float types. This implements another feature that we need for parity with upstream bindgen. r? @fitzgen
2016-11-07Add an option to avoid converting to f32/f64 automatically float types.Emilio Cobos Álvarez
2016-11-06bindgen: Support --use-core and --ctypes-prefix.Emilio Cobos Álvarez
2016-11-01Use `BindgenContext::whitelisted_items` in code generationNick Fitzgerald
This replaces the manual gathering and traversal of the transitive closure of whitelisted items with the new canonical method.
2016-11-01Manual fixups, some of them pretty lame, and don't let rustfmt rewrap comments.Emilio Cobos Álvarez
2016-11-01Run `cargo fmt`.Emilio Cobos Álvarez
2016-11-01Convert mod comment to a proper comment to avoid hitting ↵Emilio Cobos Álvarez
https://github.com/rust-lang-nursery/rustfmt/issues/1184
2016-10-31Move the `TypeCollector` trait to the `ir` moduleNick Fitzgerald
This commit moves the `TypeCollector` trait out from the `codegen` module and into its own submodule in `ir::type_collector`. Additionally, it puts the various `TypeCollector` trait implementations next to the types that each implementation is for.
2016-10-24Add `#![deny(missing_docs)]`Nick Fitzgerald
This commit adds the `#![deny(missing_docs)]` pragma, which causes compilation to fail if a public type or function is missing a documentation comment. It also adds missing documentation comments for public types and functions that were missing them.
2016-10-23Auto merge of #110 - heycam:stable-gen-names, r=emiliobors-servo
Give vtables and anonymous items more stable generated names (fixes #60) r? @emilio This works pretty well. There are two remaining things in stylo's structs files that have identifiers that look like they won't be that stable: the anonymous enum for the NODE_* flags at the top level, and the `typedef union { ... } nsStyleUnion`. There are various anonymous enums and other things at the top level in system headers that cause these identifiers to have generated IDs in them higher than 1 and 2. Probably for anonymous enums we could just avoid generating a rust enum altogether, since having the static consts should be sufficient. I tried to mess with the codegen to automatically treat `typedef union { ... } nsStyleUnion` like `union nsStyleUnion { ... }` but it seems the way clang exposes the typedef and union are as two adjacent cursors rather than a parent-child relationship, so it's not so easy.
2016-10-23Give vtables and anonymous items more stable generated names.Cameron McCormack
2016-10-21Auto merge of #66 - emilio:const-methods, r=noxbors-servo
Take pointer constness into account, to fix generation of const methods. We signal method constness in the `this` pointer creating a `const` pointer, but the `to_rust_ty` implementation never checked that.
2016-10-19codegen: Generate constants names for unnamed enums in classes.Emilio Cobos Álvarez
2016-10-18Ignore doctests that are really C++ code samples, or aren't meant to runNick Fitzgerald
2016-10-18ir: Handle templated aliases.Emilio Cobos Álvarez
2016-09-27Take pointer constness into account, to fix generation of const methods.Emilio Cobos Álvarez
2016-09-26Fix review comment. Fix #47Jean-Philippe DUFRAIGNE