File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -2289,6 +2289,33 @@ exprt c_typecheck_baset::do_special_functions(
22892289
22902290 return buffer_size_expr;
22912291 }
2292+ else if (identifier == CPROVER_PREFIX " is_list" )
2293+ {
2294+ if (expr.arguments ().size () != 1 )
2295+ {
2296+ error ().source_location = f_op.source_location ();
2297+ error () << " is_list expects one operand" << eom;
2298+ throw 0 ;
2299+ }
2300+
2301+ typecheck_function_call_arguments (expr);
2302+
2303+ if (
2304+ expr.arguments ()[0 ].type ().id () != ID_pointer ||
2305+ to_pointer_type (expr.arguments ()[0 ].type ()).base_type ().id () !=
2306+ ID_struct_tag)
2307+ {
2308+ error ().source_location = expr.arguments ()[0 ].source_location ();
2309+ error () << " is_list expects a struct-pointer operand" << eom;
2310+ throw 0 ;
2311+ }
2312+
2313+ predicate_exprt is_list_expr (" is_list" );
2314+ is_list_expr.operands () = expr.arguments ();
2315+ is_list_expr.add_source_location () = source_location;
2316+
2317+ return std::move (is_list_expr);
2318+ }
22922319 else if (identifier==CPROVER_PREFIX " is_zero_string" )
22932320 {
22942321 if (expr.arguments ().size ()!=1 )
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ __CPROVER_bool __CPROVER_equal();
1010__CPROVER_bool __CPROVER_same_object (const void * , const void * );
1111__CPROVER_bool __CPROVER_is_invalid_pointer (const void * );
1212_Bool __CPROVER_is_zero_string (const void * );
13+ // a singly-linked null-terminated dynamically-allocated list
14+ __CPROVER_bool __CPROVER_is_list ();
1315__CPROVER_size_t __CPROVER_zero_string_length (const void * );
1416__CPROVER_size_t __CPROVER_buffer_size (const void * );
1517__CPROVER_bool __CPROVER_r_ok ();
You can’t perform that action at this time.
0 commit comments