cprover
|
#include <cpp_language.h>
Public Member Functions | |
bool | preprocess (std::istream &instream, const std::string &path, std::ostream &outstream) override |
ANSI-C preprocessing. More... | |
bool | parse (std::istream &instream, const std::string &path) override |
bool | generate_support_functions (symbol_tablet &symbol_table) override |
Create language-specific support functions, such as __CPROVER_start, __CPROVER_initialize and language-specific library functions. More... | |
bool | typecheck (symbol_tablet &symbol_table, const std::string &module) override |
bool | merge_symbol_table (symbol_tablet &dest, symbol_tablet &src, const std::string &module, class replace_symbolt &replace_symbol) const |
void | show_parse (std::ostream &out) override |
~cpp_languaget () override | |
cpp_languaget () | |
bool | from_expr (const exprt &expr, std::string &code, const namespacet &ns) override |
Formats the given expression in a language-specific way. More... | |
bool | from_type (const typet &type, std::string &code, const namespacet &ns) override |
Formats the given type in a language-specific way. More... | |
bool | type_to_name (const typet &type, std::string &name, const namespacet &ns) override |
Encodes the given type in a language-specific way. More... | |
bool | to_expr (const std::string &code, const std::string &module, exprt &expr, const namespacet &ns) override |
Parses the given string into an expression. More... | |
std::unique_ptr< languaget > | new_language () override |
std::string | id () const override |
std::string | description () const override |
std::set< std::string > | extensions () const override |
void | modules_provided (std::set< std::string > &modules) override |
![]() | |
virtual void | get_language_options (const cmdlinet &) |
virtual void | dependencies (const std::string &module, std::set< std::string > &modules) |
virtual void | methods_provided (std::unordered_set< irep_idt > &methods) const |
virtual void | convert_lazy_method (const irep_idt &function_id, symbol_table_baset &symbol_table) |
virtual bool | final (symbol_table_baset &symbol_table) |
Final adjustments, e.g. More... | |
virtual bool | interfaces (symbol_tablet &symbol_table) |
void | set_should_generate_opaque_method_stubs (bool should_generate_stubs) |
Turn on or off stub generation. More... | |
languaget () | |
virtual | ~languaget () |
Protected Member Functions | |
void | show_parse (std::ostream &out, const cpp_itemt &item) |
std::string | main_symbol () |
![]() | |
void | generate_opaque_method_stubs (symbol_tablet &symbol_table) |
When there are opaque methods (e.g. More... | |
virtual irep_idt | generate_opaque_stub_body (symbolt &symbol, symbol_tablet &symbol_table) |
To generate the stub function for the opaque function in question. More... | |
virtual parameter_symbolt | build_stub_parameter_symbol (const symbolt &function_symbol, size_t parameter_index, const code_typet::parametert ¶meter) |
To build the parameter symbol and choose its name. More... | |
Protected Attributes | |
cpp_parse_treet | cpp_parse_tree |
std::string | parse_path |
![]() | |
bool | generate_opaque_stubs =false |
bool | language_options_initialized =false |
Additional Inherited Members | |
![]() | |
static irep_idt | get_stub_return_symbol_name (const irep_idt &function_id) |
To get the name of the symbol to be used for the return value of the function. More... | |
Definition at line 23 of file cpp_language.h.
|
override |
Definition at line 276 of file cpp_language.cpp.
|
inline |
Definition at line 52 of file cpp_language.h.
|
inlineoverridevirtual |
Reimplemented from languaget.
Definition at line 82 of file cpp_language.h.
|
overridevirtual |
Reimplemented from languaget.
Definition at line 33 of file cpp_language.cpp.
|
overridevirtual |
Formats the given expression in a language-specific way.
expr | the expression to format |
code | the formatted expression |
ns | a namespace |
Reimplemented from languaget.
Definition at line 211 of file cpp_language.cpp.
References expr2cpp().
|
overridevirtual |
Formats the given type in a language-specific way.
type | the type to format |
code | the formatted type |
ns | a namespace |
Reimplemented from languaget.
Definition at line 220 of file cpp_language.cpp.
References type2cpp().
|
overridevirtual |
Create language-specific support functions, such as __CPROVER_start, __CPROVER_initialize and language-specific library functions.
This runs after the typecheck
phase but before lazy function loading. Anything that must wait until lazy function loading is done can be deferred until final
, which runs after lazy function loading is complete. Functions introduced here are visible to lazy loading and can influence its decisions (e.g. picking the types of input parameters and globals), whereas anything introduced during final
cannot.
Implements languaget.
Definition at line 137 of file cpp_language.cpp.
References ansi_c_entry_point(), and messaget::get_message_handler().
|
inlineoverridevirtual |
Reimplemented from languaget.
Definition at line 81 of file cpp_language.h.
|
inlineprotected |
Definition at line 93 of file cpp_language.h.
bool cpp_languaget::merge_symbol_table | ( | symbol_tablet & | dest, |
symbol_tablet & | src, | ||
const std::string & | module, | ||
class replace_symbolt & | replace_symbol | ||
) | const |
|
overridevirtual |
Reimplemented from languaget.
Definition at line 51 of file cpp_language.cpp.
References get_base_name(), and parse_path.
|
inlineoverridevirtual |
Implements languaget.
Definition at line 78 of file cpp_language.h.
|
overridevirtual |
Implements languaget.
Definition at line 83 of file cpp_language.cpp.
References configt::ansi_c, cpp_parsert::clear(), config, cpp_internal_additions(), cpp_parse_tree, cpp_parser, messaget::get_message_handler(), parsert::in, cpp_parsert::mode, configt::ansi_ct::mode, cpp_parsert::parse(), parse_path, cpp_parsert::parse_tree, preprocess(), messaget::result(), parsert::set_file(), messaget::set_message_handler(), and cpp_parse_treet::swap().
|
overridevirtual |
ANSI-C preprocessing.
Reimplemented from languaget.
Definition at line 57 of file cpp_language.cpp.
References c_preprocess(), and messaget::get_message_handler().
Referenced by parse().
|
overridevirtual |
Implements languaget.
Definition at line 143 of file cpp_language.cpp.
References cpp_parse_tree, and cpp_parse_treet::items.
Referenced by show_parse().
|
protected |
Definition at line 152 of file cpp_language.cpp.
References irept::get(), cpp_itemt::get_declaration(), cpp_itemt::get_linkage_spec(), cpp_usingt::get_namespace(), cpp_namespace_spect::get_namespace(), cpp_itemt::get_namespace_spec(), cpp_itemt::get_using(), cpp_itemt::is_declaration(), cpp_itemt::is_linkage_spec(), cpp_itemt::is_namespace_spec(), cpp_itemt::is_using(), cpp_linkage_spect::items(), cpp_namespace_spect::items(), cpp_linkage_spect::linkage(), cpp_usingt::name(), cpp_declarationt::output(), irept::pretty(), and show_parse().
|
overridevirtual |
Parses the given string into an expression.
code | the string to parse |
module | prefix to be used for identifiers |
expr | the parsed expression |
ns | a namespace |
Implements languaget.
Definition at line 238 of file cpp_language.cpp.
References cpp_parsert::clear(), cpp_parser, cpp_typecheck(), messaget::get_message_handler(), parsert::in, cpp_parse_treet::items, irept::make_nil(), cpp_parsert::parse(), cpp_parsert::parse_tree, messaget::result(), parsert::set_file(), and messaget::set_message_handler().
|
overridevirtual |
Encodes the given type in a language-specific way.
type | the type to encode |
name | the encoded type |
ns | a namespace |
Reimplemented from languaget.
Definition at line 229 of file cpp_language.cpp.
References cpp_type2name().
|
overridevirtual |
Implements languaget.
Definition at line 121 of file cpp_language.cpp.
References cpp_parse_tree, cpp_typecheck(), messaget::get_message_handler(), and linking().
|
protected |
Definition at line 88 of file cpp_language.h.
Referenced by parse(), show_parse(), and typecheck().
|
protected |
Definition at line 89 of file cpp_language.h.
Referenced by modules_provided(), and parse().