@@ -21,7 +21,8 @@ use self::struct_layout::StructLayoutTracker;
2121use  super :: BindgenOptions ; 
2222
2323use  crate :: callbacks:: { 
24-     AttributeInfo ,  DeriveInfo ,  FieldInfo ,  TypeKind  as  DeriveTypeKind , 
24+     AttributeInfo ,  DeriveInfo ,  DiscoveredItem ,  DiscoveredItemId ,  FieldInfo , 
25+     TypeKind  as  DeriveTypeKind , 
2526} ; 
2627use  crate :: codegen:: error:: Error ; 
2728use  crate :: ir:: analysis:: { HasVtable ,  Sizedness } ; 
@@ -982,6 +983,18 @@ impl CodeGenerator for Type {
982983
983984                let  rust_name = ctx. rust_ident ( & name) ; 
984985
986+                 ctx. options ( ) . for_each_callback ( |cb| { 
987+                     cb. new_item_found ( 
988+                         DiscoveredItemId ( item. id ( ) . as_usize ( ) ) , 
989+                         DiscoveredItem :: Alias  { 
990+                             alias_name :  rust_name. to_string ( ) , 
991+                             alias_for :  DiscoveredItemId ( 
992+                                 inner_item. id ( ) . as_usize ( ) , 
993+                             ) , 
994+                         } , 
995+                     ) ; 
996+                 } ) ; 
997+ 
985998                let  mut  tokens = if  let  Some ( comment)  = item. comment ( ctx)  { 
986999                    attributes:: doc ( comment) 
9871000                }  else  { 
@@ -2374,6 +2387,24 @@ impl CodeGenerator for CompInfo {
23742387
23752388        let  is_rust_union = is_union && struct_layout. is_rust_union ( ) ; 
23762389
2390+         ctx. options ( ) . for_each_callback ( |cb| { 
2391+             let  discovered_item = match  self . kind ( )  { 
2392+                 CompKind :: Struct  => DiscoveredItem :: Struct  { 
2393+                     original_name :  item. kind ( ) . expect_type ( ) . name ( ) , 
2394+                     final_name :  canonical_ident. to_string ( ) , 
2395+                 } , 
2396+                 CompKind :: Union  => DiscoveredItem :: Union  { 
2397+                     original_name :  item. kind ( ) . expect_type ( ) . name ( ) , 
2398+                     final_name :  canonical_ident. to_string ( ) , 
2399+                 } , 
2400+             } ; 
2401+ 
2402+             cb. new_item_found ( 
2403+                 DiscoveredItemId ( item. id ( ) . as_usize ( ) ) , 
2404+                 discovered_item, 
2405+             ) ; 
2406+         } ) ; 
2407+ 
23772408        // The custom derives callback may return a list of derive attributes; 
23782409        // add them to the end of the list. 
23792410        let  custom_derives = ctx. options ( ) . all_callbacks ( |cb| { 
0 commit comments