Skip to content

Commit 40d7f29

Browse files
authored
Merge pull request diffblue#6794 from tautschnig/cleanup/contracts-2
Remove internal symbols: use API to access code contract
2 parents 633eb4a + 5c15563 commit 40d7f29

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/linking/remove_internal_symbols.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ Author: Daniel Kroening
1111

1212
#include "remove_internal_symbols.h"
1313

14-
#include <goto-programs/adjust_float_expressions.h>
15-
14+
#include <util/c_types.h>
1615
#include <util/config.h>
1716
#include <util/find_symbols.h>
1817
#include <util/message.h>
1918
#include <util/namespace.h>
2019
#include <util/std_types.h>
2120
#include <util/symbol_table.h>
2221

22+
#include <goto-programs/adjust_float_expressions.h>
23+
2324
#include "static_lifetime_init.h"
2425

2526
static void get_symbols(
@@ -62,14 +63,16 @@ static void get_symbols(
6263
}
6364

6465
// check for contract definitions
65-
const exprt ensures =
66-
static_cast<const exprt &>(code_type.find(ID_C_spec_ensures));
67-
const exprt requires =
68-
static_cast<const exprt &>(code_type.find(ID_C_spec_requires));
66+
const code_with_contract_typet &maybe_contract =
67+
to_code_with_contract_type(code_type);
6968

7069
find_symbols_sett new_symbols;
71-
find_type_and_expr_symbols(ensures, new_symbols);
72-
find_type_and_expr_symbols(requires, new_symbols);
70+
for(const exprt &e : maybe_contract.ensures())
71+
find_type_and_expr_symbols(e, new_symbols);
72+
for(const exprt &r : maybe_contract.requires())
73+
find_type_and_expr_symbols(r, new_symbols);
74+
for(const exprt &a : maybe_contract.assigns())
75+
find_type_and_expr_symbols(a, new_symbols);
7376

7477
for(const auto &s : new_symbols)
7578
{

0 commit comments

Comments
 (0)