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  alias.clear();
39  asm_label.clear();
40  section.clear();
41  }
42 
45 
46  // __attribute__((alias("foo")))
48 
49  // GCC asm labels __asm__("foo") - these change the symbol name
52 
53  bool operator==(const c_storage_spect &other) const
54  {
55  return is_typedef==other.is_typedef &&
56  is_extern==other.is_extern &&
57  is_static==other.is_static &&
58  is_register==other.is_register &&
60  is_inline==other.is_inline &&
61  is_weak==other.is_weak &&
62  alias==other.alias &&
63  asm_label==other.asm_label &&
64  section==other.section;
65  }
66 
67  bool operator!=(const c_storage_spect &other) const
68  {
69  return !(*this==other);
70  }
71 
73  {
74  is_typedef |=other.is_typedef;
75  is_extern |=other.is_extern;
76  is_static |=other.is_static;
77  is_register |=other.is_register;
78  is_inline |=other.is_inline;
80  is_weak |=other.is_weak;
81  if(alias.empty())
82  alias=other.alias;
83  if(asm_label.empty())
84  asm_label=other.asm_label;
85  if(section.empty())
86  section=other.section;
87 
88  return *this;
89  }
90 
91  void read(const typet &type);
92 };
93 
94 #endif // CPROVER_ANSI_C_C_STORAGE_SPEC_H
The type of an expression.
Definition: type.h:20
c_storage_spect & operator|=(const c_storage_spect &other)
c_storage_spect(const typet &type)
void read(const typet &type)
bool operator!=(const c_storage_spect &other) const
void clear()
Definition: dstring.h:115
bool operator==(const c_storage_spect &other) const
bool empty() const
Definition: dstring.h:61
irep_idt asm_label