|
33 | 33 | #include <ansi-c/string_constant.h>
|
34 | 34 |
|
35 | 35 | #include "format_strings.h"
|
| 36 | +#include "class_identifier.h" |
36 | 37 |
|
37 | 38 | void goto_convertt::do_prob_uniform(
|
38 | 39 | const exprt &lhs,
|
@@ -539,68 +540,6 @@ void goto_convertt::do_cpp_new(
|
539 | 540 | dest.destructive_append(tmp_initializer);
|
540 | 541 | }
|
541 | 542 |
|
542 |
| -void set_class_identifier( |
543 |
| - struct_exprt &expr, |
544 |
| - const namespacet &ns, |
545 |
| - const symbol_typet &class_type) |
546 |
| -{ |
547 |
| - const struct_typet &struct_type= |
548 |
| - to_struct_type(ns.follow(expr.type())); |
549 |
| - const struct_typet::componentst &components=struct_type.components(); |
550 |
| - |
551 |
| - if(components.empty()) |
552 |
| - return; |
553 |
| - assert(!expr.operands().empty()); |
554 |
| - |
555 |
| - if(components.front().get_name()=="@class_identifier") |
556 |
| - { |
557 |
| - assert(expr.op0().id()==ID_constant); |
558 |
| - expr.op0()=constant_exprt(class_type.get_identifier(), string_typet()); |
559 |
| - } |
560 |
| - else |
561 |
| - { |
562 |
| - assert(expr.op0().id()==ID_struct); |
563 |
| - set_class_identifier(to_struct_expr(expr.op0()), ns, class_type); |
564 |
| - } |
565 |
| -} |
566 |
| - |
567 |
| -void goto_convertt::do_java_new( |
568 |
| - const exprt &lhs, |
569 |
| - const side_effect_exprt &rhs, |
570 |
| - goto_programt &dest) |
571 |
| -{ |
572 |
| - PRECONDITION(!lhs.is_nil()); |
573 |
| - PRECONDITION(rhs.operands().empty()); |
574 |
| - PRECONDITION(rhs.type().id() == ID_pointer); |
575 |
| - source_locationt location=rhs.source_location(); |
576 |
| - typet object_type=rhs.type().subtype(); |
577 |
| - |
578 |
| - // build size expression |
579 |
| - exprt object_size=size_of_expr(object_type, ns); |
580 |
| - CHECK_RETURN(object_size.is_not_nil()); |
581 |
| - |
582 |
| - // we produce a malloc side-effect, which stays |
583 |
| - side_effect_exprt malloc_expr(ID_allocate); |
584 |
| - malloc_expr.copy_to_operands(object_size); |
585 |
| - // could use true and get rid of the code below |
586 |
| - malloc_expr.copy_to_operands(false_exprt()); |
587 |
| - malloc_expr.type()=rhs.type(); |
588 |
| - |
589 |
| - goto_programt::targett t_n=dest.add_instruction(ASSIGN); |
590 |
| - t_n->code=code_assignt(lhs, malloc_expr); |
591 |
| - t_n->source_location=location; |
592 |
| - |
593 |
| - // zero-initialize the object |
594 |
| - dereference_exprt deref(lhs, object_type); |
595 |
| - exprt zero_object= |
596 |
| - zero_initializer(object_type, location, ns, get_message_handler()); |
597 |
| - set_class_identifier( |
598 |
| - to_struct_expr(zero_object), ns, to_symbol_type(object_type)); |
599 |
| - goto_programt::targett t_i=dest.add_instruction(ASSIGN); |
600 |
| - t_i->code=code_assignt(deref, zero_object); |
601 |
| - t_i->source_location=location; |
602 |
| -} |
603 |
| - |
604 | 543 | void goto_convertt::do_java_new_array(
|
605 | 544 | const exprt &lhs,
|
606 | 545 | const side_effect_exprt &rhs,
|
|
0 commit comments