File tree 4 files changed +22
-5
lines changed
4 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ void ansi_c_internal_additions(std::string &code)
112
112
" void __VERIFIER_assume(__CPROVER_bool assumption);\n "
113
113
// NOLINTNEXTLINE(whitespace/line_length)
114
114
" void __CPROVER_assert(__CPROVER_bool assertion, const char *description);\n "
115
+ // NOLINTNEXTLINE(whitespace/line_length)
116
+ " void __CPROVER_precondition(__CPROVER_bool precondition, const char *description);\n "
115
117
" __CPROVER_bool __CPROVER_equal();\n "
116
118
" __CPROVER_bool __CPROVER_same_object(const void *, const void *);\n "
117
119
" __CPROVER_bool __CPROVER_invalid_pointer(const void *);\n "
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ extern const void *__CPROVER_memory_leak;
19
19
20
20
void __CPROVER_assume (__CPROVER_bool assumption ) __attribute__((__noreturn__ ));
21
21
void __CPROVER_assert (__CPROVER_bool assertion , const char * description );
22
+ void __CPROVER_precondition (__CPROVER_bool assertion , const char * description );
22
23
23
24
__CPROVER_bool __CPROVER_is_zero_string (const void * );
24
25
__CPROVER_size_t __CPROVER_zero_string_length (const void * );
Original file line number Diff line number Diff line change @@ -1113,7 +1113,8 @@ void goto_convertt::do_function_call_symbol(
1113
1113
throw 0 ;
1114
1114
}
1115
1115
}
1116
- else if (identifier==CPROVER_PREFIX " assert" )
1116
+ else if (identifier==CPROVER_PREFIX " assert" ||
1117
+ identifier==CPROVER_PREFIX " precondition" )
1117
1118
{
1118
1119
if (arguments.size ()!=2 )
1119
1120
{
@@ -1123,16 +1124,28 @@ void goto_convertt::do_function_call_symbol(
1123
1124
throw 0 ;
1124
1125
}
1125
1126
1127
+ bool is_precondition=
1128
+ identifier==CPROVER_PREFIX " precondition" ;
1129
+
1126
1130
const irep_idt description=
1127
1131
get_string_constant (arguments[1 ]);
1128
1132
1129
1133
goto_programt::targett t=dest.add_instruction (ASSERT);
1130
1134
t->guard =arguments[0 ];
1131
1135
t->source_location =function.source_location ();
1132
- t->source_location .set (
1133
- " user-provided" ,
1134
- !function.source_location ().is_built_in ());
1135
- t->source_location .set_property_class (ID_assertion);
1136
+
1137
+ if (is_precondition)
1138
+ {
1139
+ t->source_location .set_property_class (ID_precondition);
1140
+ }
1141
+ else
1142
+ {
1143
+ t->source_location .set (
1144
+ " user-provided" ,
1145
+ !function.source_location ().is_built_in ());
1146
+ t->source_location .set_property_class (ID_assertion);
1147
+ }
1148
+
1136
1149
t->source_location .set_comment (description);
1137
1150
1138
1151
// let's double-check the type of the argument
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ IREP_ID_ONE(assign_bitor)
90
90
IREP_ID_ONE(assume)
91
91
IREP_ID_ONE(assert)
92
92
IREP_ID_ONE(assertion)
93
+ IREP_ID_ONE(precondition)
93
94
IREP_ID_ONE(goto)
94
95
IREP_ID_ONE(gcc_computed_goto)
95
96
IREP_ID_ONE(ifthenelse)
You can’t perform that action at this time.
0 commit comments