cprover
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  // initializers for function arguments
50  {
51  return static_cast<exprt &>(add(ID_init_args));
52  }
53  const exprt &init_args() const
54  {
55  return static_cast<const exprt &>(find(ID_init_args));
56  }
57 
58  irept &method_qualifier() { return add(ID_method_qualifier); }
59  const irept &method_qualifier() const { return find(ID_method_qualifier); }
60 
61  irept &member_initializers() { return add(ID_member_initializers); }
62  const irept &member_initializers() const
63  {
64  return find(ID_member_initializers);
65  }
66 
68  {
69  return add(ID_throw_decl);
70  }
71  const irept &throw_decl() const
72  {
73  return find(ID_throw_decl);
74  }
75 
76  void output(std::ostream &out) const;
77 
78  typet merge_type(const typet &declaration_type) const;
79 };
80 
81 #endif // CPROVER_CPP_CPP_DECLARATOR_H
The type of an expression, extends irept.
Definition: type.h:27
const irept & member_initializers() const
irept & throw_decl()
typet & type()
Return the type of the expression.
Definition: expr.h:68
const exprt & init_args() const
typet merge_type(const typet &declaration_type) const
const cpp_namet & name() const
exprt & init_args()
irept & method_qualifier()
Base class for tree-like data structures with sharing.
Definition: irep.h:156
cpp_declaratort(const typet &type)
void output(std::ostream &out) const
Base class for all expressions.
Definition: expr.h:54
irept & member_initializers()
const exprt & value() const
irept & add(const irep_namet &name)
Definition: irep.cpp:305
void make_nil()
Definition: irep.h:315
source_locationt & add_source_location()
Definition: expr.h:233
cpp_namet & name()
const irept & throw_decl() const
const irept & method_qualifier() const
const irept & find(const irep_namet &name) const
Definition: irep.cpp:284