Skip to content

Commit 7e176f7

Browse files
Make argument of instrument_code be of type codet
1 parent b0df38d commit 7e176f7

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/java_bytecode/java_bytecode_instrument.cpp

+7-8
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class java_bytecode_instrumentt:public messaget
3535
{
3636
}
3737

38-
void operator()(exprt &expr);
38+
void operator()(codet &code);
3939

4040
protected:
4141
symbol_table_baset &symbol_table;
@@ -69,7 +69,7 @@ class java_bytecode_instrumentt:public messaget
6969
const exprt &length,
7070
const source_locationt &original_loc);
7171

72-
void instrument_code(exprt &expr);
72+
void instrument_code(codet &code);
7373
void add_expr_instrumentation(code_blockt &block, const exprt &expr);
7474
void prepend_instrumentation(codet &code, code_blockt &instrumentation);
7575
optionalt<codet> instrument_expr(const exprt &expr);
@@ -358,9 +358,8 @@ void java_bytecode_instrumentt::prepend_instrumentation(
358358
/// Augments `expr` with instrumentation in the form of either
359359
/// assertions or runtime exceptions
360360
/// \param `expr` the expression to be instrumented
361-
void java_bytecode_instrumentt::instrument_code(exprt &expr)
361+
void java_bytecode_instrumentt::instrument_code(codet &code)
362362
{
363-
codet &code=to_code(expr);
364363
source_locationt old_source_location=code.source_location();
365364

366365
const irep_idt &statement=code.get_statement();
@@ -560,9 +559,9 @@ optionalt<codet> java_bytecode_instrumentt::instrument_expr(const exprt &expr)
560559

561560
/// Instruments `expr`
562561
/// \param expr: the expression to be instrumented
563-
void java_bytecode_instrumentt::operator()(exprt &expr)
562+
void java_bytecode_instrumentt::operator()(codet &code)
564563
{
565-
instrument_code(expr);
564+
instrument_code(code);
566565
}
567566

568567
/// Instruments the code attached to `symbol` with
@@ -591,7 +590,7 @@ void java_bytecode_instrument_symbol(
591590
"java_bytecode_instrument expects a code-typed symbol but was called with"
592591
" " + id2string(symbol.name) + " which has a value with an id of " +
593592
id2string(symbol.value.id()));
594-
instrument(symbol.value);
593+
instrument(to_code(symbol.value));
595594
}
596595

597596
/// Instruments all the code in the symbol_table with
@@ -624,5 +623,5 @@ void java_bytecode_instrument(
624623
// instrument(...) can add symbols to the table, so it's
625624
// not safe to hold a reference to a symbol across a call.
626625
for(const auto &symbol : symbols_to_instrument)
627-
instrument(symbol_table.get_writeable_ref(symbol).value);
626+
instrument(to_code(symbol_table.get_writeable_ref(symbol).value));
628627
}

0 commit comments

Comments
 (0)