Skip to content

Commit fa084df

Browse files
author
Remi Delmas
committed
CONTRACTS: is_cprover_symbol utility function
Used by contract instrumentation to skip instrumenting CPROVER symbols with special meaning.
1 parent b34e991 commit fa084df

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*******************************************************************\
2+
3+
Module: Dynamic frame condition checking
4+
5+
Author: Remi Delmas, [email protected]
6+
7+
\*******************************************************************/
8+
9+
#include "dfcc_is_cprover_symbol.h"
10+
11+
#include <util/cprover_prefix.h>
12+
#include <util/irep.h>
13+
#include <util/prefix.h>
14+
#include <util/suffix.h>
15+
16+
bool dfcc_is_cprover_symbol(const irep_idt &id)
17+
{
18+
std::string str = id2string(id);
19+
return has_prefix(str, CPROVER_PREFIX) || has_prefix(str, "__VERIFIER") ||
20+
has_prefix(str, "nondet") || has_suffix(str, "$object");
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*******************************************************************\
2+
3+
Module: Dynamic frame condition checking
4+
5+
Author: Remi Delmas, [email protected]
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
11+
#ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_IS_CPROVER_SYMBOL_H
12+
#define CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_IS_CPROVER_SYMBOL_H
13+
14+
#include <util/irep.h>
15+
16+
/// \return True iff the id starts with CPROVER_PREFIX, `__VERIFIER`, `nondet`
17+
/// or ends with `$object`.
18+
bool dfcc_is_cprover_symbol(const irep_idt &id);
19+
20+
#endif

0 commit comments

Comments
 (0)