CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cpp_declarator_converter.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: C++ Language Type Checking
4
5Author: 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 "cpp_declaration.h"
16
17class cpp_scopet;
18class symbolt;
19
20// converts a cpp_declator plus some
21// additional information stored in the class
22// into a symbol
23
25{
26public:
29
35
37 const typet &type, // already typechecked
38 const cpp_storage_spect &storage_spec,
39 const cpp_member_spect &member_spec,
40 cpp_declaratort &declarator);
41
43 const cpp_declarationt &declaration,
44 cpp_declaratort &declarator)
45 {
46 return convert(
47 declaration.type(),
48 declaration.storage_spec(),
49 declaration.member_spec(),
50 declarator);
51 }
52
54
55protected:
60 bool is_code;
61
64
66 const cpp_storage_spect &storage_spec,
67 const cpp_member_spect &member_spec,
68 cpp_declaratort &declarator);
69
71 symbolt &symbol,
72 cpp_declaratort &declarator);
73
74 void operator_overloading_rules(const symbolt &symbol);
75 void main_function_rules(const symbolt &symbol);
76
77 void enforce_rules(const symbolt &symbol);
78
80 typet &type,
81 bool force_constant);
82
83 bool is_code_type(const typet &type) const
84 {
85 return type.id() == ID_code ||
86 (type.id() == ID_template &&
87 to_template_type(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
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
const cpp_member_spect & member_spec() const
const cpp_storage_spect & storage_spec() const
void handle_initializer(symbolt &symbol, cpp_declaratort &declarator)
void check_array_types(typet &type, bool force_constant)
symbolt & convert_new_symbol(const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
bool is_code_type(const typet &type) const
symbolt & convert(const cpp_declarationt &declaration, cpp_declaratort &declarator)
void operator_overloading_rules(const symbolt &symbol)
void combine_types(const source_locationt &source_location, const typet &decl_type, symbolt &symbol)
void main_function_rules(const symbolt &symbol)
symbolt & convert(const typet &type, const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
class cpp_typecheckt & cpp_typecheck
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:38
typet & type()
Return the type of the expression.
Definition expr.h:84
const irep_idt & id() const
Definition irep.h:388
Symbol table entry.
Definition symbol.h:28
const typet & subtype() const
The type of an expression, extends irept.
Definition type.h:29
C++ Language Type Checking.
template_typet & to_template_type(typet &type)