Skip to content

Commit aa48409

Browse files
author
Owen Jones
committed
Remove redundant irep_id_hash for sets
Also stop using typedefs for std::set<irep_idt> and std::unordered_set<irep_idt>
1 parent 3e2ab6f commit aa48409

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+124
-137
lines changed

src/analyses/dirty.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class dirtyt
3434

3535
public:
3636
bool initialized;
37-
typedef std::unordered_set<irep_idt, irep_id_hash> id_sett;
3837
typedef goto_functionst::goto_functiont goto_functiont;
3938

4039
/// \post dirtyt objects that are created through this constructor are not
@@ -72,7 +71,7 @@ class dirtyt
7271
return operator()(expr.get_identifier());
7372
}
7473

75-
const id_sett &get_dirty_ids() const
74+
const std::unordered_set<irep_idt> &get_dirty_ids() const
7675
{
7776
die_if_uninitialized();
7877
return dirty;
@@ -97,7 +96,7 @@ class dirtyt
9796
void build(const goto_functiont &goto_function);
9897

9998
// variables whose address is taken
100-
id_sett dirty;
99+
std::unordered_set<irep_idt> dirty;
101100

102101
void find_dirty(const exprt &expr);
103102
void find_dirty_address_of(const exprt &expr);
@@ -131,7 +130,7 @@ class incremental_dirtyt
131130

132131
private:
133132
dirtyt dirty;
134-
std::unordered_set<irep_idt, irep_id_hash> dirty_processed_functions;
133+
std::unordered_set<irep_idt> dirty_processed_functions;
135134
};
136135

137136
#endif // CPROVER_ANALYSES_DIRTY_H

