Skip to content

CONTRACTS: is_cprover_symbol utility function #7630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/goto-instrument/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ SRC = accelerate/accelerate.cpp \
contracts/contracts.cpp \
contracts/dynamic-frames/dfcc_utils.cpp \
contracts/dynamic-frames/dfcc_library.cpp \
contracts/dynamic-frames/dfcc_is_cprover_symbol.cpp \
contracts/dynamic-frames/dfcc_is_fresh.cpp \
contracts/dynamic-frames/dfcc_pointer_in_range.cpp \
contracts/dynamic-frames/dfcc_is_freeable.cpp \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*******************************************************************\

Module: Dynamic frame condition checking

Author: Remi Delmas, [email protected]

Date: March 2023

\*******************************************************************/

#include "dfcc_is_cprover_symbol.h"

#include <util/cprover_prefix.h>
#include <util/prefix.h>
#include <util/suffix.h>

bool dfcc_is_cprover_symbol(const irep_idt &id)
{
std::string str = id2string(id);
return has_prefix(str, CPROVER_PREFIX) || has_prefix(str, "__VERIFIER") ||
has_prefix(str, "nondet") || has_suffix(str, "$object");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*******************************************************************\

Module: Dynamic frame condition checking

Author: Remi Delmas, [email protected]

Date: March 2023

\*******************************************************************/

/// \file

#ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_IS_CPROVER_SYMBOL_H
#define CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_IS_CPROVER_SYMBOL_H

#include <util/irep.h>

/// \return True iff the id starts with CPROVER_PREFIX, `__VERIFIER`, `nondet`
/// or ends with `$object`.
bool dfcc_is_cprover_symbol(const irep_idt &id);

#endif