cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
cpp_template_args.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_TEMPLATE_ARGS_H
13
#define CPROVER_CPP_CPP_TEMPLATE_ARGS_H
14
15
#include <
util/expr.h
>
16
#include <
util/invariant.h
>
17
18
// A data structures for template arguments, i.e.,
19
// a sequence of types/expressions of the form <E1, T2, ...>.
20
// Not to be confused with the template parameters!
21
22
class
cpp_template_args_baset
:
public
irept
23
{
24
public
:
25
cpp_template_args_baset
():
irept
(ID_template_args)
26
{
27
}
28
29
typedef
exprt::operandst
argumentst
;
30
31
argumentst
&
arguments
()
32
{
33
return
(
argumentst
&)(
add
(ID_arguments).
get_sub
());
34
}
35
36
const
argumentst
&
arguments
()
const
37
{
38
return
(
const
argumentst
&)(
find
(ID_arguments).
get_sub
());
39
}
40
};
41
42
// the non-yet typechecked variant
43
44
class
cpp_template_args_non_tct
:
public
cpp_template_args_baset
45
{
46
};
47
48
inline
cpp_template_args_non_tct
&
to_cpp_template_args_non_tc
(
49
irept
&irep)
50
{
51
PRECONDITION
(irep.
id
() == ID_template_args);
52
return
static_cast<
cpp_template_args_non_tct
&
>
(irep);
53
}
54
55
inline
const
cpp_template_args_non_tct
&
to_cpp_template_args_non_tc
(
56
const
irept
&irep)
57
{
58
PRECONDITION
(irep.
id
() == ID_template_args);
59
return
static_cast<
const
cpp_template_args_non_tct
&
>
(irep);
60
}
61
62
// the already typechecked variant
63
64
class
cpp_template_args_tct
:
public
cpp_template_args_baset
65
{
66
public
:
67
bool
has_unassigned
()
const
68
{
69
const
argumentst
&_arguments=
arguments
();
70
for
(argumentst::const_iterator
71
it=_arguments.begin();
72
it!=_arguments.end();
73
it++)
74
if
(it->id()==ID_unassigned ||
75
it->type().id()==ID_unassigned)
76
return
true
;
77
78
return
false
;
79
}
80
};
81
82
inline
cpp_template_args_tct
&
to_cpp_template_args_tc
(
irept
&irep)
83
{
84
PRECONDITION
(irep.
id
() == ID_template_args);
85
return
static_cast<
cpp_template_args_tct
&
>
(irep);
86
}
87
88
inline
const
cpp_template_args_tct
&
to_cpp_template_args_tc
(
const
irept
&irep)
89
{
90
PRECONDITION
(irep.
id
() == ID_template_args);
91
return
static_cast<
const
cpp_template_args_tct
&
>
(irep);
92
}
93
94
#endif
// CPROVER_CPP_CPP_TEMPLATE_ARGS_H
cpp_template_args_baset::arguments
const argumentst & arguments() const
Definition
cpp_template_args.h:36
cpp_template_args_baset::argumentst
exprt::operandst argumentst
Definition
cpp_template_args.h:29
cpp_template_args_baset::cpp_template_args_baset
cpp_template_args_baset()
Definition
cpp_template_args.h:25
cpp_template_args_baset::arguments
argumentst & arguments()
Definition
cpp_template_args.h:31
cpp_template_args_non_tct
Definition
cpp_template_args.h:45
cpp_template_args_tct
Definition
cpp_template_args.h:65
cpp_template_args_tct::has_unassigned
bool has_unassigned() const
Definition
cpp_template_args.h:67
exprt::operandst
std::vector< exprt > operandst
Definition
expr.h:59
irept
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition
irep.h:364
irept::find
const irept & find(const irep_idt &name) const
Definition
irep.cpp:93
irept::irept
irept(const irep_idt &_id)
Definition
irep.h:377
irept::get_sub
subt & get_sub()
Definition
irep.h:448
irept::id
const irep_idt & id() const
Definition
irep.h:388
irept::add
irept & add(const irep_idt &name)
Definition
irep.cpp:103
to_cpp_template_args_non_tc
cpp_template_args_non_tct & to_cpp_template_args_non_tc(irept &irep)
Definition
cpp_template_args.h:48
to_cpp_template_args_tc
cpp_template_args_tct & to_cpp_template_args_tc(irept &irep)
Definition
cpp_template_args.h:82
expr.h
invariant.h
PRECONDITION
#define PRECONDITION(CONDITION)
Definition
invariant.h:463
cpp
cpp_template_args.h
Generated by
1.17.0