File tree 2 files changed +13
-10
lines changed
2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ static exprt build_class_identifier(
30
30
const typet &type=ns.follow (e.type ());
31
31
const struct_typet &struct_type=to_struct_type (type);
32
32
const struct_typet::componentst &components=struct_type.components ();
33
- assert (!components.empty ());
33
+ INVARIANT (!components.empty (), " class structs cannot be empty " );
34
34
35
35
const auto &first_member_name=components.front ().get_name ();
36
36
member_exprt member_expr (
@@ -61,10 +61,9 @@ exprt get_class_identifier_field(
61
61
// Get a pointer from which we can extract a clsid.
62
62
// If it's already a pointer to an object of some sort, just use it;
63
63
// if it's void* then use the suggested type.
64
+ PRECONDITION (this_expr_in.type ().id () == ID_pointer);
64
65
65
66
exprt this_expr=this_expr_in;
66
- assert (this_expr.type ().id ()==ID_pointer &&
67
- " Non-pointer this-arg in remove-virtuals?" );
68
67
const auto &points_to=this_expr.type ().subtype ();
69
68
if (points_to==empty_typet ())
70
69
this_expr=typecast_exprt (this_expr, pointer_type (suggested_type));
Original file line number Diff line number Diff line change @@ -21,14 +21,18 @@ void compute_address_taken_functions(
21
21
forall_operands (it, src)
22
22
compute_address_taken_functions (*it, address_taken);
23
23
24
- if (src.id ()==ID_address_of &&
25
- src.type ().id ()==ID_pointer &&
26
- src.type ().subtype ().id ()==ID_code)
24
+ if (src.id () == ID_address_of)
27
25
{
28
- assert (src.operands ().size ()==1 );
29
- const exprt &op=src.op0 ();
30
- if (op.id ()==ID_symbol)
31
- address_taken.insert (to_symbol_expr (op).get_identifier ());
26
+ const address_of_exprt &address = to_address_of_expr (src);
27
+
28
+ if (
29
+ address.type ().id () == ID_pointer &&
30
+ address.type ().subtype ().id () == ID_code)
31
+ {
32
+ const exprt &target = address.object ();
33
+ if (target.id () == ID_symbol)
34
+ address_taken.insert (to_symbol_expr (target).get_identifier ());
35
+ }
32
36
}
33
37
}
34
38
You can’t perform that action at this time.
0 commit comments