Skip to content

Commit ef7291c

Browse files
authored
Merge pull request #7125 from diffblue/writeable_object
writeable_object and live_object
2 parents 09710f6 + b14cd4f commit ef7291c

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,6 +2498,38 @@ exprt c_typecheck_baset::do_special_functions(
24982498

24992499
return is_dynamic_object_expr;
25002500
}
2501+
else if(identifier == CPROVER_PREFIX "LIVE_OBJECT")
2502+
{
2503+
if(expr.arguments().size() != 1)
2504+
{
2505+
error().source_location = f_op.source_location();
2506+
error() << "live_object expects one argument" << eom;
2507+
throw 0;
2508+
}
2509+
2510+
typecheck_function_call_arguments(expr);
2511+
2512+
exprt live_object_expr = live_object_exprt(expr.arguments()[0]);
2513+
live_object_expr.add_source_location() = source_location;
2514+
2515+
return live_object_expr;
2516+
}
2517+
else if(identifier == CPROVER_PREFIX "WRITEABLE_OBJECT")
2518+
{
2519+
if(expr.arguments().size() != 1)
2520+
{
2521+
error().source_location = f_op.source_location();
2522+
error() << "writeable_object expects one argument" << eom;
2523+
throw 0;
2524+
}
2525+
2526+
typecheck_function_call_arguments(expr);
2527+
2528+
exprt writeable_object_expr = writeable_object_exprt(expr.arguments()[0]);
2529+
writeable_object_expr.add_source_location() = source_location;
2530+
2531+
return writeable_object_expr;
2532+
}
25012533
else if(identifier==CPROVER_PREFIX "POINTER_OFFSET")
25022534
{
25032535
if(expr.arguments().size()!=1)

src/ansi-c/cprover_builtin_headers.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ void __CPROVER_old(const void *);
4949
void __CPROVER_loop_entry(const void *);
5050

5151
// pointers
52+
__CPROVER_bool __CPROVER_LIVE_OBJECT(const void *);
53+
__CPROVER_bool __CPROVER_WRITEABLE_OBJECT(const void *);
5254
__CPROVER_size_t __CPROVER_POINTER_OBJECT(const void *);
5355
__CPROVER_ssize_t __CPROVER_POINTER_OFFSET(const void *);
5456
__CPROVER_size_t __CPROVER_OBJECT_SIZE(const void *);

src/ansi-c/expr2c.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3988,6 +3988,8 @@ optionalt<std::string> expr2ct::convert_function(const exprt &src)
39883988
{ID_count_leading_zeros, "__builtin_clz"},
39893989
{ID_count_trailing_zeros, "__builtin_ctz"},
39903990
{ID_dynamic_object, "DYNAMIC_OBJECT"},
3991+
{ID_live_object, "LIVE_OBJECT"},
3992+
{ID_writeable_object, "WRITEABLE_OBJECT"},
39913993
{ID_floatbv_div, "FLOAT/"},
39923994
{ID_floatbv_minus, "FLOAT-"},
39933995
{ID_floatbv_mult, "FLOAT*"},

0 commit comments

Comments
 (0)