diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-05-01 12:47:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-01 12:47:32 -0500 |
commit | 159dd69a01595548b10df5c1858e17c434adff74 (patch) | |
tree | c22c5b2cb5001ec97a6233e29cdd5660c3694db6 /src | |
parent | 46bb12ae13d3b88de71f24cde29827b50b830e3a (diff) | |
parent | b31fcb85f2c4c63a60c617b8d4c8c801444d6117 (diff) |
Auto merge of #675 - fitzgen:issue-674-stylo-template-parameters, r=emilio
Trace opaque types' template parameters and inner types
The template parameter usage analysis needs to see the template parameters'
definitions and have edges from any inner type to the parent in order to
propagate data flow through dependencies properly.
Fixes #674
r? @emilio
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/comp.rs | 15 | ||||
-rw-r--r-- | src/ir/ty.rs | 1 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/ir/comp.rs b/src/ir/comp.rs index 2711c3cf..91593b79 100644 --- a/src/ir/comp.rs +++ b/src/ir/comp.rs @@ -975,6 +975,17 @@ impl Trace for CompInfo { tracer.visit_kind(p, EdgeKind::TemplateParameterDefinition); } + for &ty in self.inner_types() { + tracer.visit_kind(ty, EdgeKind::InnerType); + } + + // We unconditionally trace `CompInfo`'s template parameters and inner + // types for the the usage analysis. However, we don't want to continue + // tracing anything else, if this type is marked opaque. + if item.is_opaque(context) { + return; + } + for base in self.base_members() { tracer.visit_kind(base.ty, EdgeKind::BaseMember); } @@ -983,10 +994,6 @@ impl Trace for CompInfo { tracer.visit_kind(field.ty(), EdgeKind::Field); } - for &ty in self.inner_types() { - tracer.visit_kind(ty, EdgeKind::InnerType); - } - for &var in self.inner_vars() { tracer.visit_kind(var, EdgeKind::InnerVar); } diff --git a/src/ir/ty.rs b/src/ir/ty.rs index 9fabf980..c3f26572 100644 --- a/src/ir/ty.rs +++ b/src/ir/ty.rs @@ -345,6 +345,7 @@ impl Type { /// item, so we can arrive to the proper item that needs to be generated. pub fn should_be_traced_unconditionally(&self) -> bool { match self.kind { + TypeKind::Comp(..) | TypeKind::Function(..) | TypeKind::Pointer(..) | TypeKind::Array(..) | |