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 }
The type of an expression, extends irept.
Definition: type.h:27
#define forall_subtypes(it, type)
Definition: type.h:216
bool has_subtype() const
Definition: type.h:56
const irep_idt & id() const
Definition: irep.h:259
void read(const typet &type)
const irep_idt & get(const irep_namet &name) const
Definition: irep.cpp:212
Base class for tree-like data structures with sharing.
Definition: irep.h:156
#define forall_operands(it, expr)
Definition: expr.h:20
Base class for all expressions.
Definition: expr.h:54
const typet & subtype() const
Definition: type.h:38
irep_idt asm_label