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  for(const typet &subtype : to_type_with_subtypes(type).subtypes())
20  read(subtype);
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 }
void read(const typet &type)
irep_idt asm_label
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:383
const irep_idt & id() const
Definition: irep.h:407
const irep_idt & get_value() const
The type of an expression, extends irept.
Definition: type.h:28
const typet & subtype() const
Definition: type.h:47
bool has_subtype() const
Definition: type.h:65
#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:198