@@ -24,7 +24,7 @@ Date: April 2017
24
24
25
25
/* ******************************************************************\
26
26
27
- Function: java_string_library_preprocesst::check_java_type
27
+ Function: java_string_library_preprocesst::java_type_matches_tag
28
28
29
29
Inputs:
30
30
type - a type
@@ -35,7 +35,7 @@ Function: java_string_library_preprocesst::check_java_type
35
35
36
36
\*******************************************************************/
37
37
38
- bool java_string_library_preprocesst::check_java_type (
38
+ bool java_string_library_preprocesst::java_type_matches_tag (
39
39
const typet &type, const std::string &tag)
40
40
{
41
41
if (type.id ()==ID_symbol)
@@ -86,7 +86,7 @@ Function: java_string_library_preprocesst::is_java_string_type
86
86
bool java_string_library_preprocesst::is_java_string_type (
87
87
const typet &type)
88
88
{
89
- return check_java_type (type, " java.lang.String" );
89
+ return java_type_matches_tag (type, " java.lang.String" );
90
90
}
91
91
92
92
/* ******************************************************************\
@@ -102,7 +102,7 @@ Function: java_string_library_preprocesst::is_java_string_builder_type
102
102
bool java_string_library_preprocesst::is_java_string_builder_type (
103
103
const typet &type)
104
104
{
105
- return check_java_type (type, " java.lang.StringBuilder" );
105
+ return java_type_matches_tag (type, " java.lang.StringBuilder" );
106
106
}
107
107
108
108
/* ******************************************************************\
@@ -141,7 +141,7 @@ Function: java_string_library_preprocesst::is_java_string_buffer_type
141
141
bool java_string_library_preprocesst::is_java_string_buffer_type (
142
142
const typet &type)
143
143
{
144
- return check_java_type (type, " java.lang.StringBuffer" );
144
+ return java_type_matches_tag (type, " java.lang.StringBuffer" );
145
145
}
146
146
147
147
/* ******************************************************************\
@@ -180,7 +180,7 @@ Function: java_string_library_preprocesst::is_java_char_sequence_type
180
180
bool java_string_library_preprocesst::is_java_char_sequence_type (
181
181
const typet &type)
182
182
{
183
- return check_java_type (type, " java.lang.CharSequence" );
183
+ return java_type_matches_tag (type, " java.lang.CharSequence" );
184
184
}
185
185
186
186
/* ******************************************************************\
@@ -219,7 +219,7 @@ Function: java_string_library_preprocesst::is_java_char_array_type
219
219
bool java_string_library_preprocesst::is_java_char_array_type (
220
220
const typet &type)
221
221
{
222
- return check_java_type (type, " array[char]" );
222
+ return java_type_matches_tag (type, " array[char]" );
223
223
}
224
224
225
225
/* ******************************************************************\
@@ -318,6 +318,7 @@ void java_string_library_preprocesst::add_string_type(
318
318
symbolt string_symbol;
319
319
string_symbol.name =" java::" +id2string (class_name);
320
320
string_symbol.base_name =id2string (class_name);
321
+ string_symbol.pretty_name =id2string (class_name);
321
322
string_symbol.type =string_type;
322
323
string_symbol.is_type =true ;
323
324
@@ -374,6 +375,7 @@ void java_string_library_preprocesst::declare_function(
374
375
{
375
376
auxiliary_symbolt func_symbol;
376
377
func_symbol.base_name =function_name;
378
+ func_symbol.pretty_name =function_name;
377
379
func_symbol.is_static_lifetime =false ;
378
380
func_symbol.mode =ID_java;
379
381
func_symbol.name =function_name;
@@ -492,7 +494,7 @@ exprt::operandst java_string_library_preprocesst::process_operands(
492
494
}
493
495
else if (is_java_char_array_pointer_type (p.type ()))
494
496
{
495
- ops.push_back (process_char_array (p, loc, symbol_table, init_code));
497
+ ops.push_back (replace_char_array (p, loc, symbol_table, init_code));
496
498
}
497
499
else
498
500
{
@@ -504,7 +506,7 @@ exprt::operandst java_string_library_preprocesst::process_operands(
504
506
505
507
/* ******************************************************************\
506
508
507
- Function: java_string_library_preprocesst::process_operands_for_equals
509
+ Function: java_string_library_preprocesst::process_equals_function_operands
508
510
509
511
Inputs:
510
512
operands - a list of expressions
@@ -521,7 +523,8 @@ Function: java_string_library_preprocesst::process_operands_for_equals
521
523
522
524
\*******************************************************************/
523
525
524
- exprt::operandst java_string_library_preprocesst::process_operands_for_equals (
526
+ exprt::operandst
527
+ java_string_library_preprocesst::process_equals_function_operands (
525
528
const exprt::operandst &operands,
526
529
const source_locationt &loc,
527
530
symbol_tablet &symbol_table,
@@ -656,13 +659,13 @@ exprt java_string_library_preprocesst::get_data(
656
659
657
660
/* ******************************************************************\
658
661
659
- Function: string_refine_preprocesst::process_char_array
662
+ Function: string_refine_preprocesst::replace_char_array
660
663
661
664
Inputs:
662
665
array_pointer - an expression of type char array pointer
663
666
loc - location in the source
664
667
symbol_table - symbol table
665
- code - code block, in which some assignements will be added
668
+ code - code block, in which some assignments will be added
666
669
667
670
Output: a string expression
668
671
@@ -671,7 +674,7 @@ Function: string_refine_preprocesst::process_char_array
671
674
672
675
\*******************************************************************/
673
676
674
- string_exprt java_string_library_preprocesst::process_char_array (
677
+ string_exprt java_string_library_preprocesst::replace_char_array (
675
678
const exprt &array_pointer,
676
679
const source_locationt &loc,
677
680
symbol_tablet &symbol_table,
@@ -1234,7 +1237,7 @@ Function: java_string_library_preprocesst::make_equals_code
1234
1237
1235
1238
\*******************************************************************/
1236
1239
1237
- codet java_string_library_preprocesst::make_equals_code (
1240
+ codet java_string_library_preprocesst::make_equals_function_code (
1238
1241
const code_typet &type,
1239
1242
const source_locationt &loc,
1240
1243
symbol_tablet &symbol_table)
@@ -1247,7 +1250,7 @@ codet java_string_library_preprocesst::make_equals_code(
1247
1250
symbol_exprt sym (p.get_identifier (), p.type ());
1248
1251
ops.push_back (sym);
1249
1252
}
1250
- exprt::operandst args=process_operands_for_equals (
1253
+ exprt::operandst args=process_equals_function_operands (
1251
1254
ops, loc, symbol_table, code);
1252
1255
code.copy_to_operands (code_return_function_application (
1253
1256
ID_cprover_string_equal_func, args, type.return_type (), symbol_table));
@@ -1714,7 +1717,7 @@ codet java_string_library_preprocesst::make_function_from_call(
1714
1717
> string = string_expr_to_string(string)
1715
1718
> return string
1716
1719
1717
- Purpose: Povide code for a function that calls a function from the
1720
+ Purpose: Provide code for a function that calls a function from the
1718
1721
solver and return the string_expr result as a Java string.
1719
1722
1720
1723
\*******************************************************************/
@@ -1785,8 +1788,8 @@ exprt java_string_library_preprocesst::code_for_function(
1785
1788
return make_string_returning_function_from_call (
1786
1789
it_id->second , type, loc, symbol_table);
1787
1790
1788
- it_id=cprover_equivalent_to_java_initialization_function .find (function_id);
1789
- if (it_id!=cprover_equivalent_to_java_initialization_function .end ())
1791
+ it_id=cprover_equivalent_to_java_constructor .find (function_id);
1792
+ if (it_id!=cprover_equivalent_to_java_constructor .end ())
1790
1793
return make_init_function_from_call (
1791
1794
it_id->second , type, loc, symbol_table);
1792
1795
@@ -1809,36 +1812,29 @@ exprt java_string_library_preprocesst::code_for_function(
1809
1812
1810
1813
/* ******************************************************************\
1811
1814
1812
- Function: java_string_library_preprocesst::add_string_type_success
1815
+ Function: java_string_library_preprocesst::is_known_string_type
1813
1816
1814
1817
Inputs:
1815
1818
class_name - name of the class
1816
- symbol_table - a symbol table
1817
1819
1818
1820
Outputs: True if the type is one that is known to our preprocessing,
1819
1821
false otherwise
1820
1822
1821
- Purpose: Declare a class for String types that are used in the program
1823
+ Purpose: Check whether a class name is known as a string type.
1822
1824
1823
1825
\*******************************************************************/
1824
1826
1825
- bool java_string_library_preprocesst::add_string_type_success (
1826
- irep_idt class_name, symbol_tablet &symbol_table )
1827
+ bool java_string_library_preprocesst::is_known_string_type (
1828
+ irep_idt class_name)
1827
1829
{
1828
- if (string_types.find (class_name)!=string_types.end ())
1829
- {
1830
- add_string_type (class_name, symbol_table);
1831
- return true ;
1832
- }
1833
- else
1834
- return false ;
1830
+ return string_types.find (class_name)!=string_types.end ();
1835
1831
}
1836
1832
1837
1833
/* ******************************************************************\
1838
1834
1839
1835
Function: java_string_library_preprocesst::initialize_conversion_table
1840
1836
1841
- Purpose: fill maps with correspondance from java method names to
1837
+ Purpose: fill maps with correspondence from java method names to
1842
1838
conversion functions
1843
1839
1844
1840
\*******************************************************************/
@@ -1854,19 +1850,19 @@ void java_string_library_preprocesst::initialize_conversion_table()
1854
1850
" java.lang.StringBuffer" };
1855
1851
1856
1852
// String library
1857
- cprover_equivalent_to_java_initialization_function
1853
+ cprover_equivalent_to_java_constructor
1858
1854
[" java::java.lang.String.<init>:(Ljava/lang/String;)V" ]=
1859
1855
ID_cprover_string_copy_func;
1860
- cprover_equivalent_to_java_initialization_function
1856
+ cprover_equivalent_to_java_constructor
1861
1857
[" java::java.lang.String.<init>:(Ljava/lang/StringBuilder;)V" ]=
1862
1858
ID_cprover_string_copy_func;
1863
- cprover_equivalent_to_java_initialization_function
1859
+ cprover_equivalent_to_java_constructor
1864
1860
[" java::java.lang.String.<init>:([C)V" ]=
1865
1861
ID_cprover_string_copy_func;
1866
- cprover_equivalent_to_java_initialization_function
1862
+ cprover_equivalent_to_java_constructor
1867
1863
[" java::java.lang.String.<init>:([CII)V" ]=
1868
1864
ID_cprover_string_copy_func;
1869
- cprover_equivalent_to_java_initialization_function
1865
+ cprover_equivalent_to_java_constructor
1870
1866
[" java::java.lang.String.<init>:()V" ]=
1871
1867
ID_cprover_string_empty_string_func;
1872
1868
// Not supported java.lang.String.<init>:(Ljava/lang/StringBuffer;)
@@ -1905,7 +1901,7 @@ void java_string_library_preprocesst::initialize_conversion_table()
1905
1901
1906
1902
conversion_table[" java::java.lang.String.equals:(Ljava/lang/Object;)Z" ]=
1907
1903
std::bind (
1908
- &java_string_library_preprocesst::make_equals_code ,
1904
+ &java_string_library_preprocesst::make_equals_function_code ,
1909
1905
this ,
1910
1906
std::placeholders::_1,
1911
1907
std::placeholders::_2,
@@ -2026,10 +2022,10 @@ void java_string_library_preprocesst::initialize_conversion_table()
2026
2022
// Not supported "java.lang.String.valueOf:(LObject;)"
2027
2023
2028
2024
// StringBuilder library
2029
- cprover_equivalent_to_java_initialization_function
2025
+ cprover_equivalent_to_java_constructor
2030
2026
[" java::java.lang.StringBuilder.<init>:(Ljava/lang/String;)V" ]=
2031
2027
ID_cprover_string_copy_func;
2032
- cprover_equivalent_to_java_initialization_function
2028
+ cprover_equivalent_to_java_constructor
2033
2029
[" java::java.lang.StringBuilder.<init>:()V" ]=
2034
2030
ID_cprover_string_empty_string_func;
2035
2031
@@ -2156,10 +2152,10 @@ void java_string_library_preprocesst::initialize_conversion_table()
2156
2152
// TODO clean irep ids from insert_char_array etc...
2157
2153
2158
2154
// StringBuffer library
2159
- cprover_equivalent_to_java_initialization_function
2155
+ cprover_equivalent_to_java_constructor
2160
2156
[" java::java.lang.StringBuffer.<init>:(Ljava/lang/String;)V" ]=
2161
2157
ID_cprover_string_copy_func;
2162
- cprover_equivalent_to_java_initialization_function
2158
+ cprover_equivalent_to_java_constructor
2163
2159
[" java::java.lang.StringBuffer.<init>:()V" ]=
2164
2160
ID_cprover_string_empty_string_func;
2165
2161
0 commit comments