Skip to content

Commit 5230f1f

Browse files
authored
Merge pull request diffblue#384 from diffblue/remove_get_may_alias_values
SEC-360: Removed LVSA's 'get_may_alias_values'.
2 parents a2d7c87 + cee6d3e commit 5230f1f

File tree

5 files changed

+223
-281
lines changed

5 files changed

+223
-281
lines changed

src/pointer-analysis/local_value_set.cpp

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -172,75 +172,6 @@ void local_value_sett::make_union_adjusting_types(
172172
}
173173
}
174174

175-
/// Builds a version of expr suitable for alias-comparison
176-
/// \param expr: The expression to be converted to the alias-uniform structure
177-
/// \return expr without information which is irrelevant to alias-comparison
178-
static exprt get_uniform_expr(const exprt &expr)
179-
{
180-
if(const auto desc_ptr = expr_try_dynamic_cast<object_descriptor_exprt>(expr))
181-
{
182-
object_descriptor_exprt ob;
183-
ob.object() = get_uniform_expr(desc_ptr->object());
184-
ob.offset() = desc_ptr->offset();
185-
return ob;
186-
}
187-
if(can_cast_expr<external_value_set_exprt>(expr))
188-
{
189-
exprt copy = expr;
190-
copy.set(ID_is_initializer, ID_0);
191-
return copy;
192-
}
193-
return expr;
194-
}
195-
196-
/// Reconstructs a type of a pointer to the object expr
197-
/// \param expr: An object in a points-to set we make an alias type for
198-
/// \return A type of a pointer to the object expr
199-
static typet get_alias_type(const exprt &expr)
200-
{
201-
if(expr.id() == ID_object_descriptor)
202-
{
203-
object_descriptor_exprt ob_expr = to_object_descriptor_expr(expr);
204-
if(
205-
ob_expr.offset().id() == ID_invalid ||
206-
ob_expr.offset().id() == ID_unknown)
207-
{
208-
return pointer_type(ob_expr.object().type());
209-
}
210-
}
211-
return pointer_type(expr.type());
212-
}
213-
214-
void local_value_sett::get_may_alias_set(
215-
const exprt &expr,
216-
value_setst::valuest &dest,
217-
const namespacet &ns) const
218-
{
219-
TMPROF_BLOCK();
220-
221-
object_mapt pointed_objects;
222-
get_value_set(expr, pointed_objects, ns, false);
223-
std::vector<exprt> uniform_pointed_objects;
224-
for(const auto &num_obj : pointed_objects.read())
225-
uniform_pointed_objects.push_back(get_uniform_expr(to_expr(num_obj)));
226-
227-
for(const auto &name_entry : values)
228-
for(const auto &enum_eobj : name_entry.second.object_map.read())
229-
{
230-
if(
231-
std::find(
232-
uniform_pointed_objects.cbegin(),
233-
uniform_pointed_objects.cend(),
234-
get_uniform_expr(to_expr(enum_eobj))) !=
235-
uniform_pointed_objects.cend())
236-
{
237-
dest.push_back(
238-
symbol_exprt(
239-
name_entry.second.identifier, get_alias_type(to_expr(enum_eobj))));
240-
}
241-
}
242-
}
243-
244175
/// Value-set analysis accrues a `suffix` as it walks down an expression tree--
245176
/// for example, it transforms a `get_value_set_rec(x.y.z)` into
246177
/// `get_value_set_rec(x, suffix = ".y.z")`. This function recovers the type

src/pointer-analysis/local_value_set.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ class local_value_sett : public value_sett
6767
// For all the overrides below, see the base type for parameter-level docs
6868
// as their meanings are unchanged.
6969

70-
/// Computes all pointers which MAY point to objects pointed to by expr
71-
/// \param expr: Identifies a points-to set for which to compute aliases
72-
/// \param dest: Output container for pointers to objects pointed to by expr
73-
/// \param ns: A reference to a symbol table
74-
void get_may_alias_set(
75-
const exprt &expr,
76-
value_setst::valuest &dest,
77-
const namespacet &ns) const;
78-
7970
/// Overrides `value_sett::apply_code_rec` to erase `dead` statements and
8071
/// ignore intrinsic instructions that manipulate abstract taint but don't
8172
/// cause any actual data flow.

src/pointer-analysis/local_value_set_analysis.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,6 @@ class local_value_set_analysist
209209
/// call to the base class). false, otherwise.
210210
virtual bool is_singular(const std::set<exprt> &) override;
211211

212-
/// Fills in dest with all pointers to any object pointed to be expr
213-
/// \param l: A program location w.r.t which the operation will be performed
214-
/// \param expr: Identifies a points-to set whose aliases we will compute
215-
/// \param dest: Output container for aliases
216-
void get_may_alias_values(
217-
locationt l,
218-
const exprt &expr,
219-
value_setst::valuest &dest)
220-
{
221-
((const local_value_sett &)(*this)[l].value_set)
222-
.get_may_alias_set(expr, dest, baset::ns);
223-
}
224-
225212
protected:
226213
/// Type of function under analysis
227214
const code_typet &function_type;

0 commit comments

Comments
 (0)