cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
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/string_constant.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
for
(
const
typet
&subtype :
to_type_with_subtypes
(type).subtypes())
19
read
(subtype);
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
for
(
const
auto
&op : as_expr.
operands
())
46
{
47
if
(op.id() == ID_thread)
48
is_thread_local
=
true
;
49
}
50
}
51
else
if
(
52
type.
id
() == ID_alias && type.
has_subtype
() &&
53
to_type_with_subtype
(type).subtype().
id
() == ID_string_constant)
54
{
55
alias
=
to_string_constant
(
to_type_with_subtype
(type).subtype()).
value
();
56
}
57
else
if
(
58
type.
id
() == ID_asm && !
to_type_with_subtypes
(type).subtypes().empty() &&
59
to_type_with_subtypes
(type).subtypes()[0].
id
() == ID_string_constant)
60
{
61
asm_label
=
62
to_string_constant
(
to_type_with_subtypes
(type).subtypes()[0]).
value
();
63
}
64
else
if
(
65
type.
id
() == ID_section && type.
has_subtype
() &&
66
to_type_with_subtype
(type).subtype().
id
() == ID_string_constant)
67
{
68
section
=
to_string_constant
(
to_type_with_subtype
(type).subtype()).
value
();
69
}
70
}
c_storage_spec.h
c_storage_spect::is_inline
bool is_inline
Definition
c_storage_spec.h:47
c_storage_spect::is_weak
bool is_weak
Definition
c_storage_spec.h:47
c_storage_spect::is_extern
bool is_extern
Definition
c_storage_spec.h:46
c_storage_spect::is_typedef
bool is_typedef
Definition
c_storage_spec.h:46
c_storage_spect::read
void read(const typet &type)
Definition
c_storage_spec.cpp:13
c_storage_spect::alias
irep_idt alias
Definition
c_storage_spec.h:50
c_storage_spect::is_used
bool is_used
Definition
c_storage_spec.h:47
c_storage_spect::section
irep_idt section
Definition
c_storage_spec.h:54
c_storage_spect::asm_label
irep_idt asm_label
Definition
c_storage_spec.h:53
c_storage_spect::is_static
bool is_static
Definition
c_storage_spec.h:46
c_storage_spect::is_thread_local
bool is_thread_local
Definition
c_storage_spec.h:47
c_storage_spect::is_register
bool is_register
Definition
c_storage_spec.h:46
exprt
Base class for all expressions.
Definition
expr.h:57
exprt::operands
operandst & operands()
Definition
expr.h:95
irept
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition
irep.h:364
irept::id
const irep_idt & id() const
Definition
irep.h:388
string_constantt::value
void value(const irep_idt &)
Definition
string_constant.cpp:27
typet
The type of an expression, extends irept.
Definition
type.h:29
typet::has_subtype
bool has_subtype() const
Definition
type.h:64
string_constant.h
to_string_constant
const string_constantt & to_string_constant(const exprt &expr)
Definition
string_constant.h:48
to_type_with_subtypes
const type_with_subtypest & to_type_with_subtypes(const typet &type)
Definition
type.h:252
to_type_with_subtype
const type_with_subtypet & to_type_with_subtype(const typet &type)
Definition
type.h:208
ansi-c
c_storage_spec.cpp
Generated by
1.17.0