CBMC
cpp_item.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: C++ Language Type Checking
4 
5 Author: Daniel Kroening, kroening@cs.cmu.edu
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_CPP_CPP_ITEM_H
13 #define CPROVER_CPP_CPP_ITEM_H
14 
15 #include "cpp_declaration.h"
16 #include "cpp_linkage_spec.h"
17 #include "cpp_namespace_spec.h"
18 #include "cpp_using.h"
19 #include "cpp_static_assert.h"
20 
21 class cpp_itemt:public irept
22 {
23 public:
24  // declaration
25 
27  {
28  id(ID_cpp_declaration);
29  return (cpp_declarationt &)*this;
30  }
31 
33  {
35  return (cpp_declarationt &)*this;
36  }
37 
39  {
41  return (const cpp_declarationt &)*this;
42  }
43 
44  bool is_declaration() const
45  {
46  return id()==ID_cpp_declaration;
47  }
48 
49  // linkage spec
50 
52  {
53  id(ID_cpp_linkage_spec);
54  return (cpp_linkage_spect &)*this;
55  }
56 
58  {
60  return (cpp_linkage_spect &)*this;
61  }
62 
64  {
66  return (const cpp_linkage_spect &)*this;
67  }
68 
69  bool is_linkage_spec() const
70  {
71  return id()==ID_cpp_linkage_spec;
72  }
73 
74  // namespace
75 
77  {
78  id(ID_cpp_namespace_spec);
79  return (cpp_namespace_spect &)*this;
80  }
81 
83  {
85  return (cpp_namespace_spect &)*this;
86  }
87 
89  {
91  return (const cpp_namespace_spect &)*this;
92  }
93 
94  bool is_namespace_spec() const
95  {
96  return id()==ID_cpp_namespace_spec;
97  }
98 
99  // using
100 
102  {
103  id(ID_cpp_using);
104  return (cpp_usingt &)*this;
105  }
106 
108  {
110  return (cpp_usingt &)*this;
111  }
112 
113  const cpp_usingt &get_using() const
114  {
116  return (const cpp_usingt &)*this;
117  }
118 
119  bool is_using() const
120  {
121  return id()==ID_cpp_using;
122  }
123 
124  // static assertion
125 
127  {
128  id(ID_cpp_static_assert);
129  return (cpp_static_assertt &)*this;
130  }
131 
133  {
135  return (cpp_static_assertt &)*this;
136  }
137 
138  bool is_static_assert() const
139  {
140  return id()==ID_cpp_static_assert;
141  }
142 
144  {
145  return static_cast<const source_locationt &>(
146  find(ID_C_source_location));
147  }
148 };
149 
150 #endif // CPROVER_CPP_CPP_ITEM_H
bool is_namespace_spec() const
Definition: cpp_item.h:94
const source_locationt & source_location() const
Definition: cpp_item.h:143
cpp_declarationt & make_declaration()
Definition: cpp_item.h:26
cpp_static_assertt & make_static_assert()
Definition: cpp_item.h:126
cpp_namespace_spect & make_namespace_spec()
Definition: cpp_item.h:76
const cpp_usingt & get_using() const
Definition: cpp_item.h:113
cpp_usingt & get_using()
Definition: cpp_item.h:107
cpp_usingt & make_using()
Definition: cpp_item.h:101
const cpp_declarationt & get_declaration() const
Definition: cpp_item.h:38
const cpp_linkage_spect & get_linkage_spec() const
Definition: cpp_item.h:63
cpp_static_assertt & get_static_assert()
Definition: cpp_item.h:132
cpp_linkage_spect & get_linkage_spec()
Definition: cpp_item.h:57
bool is_static_assert() const
Definition: cpp_item.h:138
bool is_using() const
Definition: cpp_item.h:119
cpp_declarationt & get_declaration()
Definition: cpp_item.h:32
bool is_declaration() const
Definition: cpp_item.h:44
cpp_linkage_spect & make_linkage_spec()
Definition: cpp_item.h:51
bool is_linkage_spec() const
Definition: cpp_item.h:69
const cpp_namespace_spect & get_namespace_spec() const
Definition: cpp_item.h:88
cpp_namespace_spect & get_namespace_spec()
Definition: cpp_item.h:82
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition: irep.h:364
const irept & find(const irep_idt &name) const
Definition: irep.cpp:93
const irep_idt & id() const
Definition: irep.h:388
C++ Language Type Checking.
C++ Language Type Checking.
C++ Language Type Checking.
C++ Language Type Checking.
C++ Language Type Checking.
#define PRECONDITION(CONDITION)
Definition: invariant.h:463