Skip to content

Commit aaf460a

Browse files
committed
Fixes formatting
1 parent 1d4fce2 commit aaf460a

File tree

6 files changed

+36
-32
lines changed

6 files changed

+36
-32
lines changed
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
int f1(int *arr)
2-
__CPROVER_requires(
3-
__CPROVER_exists {int i; (0 <= i && i < 10) && arr[i] == 4}
4-
)
5-
__CPROVER_ensures(__CPROVER_return_value == 0)
1+
int f1(int *arr) __CPROVER_requires(__CPROVER_exists {
2+
int i;
3+
(0 <= i && i < 10) && arr[i] == 4
4+
}) __CPROVER_ensures(__CPROVER_return_value == 0)
65
{
76
return 0;
87
}
98

109
int main()
1110
{
12-
int arr[10] = {0,1,2,3,4,5,6,7,8,9};
11+
int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
1312
f1(arr);
1413
}
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
int f1(int *arr)
2-
__CPROVER_requires(
3-
__CPROVER_exists {int i; (0 <= i && i < 10) && arr[i] == 1}
4-
)
5-
__CPROVER_ensures(__CPROVER_return_value == 0)
1+
int f1(int *arr) __CPROVER_requires(__CPROVER_exists {
2+
int i;
3+
(0 <= i && i < 10) && arr[i] == 1
4+
}) __CPROVER_ensures(__CPROVER_return_value == 0)
65
{
76
return 0;
87
}
98

109
int main()
1110
{
12-
int arr[10] = {0,0,0,0,0,0,0,0,0,0};
11+
int arr[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
1312
f1(arr);
1413
}
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
int f1(int *arr)
2-
__CPROVER_requires(
3-
__CPROVER_forall {int i; (0 <= i && i < 10) ==> arr[i] == i}
4-
)
5-
__CPROVER_ensures(__CPROVER_return_value == 0)
1+
// clang-format off
2+
int f1(int *arr) __CPROVER_requires(__CPROVER_forall {
3+
int i;
4+
(0 <= i && i < 10) ==> arr[i] == i
5+
}) __CPROVER_ensures(__CPROVER_return_value == 0)
6+
// clang-format on
67
{
78
return 0;
89
}
910

1011
int main()
1112
{
12-
int arr[10] = {0,1,2,3,4,5,6,7,8,9};
13+
int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
1314
f1(arr);
1415
}
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
int f1(int *arr)
2-
__CPROVER_requires(
3-
__CPROVER_forall {int i; (0 <= i && i < 10) ==> arr[i] == i}
4-
)
5-
__CPROVER_ensures(__CPROVER_return_value == 0)
1+
// clang-format off
2+
int f1(int *arr) __CPROVER_requires(__CPROVER_forall {
3+
int i;
4+
(0 <= i && i < 10) ==> arr[i] == i
5+
}) __CPROVER_ensures(__CPROVER_return_value == 0)
6+
// clang-format on
67
{
78
return 0;
89
}
910

1011
int main()
1112
{
12-
int arr[10] = {-1,1,2,3,4,5,6,7,8,9};
13+
int arr[10] = {-1, 1, 2, 3, 4, 5, 6, 7, 8, 9};
1314
f1(arr);
1415
}

src/goto-instrument/code_contracts.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,18 @@ bool code_contractst::has_contract(const irep_idt fun_name)
164164
}
165165

166166
void code_contractst::add_quantified_variable(
167-
exprt expression, replace_symbolt &replace, irep_idt mode)
167+
exprt expression,
168+
replace_symbolt &replace,
169+
irep_idt mode)
168170
{
169171
//If the expression is a quantified expression, this function adds
170172
//the quantified variable to the symbol table and to the expression map
171173

172174
//TODO Currently only works if the contract contains only a single quantified formula
173175
// i.e. (1) the top-level element is a quantifier formula
174176
//and (2) there are no inner quantifier formulae
175-
if(expression.id()==ID_exists || expression.id()==ID_forall)
177+
if(expression.id() == ID_exists || expression.id() == ID_forall)
176178
{
177-
178179
//get quantified symbol
179180
exprt tuple = expression.operands().front();
180181
exprt quantified_variable = tuple.operands().front();
@@ -190,7 +191,8 @@ void code_contractst::add_quantified_variable(
190191
symbol_table);
191192

192193
// add created fresh symbol to expression map
193-
symbol_exprt q(quantified_symbol.get_identifier(), quantified_symbol.type());
194+
symbol_exprt q(
195+
quantified_symbol.get_identifier(), quantified_symbol.type());
194196
replace.insert(q, new_symbol.symbol_expr());
195197
}
196198
}
@@ -276,7 +278,7 @@ bool code_contractst::apply_function_contract(
276278
}
277279

278280
// Add quantified variables in contracts to the symbol map
279-
irep_idt mode = symbol_table.lookup_ref(function).mode;
281+
irep_idt mode = symbol_table.lookup_ref(function).mode;
280282
code_contractst::add_quantified_variable(ensures, replace, mode);
281283
code_contractst::add_quantified_variable(requires, replace, mode);
282284

@@ -816,8 +818,10 @@ void code_contractst::add_contract_check(
816818
}
817819

818820
// Add quantified variables in contracts to the symbol map
819-
code_contractst::add_quantified_variable(ensures, replace, function_symbol.mode);
820-
code_contractst::add_quantified_variable(requires, replace, function_symbol.mode);
821+
code_contractst::add_quantified_variable(
822+
ensures, replace, function_symbol.mode);
823+
code_contractst::add_quantified_variable(
824+
requires, replace, function_symbol.mode);
821825

822826
// assume(requires)
823827
if(requires.is_not_nil())

src/goto-instrument/code_contracts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class code_contractst
171171
//If the expression is a quantified expression, this function adds
172172
//the quantified variable to the symbol table and to the expression map
173173
void add_quantified_variable(
174-
exprt expression,
174+
exprt expression,
175175
replace_symbolt &replace,
176176
irep_idt mode);
177177
};

0 commit comments

Comments
 (0)