diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/comp.rs | 1 | ||||
-rw-r--r-- | src/ir/context.rs | 22 | ||||
-rw-r--r-- | src/ir/item.rs | 3 |
3 files changed, 16 insertions, 10 deletions
diff --git a/src/ir/comp.rs b/src/ir/comp.rs index fc17ab8f..e1b2a1f0 100644 --- a/src/ir/comp.rs +++ b/src/ir/comp.rs @@ -1152,6 +1152,7 @@ impl CompInfo { let inner = Item::parse(cur, Some(potential_id), ctx) .expect("Inner ClassDecl"); + assert_eq!(ctx.resolve_item(inner).parent_id(), potential_id); ci.inner_types.push(inner); diff --git a/src/ir/context.rs b/src/ir/context.rs index b540d152..5b6b46ef 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -751,25 +751,29 @@ impl BindgenContext { let typerefs = self.collect_typerefs(); for (id, ty, loc, parent_id) in typerefs { - let _resolved = - { - let resolved = Item::from_ty(&ty, loc, parent_id, self) + let _resolved = { + let resolved = Item::from_ty(&ty, loc, parent_id, self) .unwrap_or_else(|_| { warn!("Could not resolve type reference, falling back \ to opaque blob"); Item::new_opaque_type(self.next_item_id(), &ty, self) }); - let item = self.items.get_mut(&id).unwrap(); - *item.kind_mut().as_type_mut().unwrap().kind_mut() = - TypeKind::ResolvedTypeRef(resolved); - resolved - }; + let item = self.items.get_mut(&id).unwrap(); + *item.kind_mut().as_type_mut().unwrap().kind_mut() = + TypeKind::ResolvedTypeRef(resolved); + + resolved + }; // Something in the STL is trolling me. I don't need this assertion // right now, but worth investigating properly once this lands. // // debug_assert!(self.items.get(&resolved).is_some(), "How?"); + // + // if let Some(parent_id) = parent_id { + // assert_eq!(self.items[&resolved].parent_id(), parent_id); + // } } } @@ -953,7 +957,7 @@ impl BindgenContext { self.compute_bitfield_units(); self.process_replacements(); } - + self.deanonymize_fields(); // And assert once again, because resolving type refs and processing diff --git a/src/ir/item.rs b/src/ir/item.rs index 8a5a143b..955793c1 100644 --- a/src/ir/item.rs +++ b/src/ir/item.rs @@ -1216,7 +1216,8 @@ impl ClangItemParser for Item { ctx, )); } - parent_id.or_else(|| ctx.known_semantic_parent(definition)) + ctx.known_semantic_parent(definition) + .or(parent_id) .unwrap_or(ctx.current_module()) } None => relevant_parent_id, |