Skip to content

Commit 9161eae

Browse files
Merge pull request #7630 from remi-delmas-3000/contracts-is-cprover-symbol
CONTRACTS: is_cprover_symbol utility function
2 parents cd53c8d + df1059c commit 9161eae

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

src/goto-instrument/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ SRC = accelerate/accelerate.cpp \
1919
contracts/contracts.cpp \
2020
contracts/dynamic-frames/dfcc_utils.cpp \
2121
contracts/dynamic-frames/dfcc_library.cpp \
22+
contracts/dynamic-frames/dfcc_is_cprover_symbol.cpp \
2223
contracts/dynamic-frames/dfcc_is_fresh.cpp \
2324
contracts/dynamic-frames/dfcc_pointer_in_range.cpp \
2425
contracts/dynamic-frames/dfcc_is_freeable.cpp \
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*******************************************************************\
2+
3+
Module: Dynamic frame condition checking
4+
5+
Author: Remi Delmas, [email protected]
6+
7+
Date: March 2023
8+
9+
\*******************************************************************/
10+
11+
#include "dfcc_is_cprover_symbol.h"
12+
13+
#include <util/cprover_prefix.h>
14+
#include <util/prefix.h>
15+
#include <util/suffix.h>
16+
17+
bool dfcc_is_cprover_symbol(const irep_idt &id)
18+
{
19+
std::string str = id2string(id);
20+
return has_prefix(str, CPROVER_PREFIX) || has_prefix(str, "__VERIFIER") ||
21+
has_prefix(str, "nondet") || has_suffix(str, "$object");
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*******************************************************************\
2+
3+
Module: Dynamic frame condition checking
4+
5+
Author: Remi Delmas, [email protected]
6+
7+
Date: March 2023
8+
9+
\*******************************************************************/
10+
11+
/// \file
12+
13+
#ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_IS_CPROVER_SYMBOL_H
14+
#define CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_IS_CPROVER_SYMBOL_H
15+
16+
#include <util/irep.h>
17+
18+
/// \return True iff the id starts with CPROVER_PREFIX, `__VERIFIER`, `nondet`
19+
/// or ends with `$object`.
20+
bool dfcc_is_cprover_symbol(const irep_idt &id);
21+
22+
#endif

0 commit comments

Comments
 (0)