summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-08-14 14:10:08 -0500
committerGitHub <noreply@github.com>2017-08-14 14:10:08 -0500
commit492714c97cef6e9ebb1cc23414b419118b11fc64 (patch)
treee6ced412630b10e9ce925ba84aef20ff9dcd6200 /src
parent7e84c437015b5a4d73cb47baae629b8f357c1b2d (diff)
parent949ab272101a0c10da3d6d85458597318eb8d15b (diff)
Auto merge of #912 - fitzgen:only-run-analyses-if-needed, r=emilio
Only run analyses when we are going to use their results Currently, there are various analyses related to deriving various traits that we unconditionally run. However, if we aren't going to derive those traits in codegen, then computing whether or not we can derive the traits is wasteful. r? @emilio
Diffstat (limited to 'src')
-rw-r--r--src/ir/context.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ir/context.rs b/src/ir/context.rs
index edf320bf..750b9982 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -1804,7 +1804,9 @@ impl<'ctx> BindgenContext<'ctx> {
/// Compute whether we can derive debug.
fn compute_cannot_derive_debug(&mut self) {
assert!(self.cannot_derive_debug.is_none());
- self.cannot_derive_debug = Some(analyze::<CannotDeriveDebug>(self));
+ if self.options.derive_debug {
+ self.cannot_derive_debug = Some(analyze::<CannotDeriveDebug>(self));
+ }
}
/// Look up whether the item with `id` can
@@ -1821,7 +1823,9 @@ impl<'ctx> BindgenContext<'ctx> {
/// Compute whether we can derive default.
fn compute_cannot_derive_default(&mut self) {
assert!(self.cannot_derive_default.is_none());
- self.cannot_derive_default = Some(analyze::<CannotDeriveDefault>(self));
+ if self.options.derive_default {
+ self.cannot_derive_default = Some(analyze::<CannotDeriveDefault>(self));
+ }
}
/// Look up whether the item with `id` can
@@ -1844,7 +1848,9 @@ impl<'ctx> BindgenContext<'ctx> {
/// Compute whether we can derive hash.
fn compute_cannot_derive_hash(&mut self) {
assert!(self.cannot_derive_hash.is_none());
- self.cannot_derive_hash = Some(analyze::<CannotDeriveHash>(self));
+ if self.options.derive_hash {
+ self.cannot_derive_hash = Some(analyze::<CannotDeriveHash>(self));
+ }
}
/// Look up whether the item with `id` can