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_always_inline)
38  is_always_inline = true;
39  else if(type.id()==ID_auto)
40  {
41  // ignore
42  }
43  else if(type.id()==ID_msc_declspec)
44  {
45  const exprt &as_expr=
46  static_cast<const exprt &>(static_cast<const irept &>(type));
47  forall_operands(it, as_expr)
48  if(it->id()==ID_thread)
49  is_thread_local=true;
50  }
51  else if(type.id()==ID_alias &&
52  type.has_subtype() &&
53  type.subtype().id()==ID_string_constant)
54  {
55  alias=type.subtype().get(ID_value);
56  }
57  else if(type.id()==ID_asm &&
58  type.has_subtype() &&
59  type.subtype().id()==ID_string_constant)
60  {
61  asm_label=type.subtype().get(ID_value);
62  }
63  else if(type.id()==ID_section &&
64  type.has_subtype() &&
65  type.subtype().id()==ID_string_constant)
66  {
67  section=type.subtype().get(ID_value);
68  }
69 }
The type of an expression.
Definition: type.h:22
#define forall_subtypes(it, type)
Definition: type.h:161
bool has_subtype() const
Definition: type.h:79
const irep_idt & id() const
Definition: irep.h:189
void read(const typet &type)
const irep_idt & get(const irep_namet &name) const
Definition: irep.cpp:213
Base class for tree-like data structures with sharing.
Definition: irep.h:86
#define forall_operands(it, expr)
Definition: expr.h:17
Base class for all expressions.
Definition: expr.h:42
const typet & subtype() const
Definition: type.h:33
irep_idt asm_label