Skip to content

Commit 7e5273f

Browse files
authored
Merge pull request #5765 from tautschnig/forall-symbol_base_map
Remove forall_symbol_base_map
2 parents 0589e94 + f661522 commit 7e5273f

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

.clang-format

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ ForEachMacros: [
3535
'forall_operands',
3636
'Forall_operands',
3737
'forall_expr',
38-
'Forall_expr',
39-
'forall_symbol_base_map']
38+
'Forall_expr']
4039
IndentCaseLabels: 'false'
4140
IndentPPDirectives: AfterHash
4241
IndentWidth: '2'

src/ansi-c/ansi_c_entry_point.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Author: Daniel Kroening, [email protected]
1313
#include <util/config.h>
1414
#include <util/message.h>
1515
#include <util/pointer_expr.h>
16+
#include <util/range.h>
1617
#include <util/symbol_table.h>
1718

1819
#include <goto-programs/goto_functions.h>
@@ -119,18 +120,18 @@ bool ansi_c_entry_point(
119120
{
120121
std::list<irep_idt> matches;
121122

122-
forall_symbol_base_map(
123-
it, symbol_table.symbol_base_map, config.main.value())
123+
for(const auto &symbol_name_entry :
124+
equal_range(symbol_table.symbol_base_map, config.main.value()))
124125
{
125126
// look it up
126-
symbol_tablet::symbolst::const_iterator s_it=
127-
symbol_table.symbols.find(it->second);
127+
symbol_tablet::symbolst::const_iterator s_it =
128+
symbol_table.symbols.find(symbol_name_entry.second);
128129

129130
if(s_it==symbol_table.symbols.end())
130131
continue;
131132

132133
if(s_it->second.type.id()==ID_code)
133-
matches.push_back(it->second);
134+
matches.push_back(symbol_name_entry.second);
134135
}
135136

136137
if(matches.empty())

src/goto-instrument/interrupt.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Date: September 2011
1313

1414
#include "interrupt.h"
1515

16+
#include <util/range.h>
17+
1618
#include <linking/static_lifetime_init.h>
1719

1820
#ifdef LOCAL_MAY
@@ -152,11 +154,12 @@ get_isr(const symbol_tablet &symbol_table, const irep_idt &interrupt_handler)
152154
{
153155
std::list<symbol_exprt> matches;
154156

155-
forall_symbol_base_map(m_it, symbol_table.symbol_base_map, interrupt_handler)
157+
for(const auto &symbol_name_entry :
158+
equal_range(symbol_table.symbol_base_map, interrupt_handler))
156159
{
157160
// look it up
158-
symbol_tablet::symbolst::const_iterator s_it=
159-
symbol_table.symbols.find(m_it->second);
161+
symbol_tablet::symbolst::const_iterator s_it =
162+
symbol_table.symbols.find(symbol_name_entry.second);
160163

161164
if(s_it==symbol_table.symbols.end())
162165
continue;

src/jsil/jsil_entry_point.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Author: Michael Tautschnig, [email protected]
1414
#include <util/arith_tools.h>
1515
#include <util/config.h>
1616
#include <util/message.h>
17+
#include <util/range.h>
1718

1819
#include <goto-programs/goto_functions.h>
1920

@@ -60,18 +61,18 @@ bool jsil_entry_point(
6061
{
6162
std::list<irep_idt> matches;
6263

63-
forall_symbol_base_map(
64-
it, symbol_table.symbol_base_map, config.main.value())
64+
for(const auto &symbol_name_entry :
65+
equal_range(symbol_table.symbol_base_map, config.main.value()))
6566
{
6667
// look it up
67-
symbol_tablet::symbolst::const_iterator s_it=
68-
symbol_table.symbols.find(it->second);
68+
symbol_tablet::symbolst::const_iterator s_it =
69+
symbol_table.symbols.find(symbol_name_entry.second);
6970

7071
if(s_it==symbol_table.symbols.end())
7172
continue;
7273

7374
if(s_it->second.type.id()==ID_code)
74-
matches.push_back(it->second);
75+
matches.push_back(symbol_name_entry.second);
7576
}
7677

7778
if(matches.empty())

src/util/get_module.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Author: Daniel Kroening, [email protected]
1515
#include <set>
1616

1717
#include "message.h"
18+
#include "range.h"
1819
#include "symbol_table.h"
1920

2021
typedef std::list<const symbolt *> symbolptr_listt;
@@ -27,10 +28,11 @@ const symbolt &get_module_by_name(
2728
symbolptr_listt symbolptr_list;
2829
messaget message(message_handler);
2930

30-
forall_symbol_base_map(it, symbol_table.symbol_base_map, module)
31+
for(const auto &symbol_name_entry :
32+
equal_range(symbol_table.symbol_base_map, module))
3133
{
32-
symbol_tablet::symbolst::const_iterator it2=
33-
symbol_table.symbols.find(it->second);
34+
symbol_tablet::symbolst::const_iterator it2 =
35+
symbol_table.symbols.find(symbol_name_entry.second);
3436

3537
if(it2==symbol_table.symbols.end())
3638
continue;

src/util/symbol_table.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88

99
#include "symbol_table_base.h"
1010

11-
#define forall_symbol_base_map(it, expr, base_name) \
12-
for(symbol_base_mapt::const_iterator it=(expr).lower_bound(base_name), \
13-
it_end=(expr).upper_bound(base_name); \
14-
it!=it_end; ++it)
15-
16-
1711
/// \brief The symbol table
1812
/// \ingroup gr_symbol_table
1913
class symbol_tablet : public symbol_table_baset

0 commit comments

Comments
 (0)