CBMC
type2name.cpp File Reference

Type Naming for C. More...

#include "type2name.h"
#include <util/arith_tools.h>
#include <util/c_types.h>
#include <util/invariant.h>
#include <util/namespace.h>
#include <util/pointer_offset_size.h>
#include <util/std_expr.h>
#include <util/symbol.h>
#include <regex>
+ Include dependency graph for type2name.cpp:

Go to the source code of this file.

Typedefs

typedef std::unordered_map< irep_idt, std::pair< size_t, bool > > symbol_numbert
 

Functions

static std::string type2name (const typet &type, const namespacet &ns, symbol_numbert &symbol_number)
 
static std::string type2name_tag (const tag_typet &type, const namespacet &ns, symbol_numbert &symbol_number)
 
static std::string pointer_offset_bits_as_string (const typet &type, const namespacet &ns)
 
std::string type2name (const typet &type, const namespacet &ns)
 
std::string type_name2type_identifier (const std::string &name)
 type2name generates strings that aren't valid C identifiers If we want utilities like dump_c to work properly identifiers should ideally always be valid C identifiers This replaces some invalid characters that can appear in type2name output. More...
 
std::string type_to_partial_identifier (const typet &type, const namespacet &ns)
 Constructs a string describing the given type, which can be used as part of a C identifier. More...
 

Detailed Description

Type Naming for C.

Definition in file type2name.cpp.

Typedef Documentation

◆ symbol_numbert

typedef std::unordered_map<irep_idt, std::pair<size_t, bool> > symbol_numbert

Definition at line 24 of file type2name.cpp.

Function Documentation

◆ pointer_offset_bits_as_string()

static std::string pointer_offset_bits_as_string ( const typet type,
const namespacet ns 
)
static

Definition at line 73 of file type2name.cpp.

◆ type2name() [1/2]

std::string type2name ( const typet type,
const namespacet ns 
)

Definition at line 277 of file type2name.cpp.

◆ type2name() [2/2]

static std::string type2name ( const typet type,
const namespacet ns,
symbol_numbert symbol_number 
)
static

Definition at line 82 of file type2name.cpp.

◆ type2name_tag()

static std::string type2name_tag ( const tag_typet type,
const namespacet ns,
symbol_numbert symbol_number 
)
static

Definition at line 31 of file type2name.cpp.

◆ type_name2type_identifier()

std::string type_name2type_identifier ( const std::string &  name)

type2name generates strings that aren't valid C identifiers If we want utilities like dump_c to work properly identifiers should ideally always be valid C identifiers This replaces some invalid characters that can appear in type2name output.

Definition at line 287 of file type2name.cpp.

◆ type_to_partial_identifier()

std::string type_to_partial_identifier ( const typet type,
const namespacet ns 
)

Constructs a string describing the given type, which can be used as part of a C identifier.

The resulting identifier is not guaranteed to uniquely identify the type in all cases.

Parameters
typeInternal representation of the type to describe.
nsNamespace for looking up any types on which the type parameter depends.
Returns
An identifying string which can be used as part of a C identifier.

Definition at line 328 of file type2name.cpp.