@@ -467,22 +467,22 @@ impl<'ctx> BindgenContext<'ctx> {
467
467
/// };
468
468
/// ```
469
469
fn build_template_wrapper ( & mut self ,
470
+ with_id : ItemId ,
470
471
wrapping : ItemId ,
471
472
parent_id : ItemId ,
472
473
ty : & clang:: Type ,
473
474
location : clang:: Cursor ) -> ItemId {
474
475
use clangll:: * ;
475
476
let mut args = vec ! [ ] ;
476
477
let mut found_invalid_template_ref = false ;
477
- let self_id = ItemId :: next ( ) ;
478
478
location. visit ( |c, _| {
479
479
if c. kind ( ) == CXCursor_TemplateRef &&
480
480
c. cur_type ( ) . kind ( ) == CXType_Invalid {
481
481
found_invalid_template_ref = true ;
482
482
}
483
483
if c. kind ( ) == CXCursor_TypeRef {
484
484
let new_ty =
485
- Item :: from_ty_or_ref ( c. cur_type ( ) , Some ( * c) , Some ( self_id ) , self ) ;
485
+ Item :: from_ty_or_ref ( c. cur_type ( ) , Some ( * c) , Some ( with_id ) , self ) ;
486
486
args. push ( new_ty) ;
487
487
}
488
488
CXChildVisit_Continue
@@ -528,17 +528,18 @@ impl<'ctx> BindgenContext<'ctx> {
528
528
let name = ty. spelling ( ) ;
529
529
let name = if name. is_empty ( ) { None } else { Some ( name) } ;
530
530
let ty = Type :: new ( name, ty. fallible_layout ( ) . ok ( ) , type_kind, ty. is_const ( ) ) ;
531
- Item :: new ( self_id , None , None , parent_id, ItemKind :: Type ( ty) )
531
+ Item :: new ( with_id , None , None , parent_id, ItemKind :: Type ( ty) )
532
532
} ;
533
533
534
534
// Bypass all the validations in add_item explicitly.
535
- self . items . insert ( self_id , item) ;
536
- self_id
535
+ self . items . insert ( with_id , item) ;
536
+ with_id
537
537
}
538
538
539
539
/// Looks up for an already resolved type, either because it's builtin, or
540
540
/// because we already have it in the map.
541
541
pub fn builtin_or_resolved_ty ( & mut self ,
542
+ with_id : ItemId ,
542
543
parent_id : Option < ItemId > ,
543
544
ty : & clang:: Type ,
544
545
location : Option < clang:: Cursor > ) -> Option < ItemId > {
@@ -567,6 +568,7 @@ impl<'ctx> BindgenContext<'ctx> {
567
568
if let Some ( id) = id {
568
569
debug ! ( "Already resolved ty {:?}, {:?}, {:?} {:?}" ,
569
570
id, declaration, ty, location) ;
571
+
570
572
// If the declaration existed, we *might* be done, but it's not
571
573
// the case for class templates, where the template arguments
572
574
// may vary.
@@ -582,11 +584,12 @@ impl<'ctx> BindgenContext<'ctx> {
582
584
* ty != canonical_declaration. cur_type ( ) &&
583
585
location. is_some ( ) && parent_id. is_some ( ) {
584
586
return Some (
585
- self . build_template_wrapper ( id, parent_id. unwrap ( ) , ty,
587
+ self . build_template_wrapper ( with_id, id,
588
+ parent_id. unwrap ( ) , ty,
586
589
location. unwrap ( ) ) ) ;
587
590
}
588
591
589
- return Some ( self . build_ty_wrapper ( id, parent_id, ty) ) ;
592
+ return Some ( self . build_ty_wrapper ( with_id , id, parent_id, ty) ) ;
590
593
}
591
594
}
592
595
@@ -602,19 +605,19 @@ impl<'ctx> BindgenContext<'ctx> {
602
605
// We should probably make the constness tracking separate, so it doesn't
603
606
// bloat that much, but hey, we already bloat the heck out of builtin types.
604
607
fn build_ty_wrapper ( & mut self ,
608
+ with_id : ItemId ,
605
609
wrapped_id : ItemId ,
606
610
parent_id : Option < ItemId > ,
607
611
ty : & clang:: Type ) -> ItemId {
608
- let id = ItemId :: next ( ) ;
609
612
let spelling = ty. spelling ( ) ;
610
613
let is_const = ty. is_const ( ) ;
611
614
let layout = ty. fallible_layout ( ) . ok ( ) ;
612
615
let type_kind = TypeKind :: ResolvedTypeRef ( wrapped_id) ;
613
616
let ty = Type :: new ( Some ( spelling) , layout, type_kind, is_const) ;
614
- let item = Item :: new ( id , None , None ,
617
+ let item = Item :: new ( with_id , None , None ,
615
618
parent_id. unwrap_or ( self . current_module ) , ItemKind :: Type ( ty) ) ;
616
619
self . add_builtin_item ( item) ;
617
- id
620
+ with_id
618
621
}
619
622
620
623
fn build_builtin_ty ( & mut self ,
0 commit comments