cprover
type.h File Reference
#include "source_location.h"
Include dependency graph for type.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  typet
 The type of an expression. More...
 
class  type_with_subtypet
 
class  type_with_subtypest
 

Macros

#define SUBTYPE_IN_GETSUB
 
#define SUBTYPES_IN_GETSUB
 
#define forall_subtypes(it, type)
 
#define Forall_subtypes(it, type)
 

Functions

bool is_number (const typet &type)
 
bool is_constant_or_has_constant_components (const typet &type, const namespacet &ns)
 Identify if a given type is constant itself or contains constant components. More...
 

Macro Definition Documentation

◆ forall_subtypes

#define forall_subtypes (   it,
  type 
)
Value:
if((type).has_subtypes()) /* NOLINT(readability/braces) */ \
for(typet::subtypest::const_iterator it=(type).subtypes().begin(), \
it##_end=(type).subtypes().end(); \
it!=it##_end; ++it)

Definition at line 161 of file type.h.

Referenced by find_symbols(), ansi_c_parsert::get_class(), cpp_typecheckt::has_auto(), cpp_typecheckt::has_const(), cpp_typecheckt::has_volatile(), rename_symbolt::have_to_rename(), replace_symbolt::have_to_replace(), c_storage_spect::read(), cpp_convert_typet::read_rec(), ansi_c_convert_typet::read_rec(), and type2name().

◆ Forall_subtypes

#define Forall_subtypes (   it,
  type 
)
Value:
if((type).has_subtypes()) /* NOLINT(readability/braces) */ \
for(typet::subtypest::iterator it=(type).subtypes().begin(); \
it!=(type).subtypes().end(); ++it)

Definition at line 167 of file type.h.

Referenced by template_mapt::apply(), dump_ct::cleanup_type(), cpp_declarationt::name_anon_struct_union(), rename_symbolt::rename(), and replace_symbolt::replace().

◆ SUBTYPE_IN_GETSUB

#define SUBTYPE_IN_GETSUB

Definition at line 15 of file type.h.

◆ SUBTYPES_IN_GETSUB

#define SUBTYPES_IN_GETSUB

Definition at line 16 of file type.h.

Function Documentation

◆ is_constant_or_has_constant_components()

bool is_constant_or_has_constant_components ( const typet type,
const namespacet ns 
)

Identify if a given type is constant itself or contains constant components.

Examples include:

  • const int a;
  • struct contains_constant_pointer { int x; int * const p; };
  • const int b[3];
    Parameters
    typeThe type we want to query constness of.
    nsThe namespace, needed for resolution of symbols.
    Returns
    Whether passed in type is const or not.

Definition at line 47 of file type.cpp.

References namespace_baset::follow(), irept::get_bool(), typet::has_subtype(), irept::id(), is_constant_or_has_constant_components(), typet::subtype(), and to_struct_union_type().

Referenced by is_constant_or_has_constant_components(), and nondet_static().

◆ is_number()