summaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2017-10-10Auto merge of #1065 - liranringel:thiscall, r=fitzgenbors-servo
Add support for the thiscall ABI Fixes https://github.com/rust-lang-nursery/rust-bindgen/issues/541 The thiscall ABI is experimental, so in order to use it nightly is required and also the following statement: `#![feature(abi_thiscall)]` That's a problem because the `tests_expectations` crate (in the tests folder) tries to compile it (and stable is required).
2017-10-09Auto merge of #1066 - pepyakin:bitfields-in-unions, r=fitzgenbors-servo
Bitfields in unions Fixes #744 I think it is WIP for the moment as I didn't run tests locally.
2017-10-10Add support for the thiscall ABILiran Ringel
2017-10-09Fix bitfields in bindgen unionsSergey Pepyakin
2017-10-07Tell LLVM to not mangle names if they're already mangled through link_name ↵Liran Ringel
attribute
2017-10-05Use bitfield getter_name in impl_debug.Sergey Pepyakin
Also make impl_partialeq test to also cover impl_debug case.
2017-10-05Use bitfield getter_name in impl_partialeqSergey Pepyakin
2017-10-05Eagerly generate bitfield accessor namesSergey Pepyakin
Also clean a bit.
2017-10-04Remove early anonymous bitfield filtering and consolidate name methodOliver Geller
2017-10-03Assert we only gen partialeq for non rust unionsSergey Pepyakin
2017-10-03Derive partialeq "manually" when possibleSergey Pepyakin
Remove derive-partialeq-template-inst test. Add comments. Don't implement PartialEq for incomplete arrays Handle opaque bases and template instantiations Extract constrain_type. Extract `is whitelisted?` check Add failing partialeq-anonfield join for comps Fix: return insert if not whitelisted Delegate TypeRefs and alias to constrain_join. Delegate Template instantiations to constrain_join Add derive-partialeq-pointer.hpp test Update comment. Fix layout alignment larger that array limit Add missing test for derive-partialeq-anonfield.rs Clean Clean Fix typo in opaque-template-inst-member test Remove redudant stmt Add comment on can_supersede. Format impl_partialeq and leave a comment Extract requires_storage into it's own function. Clean
2017-10-02Tighten up `is_unsized` and `has_vtable` checks to operated on TypeIdNick Fitzgerald
2017-10-02Make methods/constructors/destructors use FunctionIdNick Fitzgerald
And also allow ID comparison across ID types, as this makes implementing the above much easier.
2017-10-02Introduce ModuleId to strongly type IDs pointing at ModulesNick Fitzgerald
2017-10-02A bunch of parsing things should return TypeIdNick Fitzgerald
2017-10-02Make `Enum::repr` into a `TypeId`Nick Fitzgerald
2017-10-02Make base members use TypeId rather than ItemIdNick Fitzgerald
2017-10-02Make a bunch more methods take generic idsNick Fitzgerald
2017-10-02Make comp fields contain `TypeId`sNick Fitzgerald
2017-10-02Make functions which take an ItemId generic to take any kind of idNick Fitzgerald
2017-10-02Make `TypeKind::{Alias,TemplateAlias,Array,Pointer,Reference}` use `TypeId`Nick Fitzgerald
This commit makes certain `TypeKind`s that can only reference other types use `TypeId` instead of `ItemId`.
2017-10-02Turn `build_templated_path` into `build_path`Nick Fitzgerald
None of the callers were passing template parameters.
2017-10-02Remove unused parameter to `codegen::utils::type_from_named`Nick Fitzgerald
2017-10-02Introduce the `TypeId` newtype over `ItemId`Nick Fitzgerald
This commit also makes `BindgenContext::resolve_type` take a `TypeId`, and adds unchecked conversions everywhere that we call it. Next, I'm going to go through the code base, replacing these unchecked conversions with checked ones, and tightening up types as I go.
2017-09-25codegen: Avoid generating wrong type for enums with unknown representations.Emilio Cobos Álvarez
2017-09-22Deanonymize fieldsSergey Pepyakin
Clean. Add timer. Clean codegen
2017-09-22Auto merge of #1016 - pepyakin:impl-debug-fixes, r=fitzgenbors-servo
Impl_debug fixes r? @fitzgen
2017-09-22Rename derive_debug → impl_debug.Sergey Pepyakin
2017-09-22Generate base names upon constructon.Sergey Pepyakin
2017-09-19Derive Ord when possibleSergey Pepyakin
2017-09-19Emit derive(PartialOrd)Sergey Pepyakin
2017-09-14Add a `Builder::blacklist_type`Alexey Zabelin
This deprecates `Builder::hide_type`. Related to #984. - [x] Add Builder::blacklist_type, that does the same thing as hide_type - [x] Mark Builder::hide_type as #[deprecated = "Use blacklist_type instead"] - [x] Make hide_type delegate to blacklist_type - [x] Rename the BindgenOptions::hidden_types member to BindgenOptions::blacklisted_types - [x] Rename ir::context::BindgenContext::hidden_by_name to blacklisted_by_name - [x] Rename ir::item::Item::is_hidden to is_blacklisted
2017-09-11Make bindgen generate enums as constants by defaultCldfire
Also simplifies the logic that determines which enum variation gets chosen.
2017-09-07Use the `quote!` macro for `link_name` attributesNick Fitzgerald
The latest `rustfmt` has fixed the formatting bugs we were running into.
2017-09-07Use `quote` instead of `syntex` for Rust code generationNick Fitzgerald
The `syntex` crate is unmaintained. It is slow to build, and additionally it requires that we pre-process `src/codegen/mod.rs` before we build the `bindgen` crate. The `quote` crate provides similar quasi-quoting functionality, is maintained, and builds faster. It doesn't have a typed API or builders, however; it only deals with tokens. Before this commit: ``` $ cargo clean; cargo build <snip> Finished dev [unoptimized + debuginfo] target(s) in 98.75 secs ``` After this commit: ``` $ cargo clean; cargo build <snip> Finished dev [unoptimized + debuginfo] target(s) in 46.26 secs ``` Build time is cut in half! But what about run time? Before this commit: ``` Generated Stylo bindings in: Duration { secs: 3, nanos: 521105668 } ``` After this commit: ``` Generated Stylo bindings in: Duration { secs: 3, nanos: 548797242 } ``` So it appears to be about 20ms slower at generating Stylo bindings, but I suspect this is well within the noise. Finally, this also lets us remove that nasty `mem::transmute` inside `bindgen::ir::BindgenContext::gen` that was used for the old `syntex` context. Now `BindgenContext` doesn't have a lifetime parameter either. This should make it easier to revisit doing our analyses in parallel with `rayon`, since that context was one of the things that made it hard for `BindgenContext` to implement `Sync`. Fixes #925
2017-09-06Auto merge of #950 - fitzgen:no-derive-copy-for-blacklisted-types, r=emiliobors-servo
Derive + blacklisted types * [X] document blacklisting + derive interaction * [X] derive `Copy` * [X] derive `Debug` * [X] `--impl-debug` * [x] derive `Default` * [x] derive `Hash` * [x] derive `PartialEq`
2017-09-06Don't try and debug format blacklisted types when generating `impl Debug` blocksNick Fitzgerald
2017-09-06Check derive_copy optionmchlrhw
2017-08-30Squash commit for --time-phases command line optionJackson O'Donnell
initial timer branch commit added time_phases builder parameter create timers for BindgenContex analyses, codegen time parse added docstrings added fitzgens suggestions add --time-phases to bindgen::Builder::command_line_flags
2017-08-29Auto merge of #936 - jhod0:no_fieldgen_on_opaque, r=fitzgenbors-servo
Avoid generating fields/methods for opaque objects WIP fix for issue #929 With libclang 4, passes all tests on my machine except `dump_preprocessed_input`, but that fails on the master branch as well
2017-08-29removed commented code, added punctuationJackson O'Donnell
2017-08-28no fields or methods created for opaqueJackson O'Donnell
2017-08-24Simplify helpers::blobMalo Jaffré
Thanks @fitzgen for the detailed instructions. Fixes #928.
2017-08-21Can derive EqZhiting Zhu
2017-08-21Rename `TypeKind::Named` to `TypeKind::TypeParam`Anna Liao
Also renames a bunch of other things referring to named types to refer to type parameters. Fixes #915
2017-08-14Can derive PartialEq analysisZhiting Zhu
2017-08-14Fixes compilation warnings with rustc 1.21.0-nightly (13d94d5fa 2017-08-10)Bastian Köcher
2017-08-14Fixes alignment errors with new Rust union typeBastian Köcher
This fix creates a new private field with the required aligned size. This new private field ensures that the union has the required size.
2017-08-13Re-add --rust-target to replace --unstable-rustTravis Finkenauer
Instead of specifying whether or not to use stable, specify the Rust release to support (one of several stable/beta releases or nightly). The `--unstable-rust` option is still accepted and implies nightly. The definitions of `RustTarget` and `RustFeatures` are created with macros. For each test that uses unions, there is a version that uses the latest stable and 1.0. This also fixes the bug where unions were generated with non-Copy fields.
2017-08-10Auto merge of #899 - bkchr:manual_debug_impl, r=fitzgenbors-servo
Implements Debug trait for types which do not support derive Debug For types that do not support derive Debug be implemented automatically by rust, we know can generate implementations of the Debug trait. This code generation is hidden behind the '--force-derive-debug' command-line flag. Should solve: #875 Sorry for the extra noise in lib.rs, codegen/mod.rs etc, that was rustfmt.