summaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2018-12-28codegen: ctypes_prefix may not be an ident.Emilio Cobos Álvarez
This fixes a panic uncovered by the proc_macro update, which validates idents now. We were using it as a pretty crappy way to turn it into something that could be turned into a TokenStream. But TokenStream implements FromStr now.
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-25Back out changesjkozlowski
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
2018-09-19Always force repr(align) attributes for stuff with alignment >= 16Emilio Cobos Álvarez
To work-around some cases of https://github.com/rust-lang/rust/issues/54341. Other cases where u128 and u64 are mixed in fields might not behave correctly, but the field offset assertions would catch them. Fixes #1370
2018-09-19Teach the float code about u128.Emilio Cobos Álvarez
2018-09-19Teach the blob code to generate i128 / u128 if available.Emilio Cobos Álvarez
This is very mechanical and boring, but needed.
2018-09-19codegen: Generate u128 / i128 when available.Emilio Cobos Álvarez
2018-09-14Fix typo: s/unkown/unknown/ (missing 'n')Daniel Holbert
2018-09-10generate type alias for the `block` typeFlier Lu
2018-08-28Debug implementation: Don't use format! or String when core is enabledchrysn
As --use-core is typically given when the wrapped library is to be used in a no_std environment, format! and String can not be used. This is a quick fix that will cause regressions in the quality of the debug output to users that use core but are not no_std, but enables the use of bindgen with implemented Debug traits to no_std users. Closes: https://github.com/rust-lang-nursery/rust-bindgen/issues/1100
2018-08-28Debug implementation: use core if selectedchrysn
Contributes-To: https://github.com/rust-lang-nursery/rust-bindgen/issues/1100
2018-08-24Don't generate a __bindgen_align field if we support repr(align).Emilio Cobos Álvarez
2018-08-19Not gnereate binding for variadic function with ms_abiJean-Philippe Dufraigne
rustc fail to compile variadic function with ms_abi: error[E0045]: variadic function must have C or cdecl calling convention As suggested in issue, this short term fix: not generate binding and emit a warning. Fixes #997
2018-08-14Auto merge of #1366 - gnzlbg:vec, r=emiliov0.38.0bors-servo
Map vector types to arrays and pass them by value This PR maps vector types to arrays and passes them by value (that is, they are passed to C as `[T; N]`. This already allows defining them as a blacklisted opaque type, such that the user can provide its own definition from e.g. `std::arch`. A subsequent PR should map vector types to unit structs with a private member: ```rust #[repr(align(16))] pub struct __m128([f32; 4]); ``` to make their alignment at least be correct. This should allow transmuting `std::arch` types to these types properly. Once that is done, we probably want to detect the canonical vector types (e.g. `__m128`) and pull in the type from `std`/`core`::arch instead.
2018-08-14address review commentsgnzlbg
2018-08-14Minor stylistic nits after #1362.Emilio Cobos Álvarez
2018-08-14address commentsSébastien Duquette
2018-08-14Convert CodegenOptions to a bitfield.Sébastien Duquette
2018-08-14map vector types to arrays and pass them by valuegnzlbg
2018-07-30Minor cleanup after #1355.Emilio Cobos Álvarez
2018-07-29Use associated constants for rust enums when availableJosh Hejna
2018-07-05Fix integer_type to actually return integers all the time.Emilio Cobos Álvarez
blob() does care about alignment, so we can get into an architecture where there are integers where size != align. This is a tentative fix for https://github.com/servo/servo/issues/21093, though as mentioned there I couldn't find a repro on my machine.
2018-07-05ir: Don't assume wchar is 2 bytes.Emilio Cobos Álvarez
Fixes #1345
2018-07-01codegen: Prevent unused_mut warnings, and fix formatting issues.Emilio Cobos Álvarez
Followup to #1342
2018-06-28Fix bitfields on big-endian machines.Petr Sumbera
Fixes #1340
2018-06-13Fix typos.Bruce Mitchener
2018-06-04add --constified-enum to output consts when the default is changedDaniel Brooks
2018-06-04remove unnecessary as_refDaniel Brooks
2018-06-04Rename from "enum variant" to "enum style"Daniel Brooks
2018-06-03Add an option to set the default codegen style for all enumsDaniel Brooks
2018-05-16Handle pointer constness at the right level.Emilio Cobos Álvarez
2018-05-03codegen: Actually honor the new option for module_lines.Emilio Cobos Álvarez
Only when modules are enabled of course.
2018-04-08TemplateParameters.used_template_params doesn't return OptionTamir Duberstein