File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
c2rust-transpile/src/c_ast Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,14 @@ impl ConversionContext {
437437 self . typed_context . comments . push ( comment) ;
438438 }
439439
440+ // Add Rust fixed-size types.
441+ for rust_type_kind in CTypeKind :: PULLBACK_KINDS {
442+ let new_id = self . id_mapper . fresh_id ( ) ;
443+ self . add_type ( new_id, not_located ( rust_type_kind) ) ;
444+ self . processed_nodes
445+ . insert ( new_id, self :: node_types:: OTHER_TYPE ) ;
446+ }
447+
440448 // Continue popping Clang nodes off of the stack of nodes we have promised to visit
441449 while let Some ( ( node_id, expected_ty) ) = self . visit_as . pop ( ) {
442450 // Check if we've already processed this node. If so, ascertain that it has the right
Original file line number Diff line number Diff line change @@ -464,6 +464,12 @@ impl TypedAstContext {
464464 ty. map ( |ty| ( expr_id, ty) )
465465 }
466466
467+ pub fn type_for_kind ( & self , kind : CTypeKind ) -> Option < CTypeId > {
468+ self . c_types
469+ . iter ( )
470+ . find_map ( |( id, k) | if kind == k. kind { Some ( * id) } else { None } )
471+ }
472+
467473 pub fn resolve_type_id ( & self , typ : CTypeId ) -> CTypeId {
468474 use CTypeKind :: * ;
469475 let ty = match self . index ( typ) . kind {
You can’t perform that action at this time.
0 commit comments