cprover
cpp_declarator.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_DECLARATOR_H
13#define CPROVER_CPP_CPP_DECLARATOR_H
14
15#include <util/expr.h>
16
17#include "cpp_name.h"
18
20{
21public:
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); }
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
const cpp_namet & name() const
const irept & throw_decl() const
irept & throw_decl()
void set_is_parameter(bool is_parameter)
void output(std::ostream &out) const
irept & member_initializers()
typet merge_type(const typet &declaration_type) const
const irept & member_initializers() const
cpp_namet & name()
const exprt & init_args() const
const exprt & value() const
const irept & method_qualifier() const
irept & method_qualifier()
exprt & init_args()
bool get_is_parameter() const
cpp_declaratort(const typet &type)
Base class for all expressions.
Definition: expr.h:54
typet & type()
Return the type of the expression.
Definition: expr.h:82
source_locationt & add_source_location()
Definition: expr.h:235
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition: irep.h:372
bool get_bool(const irep_idt &name) const
Definition: irep.cpp:58
const irept & find(const irep_idt &name) const
Definition: irep.cpp:106
void set(const irep_idt &name, const irep_idt &value)
Definition: irep.h:420
void make_nil()
Definition: irep.h:454
irept & add(const irep_idt &name)
Definition: irep.cpp:116
The type of an expression, extends irept.
Definition: type.h:29