cprover
Loading...
Searching...
No Matches
c_storage_spec.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9#include "c_storage_spec.h"
10
12
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 forall_operands(it, as_expr)
46 if(it->id()==ID_thread)
47 is_thread_local=true;
48 }
49 else if(
50 type.id() == ID_alias && type.has_subtype() &&
51 to_type_with_subtype(type).subtype().id() == ID_string_constant)
52 {
53 alias =
55 }
56 else if(
57 type.id() == ID_asm && !to_type_with_subtypes(type).subtypes().empty() &&
58 to_type_with_subtypes(type).subtypes()[0].id() == ID_string_constant)
59 {
60 asm_label =
62 }
63 else if(
64 type.id() == ID_section && type.has_subtype() &&
65 to_type_with_subtype(type).subtype().id() == ID_string_constant)
66 {
67 section =
69 }
70}
void read(const typet &type)
Base class for all expressions.
Definition expr.h:54
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition irep.h:372
const irep_idt & id() const
Definition irep.h:396
const irep_idt & get_value() const
subtypest & subtypes()
Definition type.h:206
The type of an expression, extends irept.
Definition type.h:29
bool has_subtype() const
Definition type.h:66
#define forall_operands(it, expr)
Definition expr.h:18
const string_constantt & to_string_constant(const exprt &expr)
const type_with_subtypest & to_type_with_subtypes(const typet &type)
Definition type.h:221
const type_with_subtypet & to_type_with_subtype(const typet &type)
Definition type.h:177