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 #include <util/string_constant.h>
13 
14 void c_storage_spect::read(const typet &type)
15 {
16  if(type.id()==ID_merged_type ||
17  type.id()==ID_code)
18  {
19  forall_subtypes(it, type)
20  read(*it);
21  }
22  else if(type.id()==ID_static)
23  is_static=true;
24  else if(type.id()==ID_thread_local)
25  is_thread_local=true;
26  else if(type.id()==ID_inline)
27  is_inline=true;
28  else if(type.id()==ID_extern)
29  is_extern=true;
30  else if(type.id()==ID_typedef)
31  is_typedef=true;
32  else if(type.id()==ID_register)
33  is_register=true;
34  else if(type.id()==ID_weak)
35  is_weak=true;
36  else if(type.id() == ID_used)
37  is_used = true;
38  else if(type.id()==ID_auto)
39  {
40  // ignore
41  }
42  else if(type.id()==ID_msc_declspec)
43  {
44  const exprt &as_expr=
45  static_cast<const exprt &>(static_cast<const irept &>(type));
46  forall_operands(it, as_expr)
47  if(it->id()==ID_thread)
48  is_thread_local=true;
49  }
50  else if(type.id()==ID_alias &&
51  type.has_subtype() &&
52  type.subtype().id()==ID_string_constant)
53  {
55  }
56  else if(type.id()==ID_asm &&
57  type.has_subtype() &&
58  type.subtype().id()==ID_string_constant)
59  {
61  }
62  else if(type.id()==ID_section &&
63  type.has_subtype() &&
64  type.subtype().id()==ID_string_constant)
65  {
67  }
68 }
typet::subtype
const typet & subtype() const
Definition: type.h:47
typet
The type of an expression, extends irept.
Definition: type.h:29
typet::has_subtype
bool has_subtype() const
Definition: type.h:65
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
to_string_constant
const string_constantt & to_string_constant(const exprt &expr)
Definition: string_constant.h:31
string_constant.h
exprt
Base class for all expressions.
Definition: expr.h:53
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:45
forall_operands
#define forall_operands(it, expr)
Definition: expr.h:18
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:418
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:45
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:14
c_storage_spect::is_weak
bool is_weak
Definition: c_storage_spec.h:45
irept
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition: irep.h:394
c_storage_spect::is_thread_local
bool is_thread_local
Definition: c_storage_spec.h:45
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
string_constantt::get_value
const irep_idt & get_value() const
Definition: string_constant.h:22