@@ -770,65 +770,6 @@ codet java_string_library_preprocesst::
770
770
return code;
771
771
}
772
772
773
- // / \param type: type of the function called
774
- // / \param loc: location in the program
775
- // / \param symbol_table: symbol table
776
- // / \return code for the StringBuilder.append(Object) function: > string1 =
777
- // / arguments[1].toString() > string_expr1 = string_to_string_expr(string1) >
778
- // / string_expr2 = concat(this, string_expr1) > this =
779
- // / string_expr_to_string(string_expr2) > return this
780
- codet java_string_library_preprocesst::make_string_builder_append_object_code (
781
- const code_typet &type,
782
- const source_locationt &loc,
783
- symbol_tablet &symbol_table)
784
- {
785
- code_typet::parameterst params=type.parameters ();
786
- assert (params.size ()==1 );
787
- exprt this_obj=symbol_exprt (params[0 ].get_identifier (), params[0 ].type ());
788
-
789
- // Code to be returned
790
- code_blockt code;
791
-
792
- // String expression that will hold the result
793
- string_exprt string_expr1=fresh_string_expr (loc, symbol_table, code);
794
-
795
- exprt::operandst arguments=process_parameters (
796
- type.parameters (), loc, symbol_table, code);
797
- assert (arguments.size ()==2 );
798
-
799
- // > string1 = arguments[1].toString()
800
- exprt string1=fresh_string (this_obj.type (), loc, symbol_table);
801
- code_function_callt fun_call;
802
- fun_call.lhs ()=string1;
803
- // TODO: we should look in the symbol table for such a symbol
804
- fun_call.function ()=symbol_exprt (
805
- " java::java.lang.Object.toString:()Ljava/lang/String;" );
806
- fun_call.arguments ().push_back (arguments[1 ]);
807
- code_typet fun_type;
808
- fun_type.return_type ()=string1.type ();
809
- fun_call.function ().type ()=fun_type;
810
- code.add (fun_call);
811
-
812
- // > string_expr1 = string_to_string_expr(string1)
813
- code.add (code_assign_java_string_to_string_expr (
814
- string_expr1, string1, symbol_table));
815
-
816
- // > string_expr2 = concat(this, string1)
817
- exprt::operandst concat_arguments (arguments);
818
- concat_arguments[1 ]=string_expr1;
819
- string_exprt string_expr2=string_expr_of_function_application (
820
- ID_cprover_string_concat_func, concat_arguments, loc, symbol_table, code);
821
-
822
- // > this = string_expr
823
- code.add (code_assign_string_expr_to_java_string (
824
- this_obj, string_expr2, symbol_table));
825
-
826
- // > return this
827
- code.add (code_returnt (this_obj));
828
-
829
- return code;
830
- }
831
-
832
773
// / Used to provide code for the Java String.equals(Object) function.
833
774
// / \param type: type of the function call
834
775
// / \param loc: location in the program_invocation_name
@@ -856,71 +797,6 @@ codet java_string_library_preprocesst::make_equals_function_code(
856
797
return code;
857
798
}
858
799
859
- // / Used to provide code for the Java StringBuilder.append(F) function.
860
- // / \param type: type of the function call
861
- // / \param loc: location in the program_invocation_name
862
- // / \param symbol_table: symbol table
863
- // / \return Code corresponding to: > string1 = arguments[1].toString() >
864
- // / string_expr1 = string_to_string_expr(string1) > string_expr2 =
865
- // / concat(this, string_expr1) > this = string_expr_to_string(string_expr2) >
866
- // / return this
867
- codet java_string_library_preprocesst::make_string_builder_append_float_code (
868
- const code_typet &type,
869
- const source_locationt &loc,
870
- symbol_tablet &symbol_table)
871
- {
872
- code_typet::parameterst params=type.parameters ();
873
- assert (params.size ()==1 );
874
- exprt this_obj=symbol_exprt (params[0 ].get_identifier (), params[0 ].type ());
875
-
876
- // Getting types
877
- typet length_type=string_length_type ();
878
-
879
- // Code to be returned
880
- code_blockt code;
881
-
882
- // String expression that will hold the result
883
- refined_string_typet ref_type (length_type, java_char_type ());
884
- string_exprt string_expr1=fresh_string_expr (loc, symbol_table, code);
885
-
886
- exprt::operandst arguments=process_parameters (
887
- type.parameters (), loc, symbol_table, code);
888
- assert (arguments.size ()==2 );
889
-
890
- // > string1 = arguments[1].toString()
891
- exprt string1=fresh_string (this_obj.type (), loc, symbol_table);
892
- code_function_callt fun_call;
893
- fun_call.lhs ()=string1;
894
- // TODO: we should look in the symbol table for such a symbol
895
- fun_call.function ()=symbol_exprt (
896
- " java::java.lang.Float.toString:()Ljava/lang/String;" );
897
- fun_call.arguments ().push_back (arguments[1 ]);
898
- code_typet fun_type;
899
- fun_type.return_type ()=string1.type ();
900
- fun_call.function ().type ()=fun_type;
901
- code.add (fun_call);
902
-
903
- // > string_expr1 = string_to_string_expr(string1)
904
- code.add (code_assign_java_string_to_string_expr (
905
- string_expr1, string1, symbol_table));
906
-
907
- // > string_expr2 = concat(this, string1)
908
- exprt::operandst concat_arguments (arguments);
909
- concat_arguments[1 ]=string_expr1;
910
-
911
- string_exprt string_expr2=string_expr_of_function_application (
912
- ID_cprover_string_concat_func, concat_arguments, loc, symbol_table, code);
913
-
914
- // > this = string_expr
915
- code.add (code_assign_string_expr_to_java_string (
916
- this_obj, string_expr2, symbol_table));
917
-
918
- // > return this
919
- code.add (code_returnt (this_obj));
920
-
921
- return code;
922
- }
923
-
924
800
// / construct a Java string literal from a constant string value
925
801
// / \param s: a string
926
802
// / \return an expression representing a Java string literal with the given
@@ -1739,29 +1615,14 @@ void java_string_library_preprocesst::initialize_conversion_table()
1739
1615
cprover_equivalent_to_java_assign_and_return_function
1740
1616
[" java::java.lang.StringBuilder.append:(D)Ljava/lang/StringBuilder;" ]=
1741
1617
ID_cprover_string_concat_double_func;
1742
- conversion_table
1743
- [" java::java.lang.StringBuilder.append:(F)Ljava/lang/StringBuilder;" ]=
1744
- std::bind (
1745
- &java_string_library_preprocesst::make_string_builder_append_float_code,
1746
- this ,
1747
- std::placeholders::_1,
1748
- std::placeholders::_2,
1749
- std::placeholders::_3);
1750
- cprover_equivalent_to_java_assign_and_return_function
1751
- [" java::java.lang.StringBuilder.append:(I)Ljava/lang/StringBuilder;" ]=
1752
- ID_cprover_string_concat_int_func;
1753
- cprover_equivalent_to_java_assign_and_return_function
1754
- [" java::java.lang.StringBuilder.append:(J)Ljava/lang/StringBuilder;" ]=
1755
- ID_cprover_string_concat_long_func;
1756
-
1757
- conversion_table[" java::java.lang.StringBuilder.append:"
1758
- " (Ljava/lang/Object;)Ljava/lang/StringBuilder;" ]=
1759
- std::bind (
1760
- &java_string_library_preprocesst::make_string_builder_append_object_code,
1761
- this ,
1762
- std::placeholders::_1,
1763
- std::placeholders::_2,
1764
- std::placeholders::_3);
1618
+ // Not supported: "java.lang.StringBuilder.append:"
1619
+ // "(F)Ljava/lang/StringBuilder;"
1620
+ // Not supported: "java.lang.StringBuilder.append:(I)"
1621
+ // "Ljava/lang/StringBuilder;"
1622
+ // Not supported: "java.lang.StringBuilder.append:(J)"
1623
+ // "Ljava/lang/StringBuilder;"
1624
+ // Not supported: "java.lang.StringBuilder.append:"
1625
+ // "(Ljava/lang/Object;)Ljava/lang/StringBuilder;"
1765
1626
cprover_equivalent_to_java_assign_and_return_function
1766
1627
[" java::java.lang.StringBuilder.append:(Ljava/lang/String;)"
1767
1628
" Ljava/lang/StringBuilder;" ]=
0 commit comments