cprover
c_storage_spec.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module:
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
#include "
c_storage_spec.h
"
10
11
#include <
util/expr.h
>
12
13
void
c_storage_spect::read
(
const
typet
&type)
14
{
15
if
(type.
id
()==ID_merged_type ||
16
type.
id
()==ID_code)
17
{
18
forall_subtypes
(it, type)
19
read
(*it);
20
}
21
else
if
(type.
id
()==ID_static)
22
is_static
=
true
;
23
else
if
(type.
id
()==ID_thread_local)
24
is_thread_local
=
true
;
25
else
if
(type.
id
()==ID_inline)
26
is_inline
=
true
;
27
else
if
(type.
id
()==ID_extern)
28
is_extern
=
true
;
29
else
if
(type.
id
()==ID_typedef)
30
is_typedef
=
true
;
31
else
if
(type.
id
()==ID_register)
32
is_register
=
true
;
33
else
if
(type.
id
()==ID_weak)
34
is_weak
=
true
;
35
else
if
(type.
id
() == ID_used)
36
is_used
=
true
;
37
else
if
(type.
id
()==ID_auto)
38
{
39
// ignore
40
}
41
else
if
(type.
id
()==ID_msc_declspec)
42
{
43
const
exprt
&as_expr=
44
static_cast<const exprt &>(static_cast<const irept &>(type));
45
forall_operands
(it, as_expr)
46
if
(it->id()==ID_thread)
47
is_thread_local
=
true
;
48
}
49
else
if
(type.
id
()==ID_alias &&
50
type.
has_subtype
() &&
51
type.
subtype
().
id
()==ID_string_constant)
52
{
53
alias
=type.
subtype
().
get
(ID_value);
54
}
55
else
if
(type.
id
()==ID_asm &&
56
type.
has_subtype
() &&
57
type.
subtype
().
id
()==ID_string_constant)
58
{
59
asm_label
=type.
subtype
().
get
(ID_value);
60
}
61
else
if
(type.
id
()==ID_section &&
62
type.
has_subtype
() &&
63
type.
subtype
().
id
()==ID_string_constant)
64
{
65
section
=type.
subtype
().
get
(ID_value);
66
}
67
}
typet::subtype
const typet & subtype() const
Definition:
type.h:38
typet
The type of an expression, extends irept.
Definition:
type.h:27
typet::has_subtype
bool has_subtype() const
Definition:
type.h:56
c_storage_spec.h
c_storage_spect::section
irep_idt section
Definition:
c_storage_spec.h:52
c_storage_spect::is_extern
bool is_extern
Definition:
c_storage_spec.h:44
exprt
Base class for all expressions.
Definition:
expr.h:54
c_storage_spect::is_register
bool is_register
Definition:
c_storage_spec.h:44
expr.h
c_storage_spect::is_inline
bool is_inline
Definition:
c_storage_spec.h:44
forall_operands
#define forall_operands(it, expr)
Definition:
expr.h:20
c_storage_spect::asm_label
irep_idt asm_label
Definition:
c_storage_spec.h:51
irept::id
const irep_idt & id() const
Definition:
irep.h:259
c_storage_spect::alias
irep_idt alias
Definition:
c_storage_spec.h:48
c_storage_spect::is_used
bool is_used
Definition:
c_storage_spec.h:44
forall_subtypes
#define forall_subtypes(it, type)
Definition:
type.h:216
c_storage_spect::read
void read(const typet &type)
Definition:
c_storage_spec.cpp:13
irept::get
const irep_idt & get(const irep_namet &name) const
Definition:
irep.cpp:212
c_storage_spect::is_weak
bool is_weak
Definition:
c_storage_spec.h:44
c_storage_spect::is_thread_local
bool is_thread_local
Definition:
c_storage_spec.h:44
c_storage_spect::is_static
bool is_static
Definition:
c_storage_spec.h:44
c_storage_spect::is_typedef
bool is_typedef
Definition:
c_storage_spec.h:44
ansi-c
c_storage_spec.cpp
Generated by
1.8.16