Skip to content

Commit

Permalink
Remove forall_symbol_base_map
Browse files Browse the repository at this point in the history
This was useful in the past, but with C++-11 and the ranget helper we can use a
ranged-for to avoid the iterator altogether.
  • Loading branch information
tautschnig committed May 7, 2021
1 parent 1ab5de1 commit f661522
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
3 changes: 1 addition & 2 deletions .clang-format
Expand Up @@ -35,8 +35,7 @@ ForEachMacros: [
'forall_operands',
'Forall_operands',
'forall_expr',
'Forall_expr',
'forall_symbol_base_map']
'Forall_expr']
IndentCaseLabels: 'false'
IndentPPDirectives: AfterHash
IndentWidth: '2'
Expand Down
11 changes: 6 additions & 5 deletions src/ansi-c/ansi_c_entry_point.cpp
Expand Up @@ -13,6 +13,7 @@ Author: Daniel Kroening, kroening@kroening.com
#include <util/config.h>
#include <util/message.h>
#include <util/pointer_expr.h>
#include <util/range.h>
#include <util/symbol_table.h>

#include <goto-programs/goto_functions.h>
Expand Down Expand Up @@ -119,18 +120,18 @@ bool ansi_c_entry_point(
{
std::list<irep_idt> matches;

forall_symbol_base_map(
it, symbol_table.symbol_base_map, config.main.value())
for(const auto &symbol_name_entry :
equal_range(symbol_table.symbol_base_map, config.main.value()))
{
// look it up
symbol_tablet::symbolst::const_iterator s_it=
symbol_table.symbols.find(it->second);
symbol_tablet::symbolst::const_iterator s_it =
symbol_table.symbols.find(symbol_name_entry.second);

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

if(s_it->second.type.id()==ID_code)
matches.push_back(it->second);
matches.push_back(symbol_name_entry.second);
}

if(matches.empty())
Expand Down
9 changes: 6 additions & 3 deletions src/goto-instrument/interrupt.cpp
Expand Up @@ -13,6 +13,8 @@ Date: September 2011

#include "interrupt.h"

#include <util/range.h>

#include <linking/static_lifetime_init.h>

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

forall_symbol_base_map(m_it, symbol_table.symbol_base_map, interrupt_handler)
for(const auto &symbol_name_entry :
equal_range(symbol_table.symbol_base_map, interrupt_handler))
{
// look it up
symbol_tablet::symbolst::const_iterator s_it=
symbol_table.symbols.find(m_it->second);
symbol_tablet::symbolst::const_iterator s_it =
symbol_table.symbols.find(symbol_name_entry.second);

if(s_it==symbol_table.symbols.end())
continue;
Expand Down
11 changes: 6 additions & 5 deletions src/jsil/jsil_entry_point.cpp
Expand Up @@ -14,6 +14,7 @@ Author: Michael Tautschnig, tautschn@amazon.com
#include <util/arith_tools.h>
#include <util/config.h>
#include <util/message.h>
#include <util/range.h>

#include <goto-programs/goto_functions.h>

Expand Down Expand Up @@ -60,18 +61,18 @@ bool jsil_entry_point(
{
std::list<irep_idt> matches;

forall_symbol_base_map(
it, symbol_table.symbol_base_map, config.main.value())
for(const auto &symbol_name_entry :
equal_range(symbol_table.symbol_base_map, config.main.value()))
{
// look it up
symbol_tablet::symbolst::const_iterator s_it=
symbol_table.symbols.find(it->second);
symbol_tablet::symbolst::const_iterator s_it =
symbol_table.symbols.find(symbol_name_entry.second);

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

if(s_it->second.type.id()==ID_code)
matches.push_back(it->second);
matches.push_back(symbol_name_entry.second);
}

if(matches.empty())
Expand Down
8 changes: 5 additions & 3 deletions src/util/get_module.cpp
Expand Up @@ -15,6 +15,7 @@ Author: Daniel Kroening, kroening@kroening.com
#include <set>

#include "message.h"
#include "range.h"
#include "symbol_table.h"

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

forall_symbol_base_map(it, symbol_table.symbol_base_map, module)
for(const auto &symbol_name_entry :
equal_range(symbol_table.symbol_base_map, module))
{
symbol_tablet::symbolst::const_iterator it2=
symbol_table.symbols.find(it->second);
symbol_tablet::symbolst::const_iterator it2 =
symbol_table.symbols.find(symbol_name_entry.second);

if(it2==symbol_table.symbols.end())
continue;
Expand Down
6 changes: 0 additions & 6 deletions src/util/symbol_table.h
Expand Up @@ -8,12 +8,6 @@

#include "symbol_table_base.h"

#define forall_symbol_base_map(it, expr, base_name) \
for(symbol_base_mapt::const_iterator it=(expr).lower_bound(base_name), \
it_end=(expr).upper_bound(base_name); \
it!=it_end; ++it)


/// \brief The symbol table
/// \ingroup gr_symbol_table
class symbol_tablet : public symbol_table_baset
Expand Down

0 comments on commit f661522

Please sign in to comment.