let object_of typ =
match Cil.unrollType typ with
| TInt(i,_) -> C_int (c_int i)
| TFloat(f,_) -> C_float (c_float f)
| TPtr(typ,_) ->
begin
match Cil.unrollType typ with
| TVoid _ -> C_pointer (TInt (IChar,[]))
| _ -> C_pointer typ
end
| TFun _ as t -> C_pointer t
| TEnum _ -> C_int (c_enum ())
| TComp (comp,_,_) -> C_comp comp
| TArray (typ_elt,e_opt,_,_) ->
begin
match e_opt with
| None ->
C_array {
arr_element = typ_elt;
arr_flat = None;
}
| Some e ->
let dim,ncells,ty_cell = dimension typ in
C_array {
arr_element = typ_elt ;
arr_flat = Some {
arr_size = constant e ;
arr_dim = dim ;
arr_cell = ty_cell ;
arr_cell_nbr = ncells ;
}
}
end
| TBuiltin_va_list _ ->
WpLog.not_yet_implemented "Access mode to val_list type"
| TVoid _ -> WpLog.fatal ~current:true "Access to void object"
| TNamed _ ->
WpLog.fatal "non-unrolled named type (%a)" !Ast_printer.d_type typ