Skip to content

Commit c54f78a

Browse files
mgudemannDaniel Kroening
authored and
Daniel Kroening
committed
take tautschnig's comments into account
1 parent 494436a commit c54f78a

File tree

6 files changed

+32
-33
lines changed

6 files changed

+32
-33
lines changed

src/java_bytecode/expr2java.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ std::string expr2javat::convert_code_function_call(
9595
first=false;
9696
else
9797
dest+=", ";
98-
// TODO: ggf. Klammern je nach p
98+
// TODO: if necessery add parentheses, dependent on p
9999
dest+=arg_str;
100100
}
101101
}

src/java_bytecode/java_bytecode_language.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,13 @@ bool java_bytecode_languaget::final(symbol_tablet &symbol_table)
239239

240240
symbolt entry=res.main_function;
241241

242-
if(java_entry_point(
243-
symbol_table,
244-
main_class,
245-
get_message_handler(),
246-
assume_inputs_non_null,
247-
max_nondet_array_length))
248-
return true;
249-
250-
return false;
242+
return(
243+
java_entry_point(
244+
symbol_table,
245+
main_class,
246+
get_message_handler(),
247+
assume_inputs_non_null,
248+
max_nondet_array_length));
251249
}
252250

253251
/*******************************************************************\

src/java_bytecode/java_bytecode_typecheck_expr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ void java_bytecode_typecheckt::typecheck_expr_java_new_array(
9494
static void escape_non_alnum(std::string& toescape)
9595
{
9696
for(auto &ch : toescape)
97-
if(!isalnum(ch))
98-
ch='_';
97+
if(!isalnum(ch))
98+
ch='_';
9999
}
100100

101101
/*******************************************************************\

src/java_bytecode/java_entry_point.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Author: Daniel Kroening, [email protected]
1010
#include <set>
1111
#include <iostream>
1212

13+
#include <util/arith_tools.h>
1314
#include <util/prefix.h>
1415
#include <util/std_types.h>
1516
#include <util/std_code.h>
@@ -71,18 +72,6 @@ static void create_initialize(symbol_tablet &symbol_table)
7172
}
7273

7374

74-
/*******************************************************************\
75-
76-
Function: java_static_lifetime_init
77-
78-
Inputs:
79-
80-
Outputs:
81-
82-
Purpose:
83-
84-
\*******************************************************************/
85-
8675
static bool should_init_symbol(const symbolt& sym)
8776
{
8877
if(sym.type.id()!=ID_code &&
@@ -95,6 +84,18 @@ static bool should_init_symbol(const symbolt& sym)
9584
return has_prefix(id2string(sym.name), "java::java.lang.String.Literal");
9685
}
9786

87+
/*******************************************************************\
88+
89+
Function: java_static_lifetime_init
90+
91+
Inputs:
92+
93+
Outputs:
94+
95+
Purpose:
96+
97+
\*******************************************************************/
98+
9899
bool java_static_lifetime_init(
99100
symbol_tablet &symbol_table,
100101
const source_locationt &source_location,
@@ -126,12 +127,11 @@ bool java_static_lifetime_init(
126127
std::string namestr=id2string(sym.symbol_expr().get_identifier());
127128
const std::string suffix="@class_model";
128129
// Static '.class' fields are always non-null.
129-
if(namestr.size()>=suffix.size() &&
130-
namestr.substr(namestr.size()-suffix.size())==suffix)
130+
if(has_suffix(namestr, suffix))
131131
allow_null=false;
132132
if(allow_null && has_prefix(
133-
namestr,
134-
"java::java.lang.String.Literal"))
133+
namestr,
134+
"java::java.lang.String.Literal"))
135135
allow_null=false;
136136
}
137137
auto newsym=object_factory(
@@ -208,7 +208,7 @@ exprt::operandst java_build_arguments(
208208
{
209209
bool is_this=(param_number==0) &&
210210
parameters[param_number].get_this();
211-
bool is_default_entry_point(config.main=="");
211+
bool is_default_entry_point(config.main.empty());
212212
bool is_main=is_default_entry_point;
213213
if(!is_main)
214214
{
@@ -244,7 +244,7 @@ exprt::operandst java_build_arguments(
244244
input.op0()=address_of_exprt(
245245
index_exprt(
246246
string_constantt(p_symbol.base_name),
247-
gen_zero(index_type())));
247+
from_integer(0, index_type())));
248248
input.op1()=main_arguments[param_number];
249249
input.add_source_location()=function.location;
250250

@@ -293,7 +293,7 @@ void java_record_outputs(
293293
address_of_exprt(
294294
index_exprt(
295295
string_constantt(return_symbol.base_name),
296-
gen_zero(index_type())));
296+
from_integer(0, index_type())));
297297
output.op1()=return_symbol.symbol_expr();
298298
output.add_source_location()=function.location;
299299

@@ -316,7 +316,7 @@ void java_record_outputs(
316316
address_of_exprt(
317317
index_exprt(
318318
string_constantt(p_symbol.base_name),
319-
gen_zero(index_type())));
319+
from_integer(0, index_type())));
320320
output.op1()=main_arguments[param_number];
321321
output.add_source_location()=function.location;
322322

src/java_bytecode/java_object_factory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ Function: new_tmp_symbol
514514

515515
symbolt &new_tmp_symbol(symbol_tablet &symbol_table, const std::string& prefix)
516516
{
517-
static size_t temporary_counter=0; // TODO change this
517+
static size_t temporary_counter=0; // TODO encapsulate as class variable
518518

519519
auxiliary_symbolt new_symbol;
520520
symbolt *symbol_ptr;

src/util/json_expr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Author: Peter Schrammel
1616
#include "config.h"
1717

1818
#include "json_expr.h"
19+
1920
/*******************************************************************\
2021
2122
Function: json

0 commit comments

Comments
 (0)