@@ -117,7 +117,19 @@ static std::string escape_non_alnum(const std::string &toescape)
117
117
return escaped.str ();
118
118
}
119
119
120
- static array_exprt utf16_to_array (const std::wstring& in)
120
+ /* ******************************************************************\
121
+
122
+ Function: utf16_to_array
123
+
124
+ Inputs: `in`: wide string to convert
125
+
126
+ Outputs: Returns a Java char array containing the same wchars.
127
+
128
+ Purpose: Convert UCS-2 or UTF-16 to an array expression.
129
+
130
+ \*******************************************************************/
131
+
132
+ static array_exprt utf16_to_array (const std::wstring &in)
121
133
{
122
134
const auto jchar=java_char_type ();
123
135
array_exprt ret (array_typet (jchar, infinity_exprt (java_int_type ())));
@@ -168,15 +180,18 @@ void java_bytecode_typecheckt::typecheck_expr_java_string_literal(exprt &expr)
168
180
// Regardless of string refinement setting, at least initialize
169
181
// the literal with @clsid = String and @lock = false:
170
182
symbol_typet jlo_symbol (" java::java.lang.Object" );
171
- const auto & jlo_struct=to_struct_type (ns.follow (jlo_symbol));
183
+ const auto & jlo_struct=to_struct_type (ns.follow (jlo_symbol));
172
184
struct_exprt jlo_init (jlo_symbol);
173
- const auto & jls_struct=to_struct_type (ns.follow (string_type));
185
+ const auto & jls_struct=to_struct_type (ns.follow (string_type));
174
186
175
187
jlo_init.copy_to_operands (
176
- constant_exprt (" java::java.lang.String" ,
177
- jlo_struct.components ()[0 ].type ()));
188
+ constant_exprt (
189
+ " java::java.lang.String" ,
190
+ jlo_struct.components ()[0 ].type ()));
178
191
jlo_init.copy_to_operands (
179
- from_integer (0 , jlo_struct.components ()[1 ].type ()));
192
+ from_integer (
193
+ 0 ,
194
+ jlo_struct.components ()[1 ].type ()));
180
195
181
196
// If string refinement *is* around, populate the actual
182
197
// contents as well:
@@ -185,7 +200,7 @@ void java_bytecode_typecheckt::typecheck_expr_java_string_literal(exprt &expr)
185
200
struct_exprt literal_init (new_symbol.type );
186
201
literal_init.move_to_operands (jlo_init);
187
202
188
- // Initialise the string with a constant utf-16 array:
203
+ // Initialize the string with a constant utf-16 array:
189
204
symbolt array_symbol;
190
205
array_symbol.name =escaped_symbol_name+" _constarray" ;
191
206
array_symbol.type =array_typet (
@@ -203,7 +218,7 @@ void java_bytecode_typecheckt::typecheck_expr_java_string_literal(exprt &expr)
203
218
array_symbol.value =literal_array;
204
219
205
220
if (symbol_table.add (array_symbol))
206
- throw " failed to add constarray symbol to symtab " ;
221
+ throw " failed to add constarray symbol to symbol table " ;
207
222
208
223
literal_init.copy_to_operands (
209
224
from_integer (literal_array.operands ().size (),
0 commit comments