Skip to content

Replace unsigned with more precise type #1640

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
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
12 changes: 9 additions & 3 deletions src/pointer-analysis/value_set_fi.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class value_set_fit

class object_map_dt
{
typedef std::map<unsigned, objectt> data_typet;
typedef std::map<object_numberingt::number_type, objectt> data_typet;
data_typet data;

public:
Expand All @@ -94,7 +94,10 @@ class value_set_fit

size_t size() const { return data.size(); }

objectt &operator[](unsigned i) { return data[i]; }
objectt &operator[](object_numberingt::number_type i)
{
return data[i];
}

template <typename It>
void insert(It b, It e) { data.insert(b, e); }
Expand Down Expand Up @@ -135,7 +138,10 @@ class value_set_fit
return insert(dest, object_numbering.number(src), objectt(offset));
}

bool insert(object_mapt &dest, unsigned n, const objectt &object) const
bool insert(
object_mapt &dest,
object_numberingt::number_type n,
const objectt &object) const
{
if(dest.read().find(n)==dest.read().end())
{
Expand Down
4 changes: 2 additions & 2 deletions src/pointer-analysis/value_set_fivr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,7 @@ void value_set_fivrt::apply_code(

bool value_set_fivrt::insert_to(
object_mapt &dest,
unsigned n,
object_numberingt::number_type n,
const objectt &object) const
{
object_map_dt &map=dest.write();
Expand Down Expand Up @@ -1715,7 +1715,7 @@ bool value_set_fivrt::insert_to(

bool value_set_fivrt::insert_from(
object_mapt &dest,
unsigned n,
object_numberingt::number_type n,
const objectt &object) const
{
object_map_dt &map=dest.write();
Expand Down
25 changes: 18 additions & 7 deletions src/pointer-analysis/value_set_fivr.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,18 @@ class value_set_fivrt
object_map_dt() {}
static const object_map_dt blank;

typedef std::map<unsigned, objectt> objmapt;
typedef std::map<object_numberingt::number_type, objectt> objmapt;
objmapt objmap;

// NOLINTNEXTLINE(readability/identifiers)
typedef objmapt::const_iterator const_iterator;
// NOLINTNEXTLINE(readability/identifiers)
typedef objmapt::iterator iterator;

const_iterator find(unsigned k) { return objmap.find(k); }
const_iterator find(object_numberingt::number_type k)
{
return objmap.find(k);
}
iterator begin() { return objmap.begin(); }
const_iterator begin() const { return objmap.begin(); }
iterator end() { return objmap.end(); }
Expand All @@ -93,17 +96,19 @@ class value_set_fivrt
bool empty() const { return objmap.empty(); }
void clear() { objmap.clear(); validity_ranges.clear(); }

objectt &operator[](unsigned k)
objectt &operator[](object_numberingt::number_type k)
{
return objmap[k];
}

// operator[] is the only way to insert something!
std::pair<iterator, bool> insert(const std::pair<unsigned, objectt>&)
std::pair<iterator, bool>
insert(const std::pair<object_numberingt::number_type, objectt> &)
{
UNREACHABLE;
}
iterator insert(iterator, const std::pair<unsigned, objectt>&)
iterator
insert(iterator, const std::pair<object_numberingt::number_type, objectt> &)
{
UNREACHABLE;
}
Expand Down Expand Up @@ -166,7 +171,10 @@ class value_set_fivrt
return insert_to(dest, object_numbering.number(src), objectt(offset));
}

bool insert_to(object_mapt &dest, unsigned n, const objectt &object) const;
bool insert_to(
object_mapt &dest,
object_numberingt::number_type n,
const objectt &object) const;

bool insert_to(
object_mapt &dest,
Expand Down Expand Up @@ -194,7 +202,10 @@ class value_set_fivrt
return insert_from(dest, object_numbering.number(src), objectt(offset));
}

bool insert_from(object_mapt &dest, unsigned n, const objectt &object) const;
bool insert_from(
object_mapt &dest,
object_numberingt::number_type n,
const objectt &object) const;

bool insert_from(
object_mapt &dest,
Expand Down
4 changes: 2 additions & 2 deletions src/pointer-analysis/value_set_fivrns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ void value_set_fivrnst::apply_code(

bool value_set_fivrnst::insert_to(
object_mapt &dest,
unsigned n,
object_numberingt::number_type n,
const objectt &object) const
{
object_map_dt &map = dest.write();
Expand Down Expand Up @@ -1371,7 +1371,7 @@ bool value_set_fivrnst::insert_to(

bool value_set_fivrnst::insert_from(
object_mapt &dest,
unsigned n,
object_numberingt::number_type n,
const objectt &object) const
{
object_map_dt &map = dest.write();
Expand Down
25 changes: 18 additions & 7 deletions src/pointer-analysis/value_set_fivrns.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,18 @@ class value_set_fivrnst
object_map_dt() {}
static const object_map_dt blank;

typedef std::map<unsigned, objectt> objmapt;
typedef std::map<object_numberingt::number_type, objectt> objmapt;
objmapt objmap;

// NOLINTNEXTLINE(readability/identifiers)
typedef objmapt::const_iterator const_iterator;
// NOLINTNEXTLINE(readability/identifiers)
typedef objmapt::iterator iterator;

const_iterator find(unsigned k) { return objmap.find(k); }
const_iterator find(object_numberingt::number_type k)
{
return objmap.find(k);
}
iterator begin() { return objmap.begin(); }
const_iterator begin() const { return objmap.begin(); }
iterator end() { return objmap.end(); }
Expand All @@ -94,17 +97,19 @@ class value_set_fivrnst
bool empty() const { return objmap.empty(); }
void clear() { objmap.clear(); validity_ranges.clear(); }

objectt &operator[](unsigned k)
objectt &operator[](object_numberingt::number_type k)
{
return objmap[k];
}

// operator[] is the only way to insert something!
std::pair<iterator, bool> insert(const std::pair<unsigned, objectt>&)
std::pair<iterator, bool>
insert(const std::pair<object_numberingt::number_type, objectt> &)
{
UNREACHABLE;
}
iterator insert(iterator, const std::pair<unsigned, objectt>&)
iterator
insert(iterator, const std::pair<object_numberingt::number_type, objectt> &)
{
UNREACHABLE;
}
Expand Down Expand Up @@ -166,7 +171,10 @@ class value_set_fivrnst
return insert_to(dest, object_numbering.number(src), objectt(offset));
}

bool insert_to(object_mapt &dest, unsigned n, const objectt &object) const;
bool insert_to(
object_mapt &dest,
object_numberingt::number_type n,
const objectt &object) const;

bool insert_to(
object_mapt &dest,
Expand Down Expand Up @@ -194,7 +202,10 @@ class value_set_fivrnst
return insert_from(dest, object_numbering.number(src), objectt(offset));
}

bool insert_from(object_mapt &dest, unsigned n, const objectt &object) const;
bool insert_from(
object_mapt &dest,
object_numberingt::number_type n,
const objectt &object) const;

bool insert_from(
object_mapt &dest,
Expand Down