summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
AgeCommit message (Collapse)Author
2019-11-09Replace unsafe ref->ptr transmute with 'as' castingElichai Turkel
2019-11-08Option to use #[repr(transparent)] structs instead of type aliasing.Joseph Rafael Ferrer
2019-11-08Add support for MaybeUninitElichai Turkel
2019-11-03Do not generate implementation for clone for FAMDavid Frey
Flexible array members are represented in the generated binding by a struct __IncompleteArrayField<T>. Since such members do not contain any information about how big they are, it is impossible to automatically clone or copy them, either in C or rust. Fixes #1431.
2019-10-22codegen: Handle opaque aliases to enums correctly.Emilio Cobos Álvarez
Opaque types don't use the path to their aliased type but an opaque type like an array or primitive with the right alignment. Fixes #1599.
2019-10-14Rustfmt to account for rebase.Emilio Cobos Álvarez
2019-10-08Fix BitfieldUnit constructor to handle 64 bit wide bitfields on 32 bit.Cameron McCormack
Fixes #1639.
2019-10-03Use c_void from core when --use-core is specifiedKyle Tomsic
`c_void` is available as `::std::os::raw::c_void` and `::core::ffi::c_void`. If the "--use-core" option is specified (but no --ctypes-prefix is provided), we should emit `::core::ffi::c_void` rather than the `std` one.
2019-09-17Rustfmt.Emilio Cobos Álvarez
2019-07-27Fix beta build warnings / errors. (#1603)Emilio Cobos Álvarez
Fixes #1598
2019-07-24Cleanup wchar_t layout computation to happen later. (#1596)Emilio Cobos Álvarez
This is a breaking cheange since WChar is exposed, but should be no behavior change otherwise.
2019-06-12Style fixes.uk
See https://github.com/rust-lang/rust-bindgen/pull/1575
2019-06-11Add rust target configuration for feature #1554uk
Will panic if the feature is being used outside nightly. See https://github.com/rust-lang/rust-bindgen/pull/1575#discussion_r292231027
2019-06-11Rename a couple miscalled identifiers.uk
See https://github.com/rust-lang/rust-bindgen/pull/1575
2019-06-10Add support for non_exhaustive rustified enums.uk
Implements the feature discussed in https://github.com/rust-lang/rust-bindgen/issues/1554.
2019-06-06For rust-target >= 1.30, make __IncompleteArrayField::new a const fnColin Wallace
2019-06-06For rust-target >= 1.30, make __BindgenUnionField::new a const fnColin Wallace
2019-06-06FIX #1571: For rust-target >= 1.30, make __BindgenBitfieldUnit::new a const fnColin Wallace
2019-05-22Added array pointers to the CLIElichai Turkel
2019-05-22Added array pointers codegenElichai Turkel
2019-05-21Update LinksAlex Touchet
2019-05-15Only emit #[link_name] attribute if necessary.Michael Woerister
2019-05-06Remove unused mut.Emilio Cobos Álvarez
2019-03-25ir: Whitelist items that don't generate code to improve derive behavior.Emilio Cobos Álvarez
When not whitelisting recursively. Fixes #1454
2019-03-21Unify derive logicJethro Beekman
2019-03-04codegen: Properly track alignment of unions.Emilio Cobos Álvarez
This makes us not unnecessarily add repr(align) to unions. Closes #1498.
2019-02-11fix one argument block pointer issue, #1378Flier Lu
2019-02-04codegen: Append implicit template parameters to base members.Emilio Cobos Álvarez
Fixes #1514
2019-01-08Support #[repr(packed(N))] on Rust 1.33+Christian Legnitto
Fixes https://github.com/rust-lang/rust-bindgen/issues/537.
2019-01-03Bitfield enums use #[repr(transparent)] on Rust 1.28+Christian Legnitto
Fixes https://github.com/rust-lang/rust-bindgen/issues/1474.
2018-12-29Merge pull request #1473 from emilio/hashEmilio Cobos Álvarez
Some perf tweaks
2018-12-28codegen: Make zero-sized arrays affect alignment.Emilio Cobos Álvarez
Fixes #684
2018-12-23codegen: We should not iterate over codegen_items.Emilio Cobos Álvarez
This should allow making it a HashSet.
2018-12-23Switch to hashbrown.Emilio Cobos Álvarez
This wins between 2 and 5 milliseconds more in the test-case above, so no reason not to I guess.
2018-12-23Switch to FxHash for hash maps and such.Emilio Cobos Álvarez
This isn't such a massive win as I'd have hoped, but it is consistently faster, so there's no reason not to. > ./bindgen-old tests/stylo.hpp --no-rustfmt-bindings > /dev/null 2>&1 6.17s user 0.84s system 98% cpu 7.079 total > ./target/release/bindgen tests/stylo.hpp --no-rustfmt-bindings > /dev/null 2> 5.92s user 0.87s system 98% cpu 6.866 total Which isn't _that_ much but it's quite a bit.
2018-12-02codegen: Properly detect bindgen unions.Emilio Cobos Álvarez
The root cause of the issue was the missing: ``` self.saw_bindgen_union |= new.saw_bindgen_union; ``` But I also cleaned up a bit more and removed the unused saw_union. Fixes #1457
2018-11-30Update quote and proc-macro.Bastien Orivel
I give up on the doc comments. This is a rebase of #1334 keeping the formatting of the comments and using TokenStream::from_str instead because one can hope. Fixes #1407.
2018-11-28Add source annotation to express explicit derives for a type.Porter Smith
This allows for explicit selection of which traits are derived for a type, e.g. deriving custom traits on particular types that need it. Example usage: ```C++ /// <div rustbindgen derive="Clone"></div> /// <div rustbindgen derive="MyDerivableTrait"></div> struct foo { ... }; ``` generates into ```Rust #[derive(Clone,MyDerivableTrait)] struct foo { ... } ```
2018-11-27Add #[must_use] to functions annotated with __attribute__((warn_unused_result))Porter Smith
2018-11-07Use canonical path for type alias loop detectionSeo Sanghyeon
2018-11-06codegen: Make the mangling name check work in presence of ↵Emilio Cobos Álvarez
attribute(overloadable). Fixes #1350
2018-10-29ir: Consistently append implicit template parameters when not using Rust unions.Emilio Cobos Álvarez
Fixes #1429.
2018-10-22codegen: Teach bindgen to respect constness of statics.Emilio Cobos Álvarez
2018-10-11ir: Ensure everything agrees in which kind of variation an enum generates.Emilio Cobos Álvarez
2018-10-07Skip bitfield unit tests on big-endian platforms.Emilio Cobos Álvarez
Fixes #1412.
2018-10-04Puts blocks behind a switch.Emilio Cobos Álvarez
Since #1378 broke a bunch of OSX builds. Most people don't care about them and they're in some OSX system headers which means that this could break normal C and C++ stuff. This introduces --generate-block / generate_block to generate these signatures, and adds tests so that this is getting tested.
2018-09-25Indicate the anonymous lifetime in Formatter.jkozlowski
2018-09-24Auto merge of #1396 - tathanhdinh:master, r=emiliobors-servo
PartialOrd and Ord for enum Hello all, This PR tries to fix #1395. Many thanks for any comment.
2018-09-22PartialOrd and Ord for enumTA Thanh Dinh
2018-09-22codegen: Explicitly align unions if needed.Emilio Cobos Álvarez
Also adds a test header I missed from the previous PR. Fixes #1393