cprover
c_storage_spec.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 
10 #ifndef CPROVER_ANSI_C_C_STORAGE_SPEC_H
11 #define CPROVER_ANSI_C_C_STORAGE_SPEC_H
12 
13 #include <util/type.h>
14 
16 {
17 public:
19  {
20  clear();
21  }
22 
23  explicit c_storage_spect(const typet &type)
24  {
25  clear();
26  read(type);
27  }
28 
29  void clear()
30  {
31  is_typedef=false;
32  is_extern=false;
33  is_thread_local=false;
34  is_static=false;
35  is_register=false;
36  is_inline=false;
37  is_weak=false;
38  is_used = false;
39  alias.clear();
40  asm_label.clear();
41  section.clear();
42  }
43 
46 
47  // __attribute__((alias("foo")))
49 
50  // GCC asm labels __asm__("foo") - these change the symbol name
53 
54  bool operator==(const c_storage_spect &other) const
55  {
56  return is_typedef==other.is_typedef &&
57  is_extern==other.is_extern &&
58  is_static==other.is_static &&
59  is_register==other.is_register &&
61  is_inline==other.is_inline &&
62  is_weak==other.is_weak &&
63  is_used == other.is_used &&
64  alias==other.alias &&
65  asm_label==other.asm_label &&
66  section==other.section;
67  }
68 
69  bool operator!=(const c_storage_spect &other) const
70  {
71  return !(*this==other);
72  }
73 
75  {
76  is_typedef |=other.is_typedef;
77  is_extern |=other.is_extern;
78  is_static |=other.is_static;
79  is_register |=other.is_register;
80  is_inline |=other.is_inline;
82  is_weak |=other.is_weak;
83  is_used |=other.is_used;
84  if(alias.empty())
85  alias=other.alias;
86  if(asm_label.empty())
87  asm_label=other.asm_label;
88  if(section.empty())
89  section=other.section;
90 
91  return *this;
92  }
93 
94  void read(const typet &type);
95 };
96 
97 #endif // CPROVER_ANSI_C_C_STORAGE_SPEC_H
The type of an expression, extends irept.
Definition: type.h:27
c_storage_spect & operator|=(const c_storage_spect &other)
c_storage_spect(const typet &type)
void read(const typet &type)
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
Definition: dstring.h:35
bool operator!=(const c_storage_spect &other) const
void clear()
Definition: dstring.h:129
bool operator==(const c_storage_spect &other) const
bool empty() const
Definition: dstring.h:75
irep_idt asm_label
Defines typet, type_with_subtypet and type_with_subtypest.