cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
template_map.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_TEMPLATE_MAP_H
13
#define CPROVER_CPP_TEMPLATE_MAP_H
14
15
#include <map>
16
#include <iosfwd>
17
18
#include <
util/expr.h
>
19
20
#include "
cpp_template_args.h
"
21
22
struct
template_parametert
;
23
class
template_typet
;
24
25
class
template_mapt
26
{
27
public
:
28
// this maps template parameters to their instantiated value
29
typedef
std::map<irep_idt, typet>
type_mapt
;
30
typedef
std::map<irep_idt, exprt>
expr_mapt
;
31
type_mapt
type_map
;
32
expr_mapt
expr_map
;
33
34
void
apply
(
exprt
&dest)
const
;
35
void
apply
(
typet
&dest)
const
;
36
37
void
swap
(
template_mapt
&template_map)
38
{
39
type_map
.swap(template_map.
type_map
);
40
expr_map
.swap(template_map.
expr_map
);
41
}
42
43
exprt
lookup
(
const
irep_idt
&identifier)
const
;
44
typet
lookup_type
(
const
irep_idt
&identifier)
const
;
45
exprt
lookup_expr
(
const
irep_idt
&identifier)
const
;
46
47
void
print
(std::ostream &out)
const
;
48
49
void
clear
()
50
{
51
type_map
.clear();
52
expr_map
.clear();
53
}
54
55
void
set
(
56
const
template_parametert
¶meter,
57
const
exprt
&value);
58
59
void
build
(
60
const
template_typet
&template_type,
61
const
cpp_template_args_tct
&template_args);
62
63
void
build_unassigned
(
64
const
template_typet
&template_type);
65
66
cpp_template_args_tct
build_template_args
(
67
const
template_typet
&template_type)
const
;
68
};
69
70
class
cpp_saved_template_mapt
71
{
72
public
:
73
explicit
cpp_saved_template_mapt
(
template_mapt
&
map
):
74
old_map
(
map
),
map
(
map
)
75
{
76
}
77
78
~cpp_saved_template_mapt
()
79
{
80
#if 0
81
std::cout <<
"RESTORING TEMPLATE MAP\n"
;
82
#endif
83
map
.swap(
old_map
);
84
}
85
86
private
:
87
template_mapt
old_map
;
88
template_mapt
&
map
;
89
};
90
91
#endif
// CPROVER_CPP_TEMPLATE_MAP_H
cpp_saved_template_mapt::cpp_saved_template_mapt
cpp_saved_template_mapt(template_mapt &map)
Definition
template_map.h:73
cpp_saved_template_mapt::~cpp_saved_template_mapt
~cpp_saved_template_mapt()
Definition
template_map.h:78
cpp_saved_template_mapt::map
template_mapt & map
Definition
template_map.h:88
cpp_saved_template_mapt::old_map
template_mapt old_map
Definition
template_map.h:87
cpp_template_args_tct
Definition
cpp_template_args.h:65
exprt
Base class for all expressions.
Definition
expr.h:57
template_mapt
Definition
template_map.h:26
template_mapt::build
void build(const template_typet &template_type, const cpp_template_args_tct &template_args)
Definition
template_map.cpp:145
template_mapt::lookup
exprt lookup(const irep_idt &identifier) const
Definition
template_map.cpp:93
template_mapt::build_unassigned
void build_unassigned(const template_typet &template_type)
Definition
template_map.cpp:214
template_mapt::print
void print(std::ostream &out) const
Definition
template_map.cpp:136
template_mapt::apply
void apply(exprt &dest) const
Definition
template_map.cpp:73
template_mapt::expr_map
expr_mapt expr_map
Definition
template_map.h:32
template_mapt::lookup_expr
exprt lookup_expr(const irep_idt &identifier) const
Definition
template_map.cpp:125
template_mapt::set
void set(const template_parametert ¶meter, const exprt &value)
Definition
template_map.cpp:188
template_mapt::lookup_type
typet lookup_type(const irep_idt &identifier) const
Definition
template_map.cpp:114
template_mapt::clear
void clear()
Definition
template_map.h:49
template_mapt::swap
void swap(template_mapt &template_map)
Definition
template_map.h:37
template_mapt::type_mapt
std::map< irep_idt, typet > type_mapt
Definition
template_map.h:29
template_mapt::expr_mapt
std::map< irep_idt, exprt > expr_mapt
Definition
template_map.h:30
template_mapt::type_map
type_mapt type_map
Definition
template_map.h:31
template_mapt::build_template_args
cpp_template_args_tct build_template_args(const template_typet &template_type) const
Definition
template_map.cpp:236
template_typet
Definition
cpp_template_type.h:19
typet
The type of an expression, extends irept.
Definition
type.h:29
cpp_template_args.h
C++ Language Type Checking.
expr.h
template_parametert
Definition
cpp_template_parameter.h:20
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
cpp
template_map.h
Generated by
1.17.0