summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-09-20Clean up comments about the `Can[Trivially]Derive*` traitsNick Fitzgerald
The whole "should be a no-op" thing isn't really true for all of the traits, especially in the face of black listing. Also further expounded on the differences between the trivial versions and normal versions.
2017-09-20Common method for whether function pointers can trivially derive traitsNick Fitzgerald
Again, this logic was getting copied all over the place, and it is nice to have a single canonical definition.
2017-09-20Factor array size vs Rust derive limit checking into a common methodNick Fitzgerald
We were copying it around and it will be easier if it is defined in one place.
2017-09-20Clean up some derive-related commentsNick Fitzgerald
Changing "partialeq" and "partialord" into "`PartialEq`" and "`PartialOrd`" where it makes sense.
2017-09-19Add large bitfield derive test and fix missing limitOliver Geller
2017-09-19Ensure all derive analyses check array limit on bitfieldsOliver Geller
2017-09-19Auto merge of #996 - alexeyzab:add-no-partialeq-command, r=fitzgenbors-servo
Add --no-partialeq <regex> flag Related to #965. - [x] Add a new RegexSet member to bindgen::Builder (similar to the whitelisted_types set). - [x] A Builder method to add strings to that RegexSet. - [x] Plumbing in src/options.rs to convert --no-partialeq <regex> CLI flags into invocations of the builder method. - [x] Make the MonotoneFramework::constrain function in src/ir/analysis/derive_partialeq.rs check if the given item is explicitly marked not to be Partialeq, and if so, insert it into the self.cannot_derive_partialeq set via return self.insert(id). - [x] Tests! - [x] When the no-partialeq type is transitively referenced by a whitelisted item - [x] When the no-partialeq type is explicitly whitelisted - [x] When the no-partialeq type is marked opaque This is my first pass at implementing this functionality, I haven't implemented the tests yet. I wanted to make sure I am on the right track, particularly when it comes to updating `MonotoneFramework::constrain`. r? @fitzgen
2017-09-19Add --no-partialeq <regex> flagAlexey Zabelin
- [x] Add a new RegexSet member to bindgen::Builder (similar to the whitelisted_types set). - [x] A Builder method to add strings to that RegexSet. - [x] Plumbing in src/options.rs to convert --no-partialeq <regex> CLI flags into invocations of the builder method. - [x] Make the MonotoneFramework::constrain function in src/ir/analysis/derive_partialeq.rs check if the given item is explicitly marked not to be Partialeq, and if so, insert it into the self.cannot_derive_partialeq set via return self.insert(id). - [x] Tests! - [x] When the no-partialeq type is transitively referenced by a whitelisted item - [x] When the no-partialeq type is explicitly whitelisted - [x] When the no-partialeq type is marked opaque Fixes #965
2017-09-19Fix panic on has_float None unwrapSergey Pepyakin
2017-09-19Clean.Sergey Pepyakin
2017-09-19Derive Ord when possibleSergey Pepyakin
2017-09-19Rename deriver_partial_eq_or_partial_ord.Sergey Pepyakin
2017-09-19Emit derive(PartialOrd)Sergey Pepyakin
2017-09-19derive_partialord in BindgenOptions and BuilderSergey Pepyakin
2017-09-19DerivePartialEq → DerivePartialEqOrPartialOrdSergey Pepyakin
2017-09-18Make BindgenOptions privateSergey Pepyakin
2017-09-15Depreciate `Builder::whitelisted_type`.Trevor Reiff
Closes #987 Also, we were making a call to the now deprecated `Builder::hide_type`, changed that over to call `Builder::blacklist_type.
2017-09-14Auto merge of #991 - alexeyzab:add-builder-blacklist-type, r=fitzgenbors-servo
Add a `Builder::blacklist_type` 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 r? @fitzgen
2017-09-14Auto merge of #990 - treiff:depreciate-whitelisted-function, r=fitzgenbors-servo
Depreciate whitelisted function. Closes #985 I also noticed a reference to `whitelisted_function` within the book, should this be updated as well? https://github.com/rust-lang-nursery/rust-bindgen/blob/a371de097f5e37eb01754525fb1e2029ca88b0be/book/src/whitelisting.md I've started to learn rust recently, so please let me know if there is anything I missed.
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-14Depreciate whitelisted function.Trevor Reiff
Closes #985
2017-09-13Make whitelisted_var consistant with CLI flagsOliver Geller
2017-09-11Make bindgen generate enums as constants by defaultCldfire
Also simplifies the logic that determines which enum variation gets chosen.
2017-09-07Auto merge of #956 - ↵bors-servo
fitzgen:document-no-recursive-whitelist-will-break-code, r=emilio Document that not recursively whitelisting is dangerous See #949 for context and motivation. r? @emilio
2017-09-07Don't duplicate large comments; just reference them insteadNick Fitzgerald
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-07Add a timer for rustfmt'ing the generated bindingsNick Fitzgerald
2017-09-07We can afford the exra cycles to use double precision floats hereNick Fitzgerald
;)
2017-09-07Fix units and formatting of time phasesNick Fitzgerald
Was previously printing seconds, but claiming it was milliseconds.
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-07Add the TypeKind name to the IR graphviz outputNick Fitzgerald
2017-09-07Document that not recursively whitelisting is dangerousNick Fitzgerald
See #949 for context and motivation.
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-06Do not derive things on opaque unionsNick Fitzgerald
Unions don't support deriving these things, even if there is only one variant (the opaque layout field).
2017-09-06Pessimistically assume that blacklisted types do not implement DefaultNick Fitzgerald
2017-09-06Reflect whitelisted status via color in graphviz dot filesNick Fitzgerald
This makes it so that whitelisted items and edges outgoing from them are black, while non-whitelisted items and their edges are gray.
2017-09-06Don't try and debug format blacklisted types when generating `impl Debug` blocksNick Fitzgerald
2017-09-06Be pessimistic about `derive(Debug)` and blacklisted typesNick Fitzgerald
2017-09-06Auto merge of #952 - mchlrhw:master, r=fitzgenbors-servo
Add `bindgen::Builder::derive_copy` Fixes https://github.com/rust-lang-nursery/rust-bindgen/issues/948
2017-09-06Check derive_copy optionmchlrhw
2017-09-06Add `bindgen::Builder::derive_copy`mchlrhw
2017-09-06ir: Pass the target to clang if it wasn't explicitly passed already.Emilio Cobos Álvarez
Fixes #942 Fixes #947
2017-09-05Do not derive Copy for blacklisted typesNick Fitzgerald
Presumably they are blacklisted because we can't understand them properly, so be pessimistic about what we can derive for it. Fixes #944.
2017-09-04ir: Fix definitions outside of base class manually tracking the correct parent.Emilio Cobos Álvarez
2017-09-04ir: When something has a definition, return unresolved type references until ↵Emilio Cobos Álvarez
we parse it. This ensures that we see all the relevant types that are defined when parsing the definition, avoiding problems like #888. Fixes #888
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-25Auto merge of #932 - bd339:has_destructor_fp, r=fitzgenbors-servo
Rewrite `has destructor` analysis as a fixed-point analysis Fixes #927 . Note that this creates a dependency between the "cannot derive copy" and "has destructor" analysis, i.e. the "has destructor" analysis must run before the "cannot derive copy" analysis, because "cannot derive copy" needs the results of "has destructor".