Skip to content

Commit 9d69f68

Browse files
author
Daniel Kroening
authored
Merge pull request #3267 from diffblue/type_code_declt
Type the operand of code_declt
2 parents 1a44efa + e889df7 commit 9d69f68

16 files changed

+40
-46
lines changed

jbmc/src/java_bytecode/java_string_library_preprocess.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ void add_pointer_to_array_association(
683683
loc,
684684
ID_java,
685685
symbol_table);
686-
exprt return_expr = return_sym.symbol_expr();
686+
auto return_expr = return_sym.symbol_expr();
687687
code.add(code_declt(return_expr), loc);
688688
code.add(
689689
code_assign_function_application(
@@ -715,7 +715,7 @@ void add_array_to_length_association(
715715
loc,
716716
ID_java,
717717
symbol_table);
718-
const exprt return_expr = return_sym.symbol_expr();
718+
const auto return_expr = return_sym.symbol_expr();
719719
code.add(code_declt(return_expr), loc);
720720
code.add(
721721
code_assign_function_application(
@@ -747,7 +747,7 @@ void add_character_set_constraint(
747747
PRECONDITION(pointer.type().id() == ID_pointer);
748748
symbolt &return_sym = get_fresh_aux_symbol(
749749
java_int_type(), "cnstr_added", "cnstr_added", loc, ID_java, symbol_table);
750-
const exprt return_expr = return_sym.symbol_expr();
750+
const auto return_expr = return_sym.symbol_expr();
751751
code.add(code_declt(return_expr), loc);
752752
const constant_exprt char_set_expr(char_set, string_typet());
753753
code.add(
@@ -790,7 +790,7 @@ refined_string_exprt java_string_library_preprocesst::string_expr_of_function(
790790
loc,
791791
ID_java,
792792
symbol_table);
793-
const exprt return_code = return_code_sym.symbol_expr();
793+
const auto return_code = return_code_sym.symbol_expr();
794794
code.add(code_declt(return_code), loc);
795795

796796
const refined_string_exprt string_expr =
@@ -1232,7 +1232,7 @@ exprt java_string_library_preprocesst::get_primitive_value_of_object(
12321232
std::string aux_name="tmp_"+id2string(type_name);
12331233
symbolt symbol=get_fresh_aux_symbol(
12341234
value_type, aux_name, aux_name, loc, ID_java, symbol_table);
1235-
exprt value=symbol.symbol_expr();
1235+
auto value = symbol.symbol_expr();
12361236

12371237
// Check that the type of the object is in the symbol table,
12381238
// otherwise there is no safe way of finding its value.
@@ -1340,8 +1340,9 @@ exprt java_string_library_preprocesst::make_argument_for_format(
13401340
std::string tmp_name="tmp_"+id2string(name);
13411341
symbolt field_symbol = get_fresh_aux_symbol(
13421342
type, id2string(function_id), tmp_name, loc, ID_java, symbol_table);
1343-
field_expr=field_symbol.symbol_expr();
1344-
code.add(code_declt(field_expr), loc);
1343+
auto field_symbol_expr = field_symbol.symbol_expr();
1344+
field_expr = field_symbol_expr;
1345+
code.add(code_declt(field_symbol_expr), loc);
13451346
}
13461347
else
13471348
field_expr =

src/analyses/constant_propagator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void constant_propagator_domaint::transform(
9393
if(from->is_decl())
9494
{
9595
const code_declt &code_decl=to_code_decl(from->code);
96-
const symbol_exprt &symbol=to_symbol_expr(code_decl.symbol());
96+
const symbol_exprt &symbol = code_decl.symbol();
9797
values.set_to_top(symbol);
9898
}
9999
else if(from->is_assign())

src/analyses/locals.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ void localst::build(const goto_functiont &goto_function)
2121
if(it->is_decl())
2222
{
2323
const code_declt &code_decl=to_code_decl(it->code);
24-
locals_map[code_decl.get_identifier()]=
25-
to_symbol_expr(code_decl.symbol());
24+
locals_map[code_decl.get_identifier()] = code_decl.symbol();
2625
}
2726

2827
for(const auto &param : goto_function.type.parameters())

src/cpp/cpp_typecheck_code.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void cpp_typecheckt::typecheck_try_catch(codet &code)
100100
to_code_decl(to_code(code.op0().op0()));
101101

102102
// get the type
103-
const typet &type=code_decl.op0().type();
103+
const typet &type = code_decl.symbol().type();
104104

105105
// annotate exception ID
106106
op.set(ID_exception_id, cpp_exception_id(type, *this));

src/cpp/cpp_util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
#include <util/std_expr.h>
1212
#include <util/symbol.h>
1313

14-
exprt cpp_symbol_expr(const symbolt &symbol)
14+
symbol_exprt cpp_symbol_expr(const symbolt &symbol)
1515
{
1616
symbol_exprt tmp(symbol.name, symbol.type);
1717

1818
if(symbol.is_lvalue)
1919
tmp.set(ID_C_lvalue, true);
2020

21-
return std::move(tmp);
21+
return tmp;
2222
}

src/cpp/cpp_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <util/expr.h>
1414
#include <util/symbol.h>
1515

16-
exprt cpp_symbol_expr(const symbolt &symbol);
16+
symbol_exprt cpp_symbol_expr(const symbolt &symbol);
1717

1818
inline void already_typechecked(irept &irep)
1919
{

src/goto-diff/change_impact.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ void full_slicert::operator()(
8080
jumps.push_back(e_it->second);
8181
else if(e_it->first->is_decl())
8282
{
83-
const exprt &s=to_code_decl(e_it->first->code).symbol();
84-
decl_dead[to_symbol_expr(s).get_identifier()].push(e_it->second);
83+
const auto &s=to_code_decl(e_it->first->code).symbol();
84+
decl_dead[s.get_identifier()].push(e_it->second);
8585
}
8686
else if(e_it->first->is_dead())
8787
{

src/goto-instrument/accelerate/disjunctive_polynomial_acceleration.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,8 @@ bool disjunctive_polynomial_accelerationt::fit_polynomial(
546546

547547
// Start building the program. Begin by decl'ing each of the
548548
// master distinguishers.
549-
for(std::list<exprt>::iterator it=distinguishers.begin();
550-
it!=distinguishers.end();
549+
for(std::list<symbol_exprt>::iterator it = distinguishers.begin();
550+
it != distinguishers.end();
551551
++it)
552552
{
553553
program.add_instruction(DECL)->code=code_declt(*it);
@@ -888,8 +888,8 @@ void disjunctive_polynomial_accelerationt::build_fixed()
888888

889889
// Create shadow distinguisher variables. These guys identify the path that
890890
// is taken through the fixed-path body.
891-
for(std::list<exprt>::iterator it=distinguishers.begin();
892-
it!=distinguishers.end();
891+
for(std::list<symbol_exprt>::iterator it = distinguishers.begin();
892+
it != distinguishers.end();
893893
++it)
894894
{
895895
exprt &distinguisher=*it;
@@ -1006,8 +1006,8 @@ void disjunctive_polynomial_accelerationt::record_path(
10061006
{
10071007
distinguish_valuest path_val;
10081008

1009-
for(std::list<exprt>::iterator it=distinguishers.begin();
1010-
it!=distinguishers.end();
1009+
for(std::list<symbol_exprt>::iterator it = distinguishers.begin();
1010+
it != distinguishers.end();
10111011
++it)
10121012
{
10131013
path_val[*it]=program.eval(*it).is_true();

src/goto-instrument/accelerate/disjunctive_polynomial_acceleration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class disjunctive_polynomial_accelerationt
9898
acceleration_utilst utils;
9999
exprt loop_counter;
100100
distinguish_mapt distinguishing_points;
101-
std::list<exprt> distinguishers;
101+
std::list<symbol_exprt> distinguishers;
102102
expr_sett modified;
103103
goto_programt fixed;
104104
std::list<distinguish_valuest> accelerated_paths;

src/goto-instrument/dump_c.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,9 @@ void dump_ct::convert_global_variable(
894894
}
895895

896896
if(!func.empty() && !symbol.is_extern)
897-
local_static_decls[symbol.name]=d;
897+
{
898+
local_static_decls.emplace(symbol.name, d);
899+
}
898900
else if(!symbol.value.is_nil())
899901
{
900902
os << "// " << symbol.name << '\n';

0 commit comments

Comments
 (0)