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
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:37
typet
The type of an expression, extends irept.
Definition: type.h:29
c_storage_spect::section
irep_idt section
Definition: c_storage_spec.h:52
c_storage_spect::is_extern
bool is_extern
Definition: c_storage_spec.h:44
c_storage_spect::is_register
bool is_register
Definition: c_storage_spec.h:44
c_storage_spect::c_storage_spect
c_storage_spect(const typet &type)
Definition: c_storage_spec.h:23
type.h
Defines typet, type_with_subtypet and type_with_subtypest.
c_storage_spect::is_inline
bool is_inline
Definition: c_storage_spec.h:45
c_storage_spect::asm_label
irep_idt asm_label
Definition: c_storage_spec.h:51
c_storage_spect::alias
irep_idt alias
Definition: c_storage_spec.h:48
dstringt::empty
bool empty() const
Definition: dstring.h:88
c_storage_spect::is_used
bool is_used
Definition: c_storage_spec.h:45
c_storage_spect
Definition: c_storage_spec.h:16
dstringt::clear
void clear()
Definition: dstring.h:142
c_storage_spect::operator!=
bool operator!=(const c_storage_spect &other) const
Definition: c_storage_spec.h:69
c_storage_spect::read
void read(const typet &type)
Definition: c_storage_spec.cpp:14
c_storage_spect::operator==
bool operator==(const c_storage_spect &other) const
Definition: c_storage_spec.h:54
c_storage_spect::clear
void clear()
Definition: c_storage_spec.h:29
c_storage_spect::c_storage_spect
c_storage_spect()
Definition: c_storage_spec.h:18
c_storage_spect::is_weak
bool is_weak
Definition: c_storage_spec.h:45
c_storage_spect::is_thread_local
bool is_thread_local
Definition: c_storage_spec.h:45
c_storage_spect::is_static
bool is_static
Definition: c_storage_spec.h:44
c_storage_spect::operator|=
c_storage_spect & operator|=(const c_storage_spect &other)
Definition: c_storage_spec.h:74
c_storage_spect::is_typedef
bool is_typedef
Definition: c_storage_spec.h:44