CBMC
replacement_predicatet Class Reference

Patterns of expressions that should be replaced. More...

#include <linker_script_merge.h>

+ Collaboration diagram for replacement_predicatet:

Public Member Functions

 replacement_predicatet (const std::string &description, const std::function< const symbol_exprt &(const exprt &)> inner_symbol, const std::function< bool(const exprt &)> match)
 
const std::string & description () const
 a textual description of the expression that we're trying to match More...
 
const symbol_exprtinner_symbol (const exprt &expr) const
 Return the underlying symbol of the matched expression. More...
 
bool match (const exprt &expr) const
 Predicate: does the given expression match an interesting pattern? More...
 

Private Attributes

std::string _description
 
std::function< const symbol_exprt &(const exprt &)> _inner_symbol
 
std::function< bool(const exprt &)> _match
 

Detailed Description

Patterns of expressions that should be replaced.

Each instance of this class describes an expression 'shape' that should be replaced with a different expression. The intention is that if some expression matches the pattern described by this replacement_predicatet (i.e. replacement_predicatet::match() returns true), then that expression should be replaced by a new expression.

Definition at line 27 of file linker_script_merge.h.

Constructor & Destructor Documentation

◆ replacement_predicatet()

replacement_predicatet::replacement_predicatet ( const std::string &  description,
const std::function< const symbol_exprt &(const exprt &)>  inner_symbol,
const std::function< bool(const exprt &)>  match 
)
inline

Definition at line 30 of file linker_script_merge.h.

Member Function Documentation

◆ description()

const std::string& replacement_predicatet::description ( ) const
inline

a textual description of the expression that we're trying to match

Definition at line 38 of file linker_script_merge.h.

◆ inner_symbol()

const symbol_exprt& replacement_predicatet::inner_symbol ( const exprt expr) const
inline

Return the underlying symbol of the matched expression.

Precondition
replacement_predicatet::match() returned true

Definition at line 45 of file linker_script_merge.h.

◆ match()

bool replacement_predicatet::match ( const exprt expr) const
inline

Predicate: does the given expression match an interesting pattern?

If this function returns true, the entire expression should be replaced by a pointer whose underlying symbol is the symbol returned by replacement_predicatet::inner_symbol().

Definition at line 55 of file linker_script_merge.h.

Member Data Documentation

◆ _description

std::string replacement_predicatet::_description
private

Definition at line 61 of file linker_script_merge.h.

◆ _inner_symbol

std::function<const symbol_exprt&(const exprt&)> replacement_predicatet::_inner_symbol
private

Definition at line 62 of file linker_script_merge.h.

◆ _match

std::function<bool(const exprt &)> replacement_predicatet::_match
private

Definition at line 63 of file linker_script_merge.h.


The documentation for this class was generated from the following file: