CBMC
merged_type.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: A type that holds a combination of types
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
#ifndef CPROVER_ANSI_C_MERGED_TYPE_H
10
#define CPROVER_ANSI_C_MERGED_TYPE_H
11
12
#include <
util/type.h
>
13
15
class
merged_typet
:
public
type_with_subtypest
16
{
17
public
:
18
merged_typet
() :
type_with_subtypest
(ID_merged_type, {})
19
{
20
}
21
22
typet
&
last_type
()
23
{
24
return
subtypes
().back();
25
}
26
};
27
29
inline
const
merged_typet
&
to_merged_type
(
const
typet
&type)
30
{
31
PRECONDITION
(type.
id
() == ID_merged_type);
32
DATA_INVARIANT
(
33
!
static_cast<
const
type_with_subtypest
&
>
(type).subtypes().empty(),
34
"merge_typet has at least one subtype"
);
35
return
static_cast<
const
merged_typet
&
>
(type);
36
}
37
39
inline
merged_typet
&
to_merged_type
(
typet
&type)
40
{
41
PRECONDITION
(type.
id
() == ID_merged_type);
42
DATA_INVARIANT
(
43
!
static_cast<
const
type_with_subtypest
&
>
(type).subtypes().empty(),
44
"merge_typet has at least one subtype"
);
45
return
static_cast<
merged_typet
&
>
(type);
46
}
47
48
#endif // CPROVER_ANSI_C_MERGED_TYPE_H
merged_typet::merged_typet
merged_typet()
Definition:
merged_type.h:18
type_with_subtypest
Type with multiple subtypes.
Definition:
type.h:206
typet
The type of an expression, extends irept.
Definition:
type.h:28
type_with_subtypest::subtypes
subtypest & subtypes()
Definition:
type.h:222
type.h
to_merged_type
const merged_typet & to_merged_type(const typet &type)
conversion to merged_typet
Definition:
merged_type.h:29
DATA_INVARIANT
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
Definition:
invariant.h:510
PRECONDITION
#define PRECONDITION(CONDITION)
Definition:
invariant.h:463
irept::id
const irep_idt & id() const
Definition:
irep.h:396
merged_typet
holds a combination of types
Definition:
merged_type.h:15
merged_typet::last_type
typet & last_type()
Definition:
merged_type.h:22
src
ansi-c
merged_type.h
Generated by
1.8.17