diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-01-19 08:15:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-19 08:15:31 -0800 |
commit | 36547ae216181fbcb1e3ec197e931ded17428e4c (patch) | |
tree | 1eab1c4c397b55b2d0cbf6ed95fd19150134fb1d /libbindgen/src | |
parent | 77278fc0ea94de171ee93a1a6b0a8a9d7eeed052 (diff) | |
parent | e6a9291cb089da2a2b252f78658d125ffcd48802 (diff) |
Auto merge of #397 - emilio:trace-vars, r=fitzgen
ir: Trace types across vars.
r? @fitzgen
Diffstat (limited to 'libbindgen/src')
-rw-r--r-- | libbindgen/src/ir/comp.rs | 4 | ||||
-rw-r--r-- | libbindgen/src/ir/context.rs | 5 | ||||
-rw-r--r-- | libbindgen/src/ir/item.rs | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/libbindgen/src/ir/comp.rs b/libbindgen/src/ir/comp.rs index 70dfd4a6..6dfa1ece 100644 --- a/libbindgen/src/ir/comp.rs +++ b/libbindgen/src/ir/comp.rs @@ -971,6 +971,10 @@ impl TypeCollector for CompInfo { types.insert(ty); } + for &var in self.inner_vars() { + types.insert(var); + } + // FIXME(emilio): Methods, VTable? } } diff --git a/libbindgen/src/ir/context.rs b/libbindgen/src/ir/context.rs index 06137672..b0143bd5 100644 --- a/libbindgen/src/ir/context.rs +++ b/libbindgen/src/ir/context.rs @@ -1256,8 +1256,9 @@ impl<'ctx, 'gen> Iterator for AssertNoDanglingItemIter<'ctx, 'gen> } for sub_id in sub_types { - if let Some(value) = self.seen.insert(id, sub_id) { - self.to_iterate.push_back(value); + if self.seen.insert(sub_id, id).is_none() { + // We've never visited this sub item before. + self.to_iterate.push_back(sub_id); } } diff --git a/libbindgen/src/ir/item.rs b/libbindgen/src/ir/item.rs index 3810bc2f..df8fd222 100644 --- a/libbindgen/src/ir/item.rs +++ b/libbindgen/src/ir/item.rs @@ -202,6 +202,9 @@ impl TypeCollector for Item { // be opaque, so we trace across it. types.insert(fun.signature()); } + ItemKind::Var(ref var) => { + types.insert(var.ty()); + } _ => {} // FIXME. } } |