src/ansi-c/c_typecheck_type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ void c_typecheck_baset::typecheck_compound_body(
877877
// scan for duplicate members
878878

879879
{
880-
std::unordered_set<irep_idt, irep_id_hash> members;
880+
std::unordered_set<irep_idt> members;
881881

882882
for(struct_union_typet::componentst::iterator
883883
it=components.begin();

src/ansi-c/expr2c_class.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ class expr2ct
6464

6565
static std::string indent_str(unsigned indent);
6666

67-
std::unordered_map<irep_idt,
68-
std::unordered_set<irep_idt, irep_id_hash>,
69-
irep_id_hash> ns_collision;
67+
std::unordered_map<irep_idt, std::unordered_set<irep_idt>, irep_id_hash>
68+
ns_collision;
7069
std::unordered_map<irep_idt, irep_idt, irep_id_hash> shorthands;
7170

7271
unsigned sizeof_nesting;

src/cbmc/symex_bmc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class symex_bmct: public goto_symext
147147

148148
virtual void no_body(const irep_idt &identifier);
149149

150-
std::unordered_set<irep_idt, irep_id_hash> body_warnings;
150+
std::unordered_set<irep_idt> body_warnings;
151151

152152
symex_coveraget symex_coverage;
153153
};

src/goto-diff/goto_diff.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,19 @@ class goto_difft:public messaget
5151
ui_message_handlert::uit ui;
5252

5353
unsigned total_functions_count;
54-
typedef std::set<irep_idt> irep_id_sett;
55-
irep_id_sett new_functions, modified_functions, deleted_functions;
54+
std::set<irep_idt> new_functions, modified_functions, deleted_functions;
5655

5756
void output_function_group(
5857
const std::string &group_name,
59-
const irep_id_sett &function_group,
58+
const std::set<irep_idt> &function_group,
6059
const goto_modelt &goto_model) const;
6160
void output_function(
6261
const irep_idt &function_name,
6362
const goto_modelt &goto_model) const;
6463

6564
void convert_function_group_json(
6665
json_arrayt &result,
67-
const irep_id_sett &function_group,
66+
const std::set<irep_idt> &function_group,
6867
const goto_modelt &goto_model) const;
6968
void convert_function_json(
7069
json_objectt &result,

src/goto-diff/goto_diff_base.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void goto_difft::output_functions() const
6464
/// \param goto_model: the goto model
6565
void goto_difft::output_function_group(
6666
const std::string &group_name,
67-
const irep_id_sett &function_group,
67+
const std::set<irep_idt> &function_group,
6868
const goto_modelt &goto_model) const
6969
{
7070
result() << group_name << ":\n";
@@ -113,7 +113,7 @@ void goto_difft::output_function(
113113
/// \param goto_model: the goto model
114114
void goto_difft::convert_function_group_json(
115115
json_arrayt &result,
116-
const irep_id_sett &function_group,
116+
const std::set<irep_idt> &function_group,
117117
const goto_modelt &goto_model) const
118118
{
119119
for(const auto &function_name : function_group)

src/goto-instrument/code_contracts.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ class code_contractst
4545

4646
unsigned temporary_counter;
4747

48-
typedef std::unordered_set<irep_idt, irep_id_hash> id_sett;
49-
id_sett summarized;
48+
std::unordered_set<irep_idt> summarized;
5049

5150
void code_contracts(goto_functionst::goto_functiont &goto_function);
5251

@@ -389,8 +388,8 @@ void code_contractst::operator()()
389388
goto_functions.function_map.find(CPROVER_PREFIX "initialize");
390389
assert(i_it!=goto_functions.function_map.end());
391390

392-
for(id_sett::const_iterator it=summarized.begin();
393-
it!=summarized.end();
391+
for(std::unordered_set<irep_idt>::const_iterator it = summarized.begin();
392+
it != summarized.end();
394393
++it)
395394
add_contract_check(*it, i_it->second.body);
396395

src/goto-instrument/count_eloc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Date: December 2012
2121

2222
#include <goto-programs/cfg.h>
2323

24-
typedef std::unordered_set<irep_idt, irep_id_hash> linest;
24+
typedef std::unordered_set<irep_idt> linest;
2525
typedef std::unordered_map<irep_idt, linest, irep_id_hash> filest;
2626
typedef std::unordered_map<irep_idt, filest, irep_id_hash> working_dirst;
2727

src/goto-instrument/dump_c.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ void dump_ct::cleanup_decl(
613613

614614
tmp.add_instruction(END_FUNCTION);
615615

616-
std::unordered_set<irep_idt, irep_id_hash> typedef_names;
616+
std::unordered_set<irep_idt> typedef_names;
617617
for(const auto &td : typedef_map)
618618
typedef_names.insert(td.first);
619619

@@ -640,7 +640,7 @@ void dump_ct::cleanup_decl(
640640
/// function declarations or struct definitions
641641
void dump_ct::collect_typedefs(const typet &type, bool early)
642642
{
643-
std::unordered_set<irep_idt, irep_id_hash> deps;
643+
std::unordered_set<irep_idt> deps;
644644
collect_typedefs_rec(type, early, deps);
645645
}
646646

@@ -654,12 +654,12 @@ void dump_ct::collect_typedefs(const typet &type, bool early)
654654
void dump_ct::collect_typedefs_rec(
655655
const typet &type,
656656
bool early,
657-
std::unordered_set<irep_idt, irep_id_hash> &dependencies)
657+
std::unordered_set<irep_idt> &dependencies)
658658
{
659659
if(system_symbols.is_type_internal(type, system_headers))
660660
return;
661661

662-
std::unordered_set<irep_idt, irep_id_hash> local_deps;
662+
std::unordered_set<irep_idt> local_deps;
663663

664664
if(type.id()==ID_code)
665665
{
@@ -769,9 +769,8 @@ void dump_ct::dump_typedefs(std::ostream &os) const
769769
// output
770770
std::map<std::string, typedef_infot> to_insert;
771771

772-
typedef std::unordered_set<irep_idt, irep_id_hash> id_sett;
773-
id_sett typedefs_done;
774-
std::unordered_map<irep_idt, id_sett, irep_id_hash>
772+
std::unordered_set<irep_idt> typedefs_done;
773+
std::unordered_map<irep_idt, std::unordered_set<irep_idt>, irep_id_hash>
775774
forward_deps, reverse_deps;
776775

777776
for(const auto &td : typedef_map)
@@ -805,8 +804,9 @@ void dump_ct::dump_typedefs(std::ostream &os) const
805804
continue;
806805

807806
// reduce remaining dependencies
808-
id_sett &r_deps=r_it->second;
809-
for(id_sett::iterator it=r_deps.begin(); it!=r_deps.end(); ) // no ++it
807+
std::unordered_set<irep_idt> &r_deps = r_it->second;
808+
for(std::unordered_set<irep_idt>::iterator it = r_deps.begin();
809+
it != r_deps.end();) // no ++it
810810
{
811811
auto f_it=forward_deps.find(*it);
812812
if(f_it==forward_deps.end()) // might be done already
@@ -816,7 +816,7 @@ void dump_ct::dump_typedefs(std::ostream &os) const
816816
}
817817

818818
// update dependencies
819-
id_sett &f_deps=f_it->second;
819+
std::unordered_set<irep_idt> &f_deps = f_it->second;
820820
PRECONDITION(!f_deps.empty());
821821
PRECONDITION(f_deps.find(t.typedef_name)!=f_deps.end());
822822
f_deps.erase(t.typedef_name);
@@ -986,7 +986,7 @@ void dump_ct::convert_function_declaration(
986986
code_blockt b;
987987
std::list<irep_idt> type_decls, local_static;
988988

989-
std::unordered_set<irep_idt, irep_id_hash> typedef_names;
989+
std::unordered_set<irep_idt> typedef_names;
990990
for(const auto &td : typedef_map)
991991
typedef_names.insert(td.first);
992992

src/goto-instrument/dump_c_class.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class dump_ct
5252
std::unique_ptr<languaget> language;
5353
const bool harness;
5454

55-
typedef std::unordered_set<irep_idt, irep_id_hash> convertedt;
55+
typedef std::unordered_set<irep_idt> convertedt;
5656
convertedt converted_compound, converted_global, converted_enum;
5757

5858
std::set<std::string> system_headers;
@@ -68,7 +68,7 @@ class dump_ct
6868
irep_idt typedef_name;
6969
std::string type_decl_str;
7070
bool early;
71-
std::unordered_set<irep_idt, irep_id_hash> dependencies;
71+
std::unordered_set<irep_idt> dependencies;
7272

7373
explicit typedef_infot(const irep_idt &name):
7474
typedef_name(name),
@@ -108,7 +108,7 @@ class dump_ct
108108
void collect_typedefs_rec(
109109
const typet &type,
110110
bool early,
111-
std::unordered_set<irep_idt, irep_id_hash> &dependencies);
111+
std::unordered_set<irep_idt> &dependencies);
112112
void gather_global_typedefs();
113113
void dump_typedefs(std::ostream &os) const;
114114

0 commit comments

Comments
 (0)