Skip to content

Commit 8d96425

Browse files
committed
Pass through parent_id to template instantiations to avoid conflicts
1 parent e611aff commit 8d96425

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

bindgen/ir/template.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ impl TemplateInstantiation {
215215
/// Parse a `TemplateInstantiation` from a clang `Type`.
216216
pub(crate) fn from_ty(
217217
ty: &clang::Type,
218+
parent_id: Option<ItemId>,
218219
ctx: &mut BindgenContext,
219220
) -> Option<TemplateInstantiation> {
220221
use clang_sys::*;
@@ -228,13 +229,15 @@ impl TemplateInstantiation {
228229
args.chain(canonical_args.skip(arg_count))
229230
.filter(|t| t.kind() != CXType_Invalid)
230231
.map(|t| {
231-
Item::from_ty_or_ref(t, t.declaration(), None, ctx)
232+
Item::from_ty_or_ref(t, t.declaration(), parent_id, ctx)
232233
})
233234
.collect()
234235
}
235236
None => args
236237
.filter(|t| t.kind() != CXType_Invalid)
237-
.map(|t| Item::from_ty_or_ref(t, t.declaration(), None, ctx))
238+
.map(|t| {
239+
Item::from_ty_or_ref(t, t.declaration(), parent_id, ctx)
240+
})
238241
.collect(),
239242
});
240243

bindgen/ir/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ impl Type {
746746
(ty.template_args().is_some() && ty_kind != CXType_Typedef)
747747
{
748748
// This is a template instantiation.
749-
match TemplateInstantiation::from_ty(ty, ctx) {
749+
match TemplateInstantiation::from_ty(ty, parent_id, ctx) {
750750
Some(inst) => TypeKind::TemplateInstantiation(inst),
751751
None => TypeKind::Opaque,
752752
}

0 commit comments

Comments
 (0)