cprover
cpp_declarator_converter.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: C++ Language Type Checking
4 
5 Author: Daniel Kroening, kroening@cs.cmu.edu
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_CPP_CPP_DECLARATOR_CONVERTER_H
13 #define CPROVER_CPP_CPP_DECLARATOR_CONVERTER_H
14 
15 #include <util/symbol.h>
16 
17 #include "cpp_declarator.h"
18 #include "cpp_declaration.h"
19 #include "cpp_scope.h"
20 
21 // converts a cpp_declator plus some
22 // additional information stored in the class
23 // into a symbol
24 
26 {
27 public:
29  class cpp_typecheckt &_cpp_typecheck);
30 
31  bool is_typedef;
34  bool is_friend;
36 
38  const typet &type, // already typechecked
39  const cpp_storage_spect &storage_spec,
40  const cpp_member_spect &member_spec,
41  cpp_declaratort &declarator);
42 
44  const cpp_declarationt &declaration,
45  cpp_declaratort &declarator)
46  {
47  return convert(
48  declaration.type(),
49  declaration.storage_spec(),
50  declaration.member_spec(),
51  declarator);
52  }
53 
55 
56 protected:
61  bool is_code;
62 
63  void get_final_identifier();
65 
67  const cpp_storage_spect &storage_spec,
68  const cpp_member_spect &member_spec,
69  cpp_declaratort &declarator);
70 
71  void handle_initializer(
72  symbolt &symbol,
73  cpp_declaratort &declarator);
74 
75  void operator_overloading_rules(const symbolt &symbol);
76  void main_function_rules(const symbolt &symbol);
77 
78  void enforce_rules(const symbolt &symbol);
79 
80  void check_array_types(
81  typet &type,
82  bool force_constant);
83 
84  bool is_code_type(const typet &type) const
85  {
86  return type.id()==ID_code ||
87  (type.id()==ID_template && type.subtype().id()==ID_code);
88  }
89 
90  void combine_types(
91  const source_locationt &source_location,
92  const typet &decl_type,
93  symbolt &symbol);
94 };
95 
96 #endif // CPROVER_CPP_CPP_DECLARATOR_CONVERTER_H
The type of an expression, extends irept.
Definition: type.h:27
void main_function_rules(const symbolt &symbol)
void check_array_types(typet &type, bool force_constant)
const cpp_storage_spect & storage_spec() const
Symbol table entry.
class cpp_typecheckt & cpp_typecheck
bool is_code_type(const typet &type) const
typet & type()
Return the type of the expression.
Definition: expr.h:68
Symbol table entry.
Definition: symbol.h:27
C++ Language Type Checking.
const cpp_member_spect & member_spec() const
const irep_idt & id() const
Definition: irep.h:259
symbolt & convert_new_symbol(const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
void enforce_rules(const symbolt &symbol)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:35
C++ Language Type Checking.
cpp_declarator_convertert(class cpp_typecheckt &_cpp_typecheck)
C++ Language Type Checking.
symbolt & convert(const cpp_declarationt &declaration, cpp_declaratort &declarator)
void operator_overloading_rules(const symbolt &symbol)
symbolt & convert(const typet &type, const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
const typet & subtype() const
Definition: type.h:38
void combine_types(const source_locationt &source_location, const typet &decl_type, symbolt &symbol)
void handle_initializer(symbolt &symbol, cpp_declaratort &declarator)