File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1159,6 +1159,8 @@ impl TypedAstContext {
11591159
11601160 // Remove references to removed decls that are held elsewhere.
11611161 self . c_decls_top . retain ( |x| self . c_decls . contains_key ( x) ) ;
1162+ self . prenamed_decls
1163+ . retain ( |x, _| self . c_decls . contains_key ( x) ) ;
11621164
11631165 if let Some ( main_id) = self . c_main {
11641166 if !self . c_decls . contains_key ( & main_id) {
Original file line number Diff line number Diff line change @@ -708,6 +708,10 @@ pub fn translate(
708708 None
709709 } ;
710710
711+ // Identify typedefs that name unnamed types and collapse the two declarations
712+ // into a single name and declaration, eliminating the typedef altogether.
713+ t. ast_context . set_prenamed_decls ( ) ;
714+
711715 // Headers often pull in declarations that are unused;
712716 // we simplify the translator output by omitting those.
713717 t. ast_context
@@ -737,10 +741,6 @@ pub fn translate(
737741 prefix_names ( & mut t, prefix) ;
738742 }
739743
740- // Identify typedefs that name unnamed types and collapse the two declarations
741- // into a single name and declaration, eliminating the typedef altogether.
742- t. ast_context . set_prenamed_decls ( ) ;
743-
744744 for ( & decl_id, & subdecl_id) in & t. ast_context . prenamed_decls {
745745 if let CDeclKind :: Typedef { ref name, .. } = t. ast_context [ decl_id] . kind {
746746 t. type_converter
You can’t perform that action at this time.
0 commit comments