CBMC
cpp_declarator.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_DECLARATOR_H
13 #define CPROVER_CPP_CPP_DECLARATOR_H
14 
15 #include <util/expr.h>
16 
17 #include "cpp_name.h"
18 
19 class cpp_declaratort:public exprt
20 {
21 public:
22  cpp_declaratort():exprt(ID_cpp_declarator)
23  {
24  value().make_nil();
25  name().make_nil();
27  }
28 
29  explicit cpp_declaratort(const typet &type):exprt(ID_cpp_declarator, type)
30  {
31  value().make_nil();
32  name().make_nil();
34  }
35 
36  cpp_namet &name() { return static_cast<cpp_namet &>(add(ID_name)); }
37  const cpp_namet &name() const
38  {
39  return static_cast<const cpp_namet &>(find(ID_name));
40  }
41 
42  exprt &value() { return static_cast<exprt &>(add(ID_value)); }
43  const exprt &value() const
44  {
45  return static_cast<const exprt &>(find(ID_value));
46  }
47 
48  bool get_is_parameter() const
49  {
50  return get_bool(ID_is_parameter);
51  }
52 
53  void set_is_parameter(bool is_parameter)
54  {
55  set(ID_is_parameter, is_parameter);
56  }
57 
58  // initializers for function arguments
60  {
61  return static_cast<exprt &>(add(ID_init_args));
62  }
63  const exprt &init_args() const
64  {
65  return static_cast<const exprt &>(find(ID_init_args));
66  }
67 
68  irept &method_qualifier() { return add(ID_method_qualifier); }
69  const irept &method_qualifier() const { return find(ID_method_qualifier); }
70 
71  irept &member_initializers() { return add(ID_member_initializers); }
72  const irept &member_initializers() const
73  {
74  return find(ID_member_initializers);
75  }
76 
78  {
79  return add(ID_throw_decl);
80  }
81  const irept &throw_decl() const
82  {
83  return find(ID_throw_decl);
84  }
85 
86  void output(std::ostream &out) const;
87 
88  typet merge_type(const typet &declaration_type) const;
89 };
90 
91 #endif // CPROVER_CPP_CPP_DECLARATOR_H
irept & member_initializers()
const cpp_namet & name() const
void set_is_parameter(bool is_parameter)
void output(std::ostream &out) const
irept & throw_decl()
irept & method_qualifier()
const irept & throw_decl() const
cpp_namet & name()
typet merge_type(const typet &declaration_type) const
const exprt & init_args() const
const irept & member_initializers() const
exprt & init_args()
const irept & method_qualifier() const
const exprt & value() const
bool get_is_parameter() const
cpp_declaratort(const typet &type)
Base class for all expressions.
Definition: expr.h:56
source_locationt & add_source_location()
Definition: expr.h:236
typet & type()
Return the type of the expression.
Definition: expr.h:84
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition: irep.h:360
bool get_bool(const irep_idt &name) const
Definition: irep.cpp:57
const irept & find(const irep_idt &name) const
Definition: irep.cpp:93
void set(const irep_idt &name, const irep_idt &value)
Definition: irep.h:408
void make_nil()
Definition: irep.h:442
irept & add(const irep_idt &name)
Definition: irep.cpp:103
The type of an expression, extends irept.
Definition: type.h:29