CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cpp_enum_type.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: C++ Language Type Checking
4
5Author: Daniel Kroening, kroening@cs.cmu.edu
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_CPP_CPP_ENUM_TYPE_H
13#define CPROVER_CPP_CPP_ENUM_TYPE_H
14
15#include <util/type.h>
16
17#include "cpp_name.h"
18
20{
21public:
23
24 const cpp_namet &tag() const
25 {
26 return static_cast<const cpp_namet &>(find(ID_tag));
27 }
28
29 bool has_tag() const
30 {
31 return find(ID_tag).is_not_nil();
32 }
33
35 {
36 return static_cast<cpp_namet &>(add(ID_tag));
37 }
38
39 const irept &body() const
40 {
41 return find(ID_body);
42 }
43
45 {
46 return add(ID_body);
47 }
48
49 bool has_body() const
50 {
51 return find(ID_body).is_not_nil();
52 }
53
58
60};
61
62inline const cpp_enum_typet &to_cpp_enum_type(const irept &irep)
63{
64 PRECONDITION(irep.id() == ID_c_enum);
65 return static_cast<const cpp_enum_typet &>(irep);
66}
67
69{
70 PRECONDITION(irep.id() == ID_c_enum);
71 return static_cast<cpp_enum_typet &>(irep);
72}
73
74#endif // CPROVER_CPP_CPP_ENUM_TYPE_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
bool has_body() const
const cpp_namet & tag() const
const irept & body() const
bool has_tag() const
cpp_namet & tag()
irep_idt generate_anon_tag() const
bool get_tag_only_declaration() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition irep.h:364
bool get_bool(const irep_idt &name) const
Definition irep.cpp:57
const irept & find(const irep_idt &name) const
Definition irep.cpp:93
const irep_idt & id() const
Definition irep.h:388
irept & add(const irep_idt &name)
Definition irep.cpp:103
The type of an expression, extends irept.
Definition type.h:29
const cpp_enum_typet & to_cpp_enum_type(const irept &irep)
#define PRECONDITION(CONDITION)
Definition invariant.h:463
Defines typet, type_with_subtypet and type_with_subtypest.