CBMC
add_failed_symbols.cpp File Reference

Pointer Dereferencing. More...

#include "add_failed_symbols.h"
#include <util/namespace.h>
#include <util/pointer_expr.h>
#include <util/std_expr.h>
#include <util/symbol.h>
#include <util/symbol_table_base.h>
#include <list>
+ Include dependency graph for add_failed_symbols.cpp:

Go to the source code of this file.

Functions

irep_idt failed_symbol_id (const irep_idt &id)
 Get the name of the special symbol used to denote an unknown referee pointed to by a given pointer-typed symbol. More...
 
void add_failed_symbol (symbolt &symbol, symbol_table_baset &symbol_table)
 Create a failed-dereference symbol for the given base symbol if it is pointer-typed; if not, do nothing. More...
 
void add_failed_symbol_if_needed (const symbolt &symbol, symbol_table_baset &symbol_table)
 Create a failed-dereference symbol for the given base symbol if it is pointer-typed, an lvalue, and doesn't already have one. More...
 
void add_failed_symbols (symbol_table_baset &symbol_table)
 Create a failed-dereference symbol for all symbols in the given table that need one (i.e. More...
 
std::optional< symbol_exprtget_failed_symbol (const symbol_exprt &expr, const namespacet &ns)
 Get the failed-dereference symbol for the given symbol. More...
 

Detailed Description

Pointer Dereferencing.

Definition in file add_failed_symbols.cpp.

Function Documentation

◆ add_failed_symbol()

void add_failed_symbol ( symbolt symbol,
symbol_table_baset symbol_table 
)

Create a failed-dereference symbol for the given base symbol if it is pointer-typed; if not, do nothing.

Parameters
symbolsymbol to created a failed symbol for
symbol_tableglobal symbol table

Definition at line 35 of file add_failed_symbols.cpp.

◆ add_failed_symbol_if_needed()

void add_failed_symbol_if_needed ( const symbolt symbol,
symbol_table_baset symbol_table 
)

Create a failed-dereference symbol for the given base symbol if it is pointer-typed, an lvalue, and doesn't already have one.

If any of these conditions are not met, do nothing.

Parameters
symbolsymbol to created a failed symbol for
symbol_tableglobal symbol table

Definition at line 62 of file add_failed_symbols.cpp.

◆ add_failed_symbols()

void add_failed_symbols ( symbol_table_baset symbol_table)

Create a failed-dereference symbol for all symbols in the given table that need one (i.e.

pointer-typed lvalues).

Parameters
symbol_tableglobal symbol table

Definition at line 77 of file add_failed_symbols.cpp.

◆ failed_symbol_id()

irep_idt failed_symbol_id ( const irep_idt id)

Get the name of the special symbol used to denote an unknown referee pointed to by a given pointer-typed symbol.

Parameters
idbase symbol id
Returns
id of the corresponding unknown-object ("failed") symbol.

Definition at line 26 of file add_failed_symbols.cpp.

◆ get_failed_symbol()

std::optional<symbol_exprt> get_failed_symbol ( const symbol_exprt expr,
const namespacet ns 
)

Get the failed-dereference symbol for the given symbol.

Parameters
exprsymbol expression to get a failed symbol for
nsglobal namespace
Returns
symbol expression for the failed-dereference symbol, or an empty optional if none exists.

Definition at line 91 of file add_failed_symbols.cpp.