cprover
type.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 
10 #include "type.h"
11 
12 void typet::copy_to_subtypes(const typet &type)
13 {
14  subtypes().push_back(type);
15 }
16 
18 {
19  subtypest &sub=subtypes();
20  sub.push_back(static_cast<const typet &>(get_nil_irep()));
21  sub.back().swap(type);
22 }
23 
24 bool is_number(const typet &type)
25 {
26  const irep_idt &id=type.id();
27  return id==ID_rational ||
28  id==ID_real ||
29  id==ID_integer ||
30  id==ID_natural ||
31  id==ID_complex ||
32  id==ID_unsignedbv ||
33  id==ID_signedbv ||
34  id==ID_floatbv ||
35  id==ID_fixedbv;
36 }
const irept & get_nil_irep()
Definition: irep.cpp:56
The type of an expression.
Definition: type.h:20
subtypest & subtypes()
Definition: type.h:56
void move_to_subtypes(typet &type)
Definition: type.cpp:17
const irep_idt & id() const
Definition: irep.h:189
void copy_to_subtypes(const typet &type)
Definition: type.cpp:12
std::vector< typet > subtypest
Definition: type.h:54
bool is_number(const typet &type)
Definition: type.cpp:24