Skip to content

Remove value_sett::idt [blocks: #4463] #4462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/pointer-analysis/value_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ bool value_sett::field_sensitive(const irep_idt &id, const typet &type)
return type.id() == ID_struct || type.id() == ID_struct_tag;
}

value_sett::entryt *value_sett::find_entry(const value_sett::idt &id)
value_sett::entryt *value_sett::find_entry(const irep_idt &id)
{
auto found = values.find(id);
return found == values.end() ? nullptr : &found->second;
}

const value_sett::entryt *
value_sett::find_entry(const value_sett::idt &id) const
const value_sett::entryt *value_sett::find_entry(const irep_idt &id) const
{
auto found = values.find(id);
return found == values.end() ? nullptr : &found->second;
Expand All @@ -70,8 +69,8 @@ value_sett::entryt &value_sett::get_entry(const entryt &e, const typet &type)
else
index=e.identifier;

std::pair<valuest::iterator, bool> r=
values.insert(std::pair<idt, entryt>(index, e));
std::pair<valuest::iterator, bool> r =
values.insert(std::pair<irep_idt, entryt>(index, e));

return r.first->second;
}
Expand Down
27 changes: 11 additions & 16 deletions src/pointer-analysis/value_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ class value_sett
/// in value sets.
static object_numberingt object_numbering;

typedef irep_idt idt;

/// Represents the offset into an object: either a unique integer offset,
/// or an unknown value, represented by `!offset`.
typedef optionalt<mp_integer> offsett;
Expand Down Expand Up @@ -249,16 +247,15 @@ class value_sett
struct entryt
{
object_mapt object_map;
idt identifier;
irep_idt identifier;
std::string suffix;

entryt()
{
}

entryt(const idt &_identifier, const std::string &_suffix):
identifier(_identifier),
suffix(_suffix)
entryt(const irep_idt &_identifier, const std::string &_suffix)
: identifier(_identifier), suffix(_suffix)
{
}

Expand Down Expand Up @@ -297,11 +294,11 @@ class value_sett
///
/// The components of the ID are thus duplicated in the `valuest` key and in
/// `entryt` fields.
#ifdef USE_DSTRING
typedef std::map<idt, entryt> valuest;
#else
typedef std::unordered_map<idt, entryt, string_hash> valuest;
#endif
#ifdef USE_DSTRING
typedef std::map<irep_idt, entryt> valuest;
#else
typedef std::unordered_map<irep_idt, entryt, string_hash> valuest;
#endif

/// Gets values pointed to by `expr`, including following dereference
/// operators (i.e. this is not a simple lookup in `valuest`).
Expand All @@ -314,9 +311,7 @@ class value_sett
const namespacet &ns) const;

/// Appears to be unimplemented.
expr_sett &get(
const idt &identifier,
const std::string &suffix);
expr_sett &get(const irep_idt &identifier, const std::string &suffix);

void clear()
{
Expand All @@ -330,10 +325,10 @@ class value_sett
/// \return a constant pointer to an entry if found, or null otherwise.
/// Note the pointer may be invalidated by insert operations, including
/// get_entry.
entryt *find_entry(const idt &id);
entryt *find_entry(const irep_idt &id);

/// Const version of \ref find_entry
const entryt *find_entry(const idt &id) const;
const entryt *find_entry(const irep_idt &id) const;

/// Gets or inserts an entry in this value-set.
/// \param e: entry to find. Its `id` and `suffix` fields will be used
Expand Down