Skip to content

Commit 608c5e3

Browse files
committed
take comments into account
1 parent 360ff4d commit 608c5e3

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ class java_bytecode_convert_methodt:public messaget
108108
INST_INDEX_CONST=3
109109
} instruction_sizet;
110110

111+
codet get_array_bounds_check(
112+
const exprt &arraystruct,
113+
const exprt &idx,
114+
const source_locationt& original_sloc);
115+
111116
// return corresponding reference of variable
112117
const variablet &find_variable_for_slot(
113118
size_t address,
@@ -672,7 +677,7 @@ static member_exprt to_member(const exprt &pointer, const exprt &fieldref)
672677
fieldref.type());
673678
}
674679

675-
codet get_array_bounds_check(
680+
codet java_bytecode_convert_methodt::get_array_bounds_check(
676681
const exprt &arraystruct,
677682
const exprt &idx,
678683
const source_locationt& original_sloc)
@@ -681,22 +686,24 @@ codet get_array_bounds_check(
681686
binary_relation_exprt gezero(idx, ID_ge, intzero);
682687
const member_exprt length_field(arraystruct, "length", java_int_type());
683688
binary_relation_exprt ltlength(idx, ID_lt, length_field);
684-
code_blockt boundschecks;
685-
boundschecks.add(code_assertt(gezero));
686-
boundschecks.operands().back().add_source_location()=original_sloc;
687-
boundschecks.operands().back().add_source_location()
689+
code_blockt bounds_checks;
690+
691+
bounds_checks.add(code_assertt(gezero));
692+
bounds_checks.operands().back().add_source_location()=original_sloc;
693+
bounds_checks.operands().back().add_source_location()
688694
.set_comment("Array index < 0");
689-
boundschecks.operands().back().add_source_location()
695+
bounds_checks.operands().back().add_source_location()
690696
.set_property_class("array-index-oob-low");
691-
boundschecks.add(code_assertt(ltlength));
692-
boundschecks.operands().back().add_source_location()=original_sloc;
693-
boundschecks.operands().back().add_source_location()
697+
bounds_checks.add(code_assertt(ltlength));
698+
699+
bounds_checks.operands().back().add_source_location()=original_sloc;
700+
bounds_checks.operands().back().add_source_location()
694701
.set_comment("Array index >= length");
695-
boundschecks.operands().back().add_source_location()
702+
bounds_checks.operands().back().add_source_location()
696703
.set_property_class("array-index-oob-high");
697704

698705
// TODO make this throw ArrayIndexOutOfBoundsException instead of asserting.
699-
return boundschecks;
706+
return bounds_checks;
700707
}
701708

702709
/*******************************************************************\
@@ -1235,7 +1242,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
12351242
{
12361243
// Remember that this is triggered by an assertion
12371244
if(statement=="invokespecial" &&
1238-
as_string(arg0.get(ID_identifier))
1245+
id2string(arg0.get(ID_identifier))
12391246
.find("AssertionError")!=std::string::npos)
12401247
{
12411248
assertion_failure=true;

src/java_bytecode/java_entry_point.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ exprt::operandst java_build_arguments(
210210
{
211211
bool is_this=(param_number==0) &&
212212
parameters[param_number].get_this();
213-
bool is_default_entry_point=config.main=="";
213+
bool is_default_entry_point(config.main=="");
214214
bool is_main=is_default_entry_point;
215215
if(!is_main)
216216
{

0 commit comments

Comments
 (0)