-
Notifications
You must be signed in to change notification settings - Fork 289
Expand file tree
/
Copy pathcpp_enum_type.h
More file actions
74 lines (55 loc) · 1.33 KB
/
cpp_enum_type.h
File metadata and controls
74 lines (55 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*******************************************************************\
Module: C++ Language Type Checking
Author: Daniel Kroening, [email protected]
\*******************************************************************/
/// \file
/// C++ Language Type Checking
#ifndef CPROVER_CPP_CPP_ENUM_TYPE_H
#define CPROVER_CPP_CPP_ENUM_TYPE_H
#include <util/type.h>
#include "cpp_name.h"
class cpp_enum_typet:public typet
{
public:
cpp_enum_typet();
const cpp_namet &tag() const
{
return static_cast<const cpp_namet &>(find(ID_tag));
}
bool has_tag() const
{
return find(ID_tag).is_not_nil();
}
cpp_namet &tag()
{
return static_cast<cpp_namet &>(add(ID_tag));
}
const irept &body() const
{
return find(ID_body);
}
irept &body()
{
return add(ID_body);
}
bool has_body() const
{
return find(ID_body).is_not_nil();
}
bool get_tag_only_declaration() const
{
return get_bool(ID_C_tag_only_declaration);
}
irep_idt generate_anon_tag() const;
};
inline const cpp_enum_typet &to_cpp_enum_type(const irept &irep)
{
PRECONDITION(irep.id() == ID_c_enum);
return static_cast<const cpp_enum_typet &>(irep);
}
inline cpp_enum_typet &to_cpp_enum_type(irept &irep)
{
PRECONDITION(irep.id() == ID_c_enum);
return static_cast<cpp_enum_typet &>(irep);
}
#endif // CPROVER_CPP_CPP_ENUM_TYPE_H