CBMC
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cpp_languaget Class Reference

#include <cpp_language.h>

+ Inheritance diagram for cpp_languaget:
+ Collaboration diagram for cpp_languaget:

Public Member Functions

  Set language-specific options.
 
bool  preprocess (std::istream &instream, const std::string &path, std::ostream &outstream, message_handlert &message_handler) override
  ANSI-C preprocessing.
 
bool  parse (std::istream &instream, const std::string &path, message_handlert &message_handler) override
 
  Create language-specific support functions, such as __CPROVER_start, __CPROVER_initialize and language-specific library functions.
 
bool  typecheck (symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler) override
 
 
void  show_parse (std::ostream &out, message_handlert &) override
 
 
 
bool  from_expr (const exprt &expr, std::string &code, const namespacet &ns) override
  Formats the given expression in a language-specific way.
 
bool  from_type (const typet &type, std::string &code, const namespacet &ns) override
  Formats the given type in a language-specific way.
 
bool  type_to_name (const typet &type, std::string &name, const namespacet &ns) override
  Encodes the given type in a language-specific way.
 
bool  to_expr (const std::string &code, const std::string &module, exprt &expr, const namespacet &ns, message_handlert &message_handler) override
  Parses the given string into an expression.
 
std::unique_ptr< languagetnew_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
 
- Public Member Functions inherited from languaget
virtual void  dependencies (const std::string &module, std::set< std::string > &modules)
 
virtual void  methods_provided (std::unordered_set< irep_idt > &methods) const
  Should fill methods with the symbol identifiers of all methods this languaget can provide a body for, but doesn't populate that body in languaget::typecheck (i.e.
 
virtual void  convert_lazy_method (const irep_idt &function_id, symbol_table_baset &symbol_table, message_handlert &message_handler)
  Requests this languaget should populate the body of method function_id in symbol_table.
 
  Final adjustments, e.g.
 
virtual bool  interfaces (symbol_table_baset &symbol_table, message_handlert &message_handler)
 
  Is it possible to call three-argument typecheck() on this object?
 
virtual bool  typecheck (symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler, const bool keep_file_local)
  typecheck without removing specified entries from the symbol table
 
  languaget ()
 
 

Protected Member Functions

void  show_parse (std::ostream &out, const cpp_itemt &item)
 
std::string  main_symbol ()
 

Protected Attributes

 
std::string  parse_path
 
 

Detailed Description

Definition at line 23 of file cpp_language.h.

Constructor & Destructor Documentation

◆  ~cpp_languaget()

cpp_languaget::~cpp_languaget ( )
override

Definition at line 263 of file cpp_language.cpp.

◆  cpp_languaget()

cpp_languaget::cpp_languaget ( )
inline

Definition at line 62 of file cpp_language.h.

Member Function Documentation

◆  description()

std::string cpp_languaget::description ( ) const
inlineoverridevirtual

Implements languaget.

Definition at line 95 of file cpp_language.h.

◆  extensions()

std::set< std::string > cpp_languaget::extensions ( ) const
overridevirtual

Implements languaget.

Definition at line 32 of file cpp_language.cpp.

◆  from_expr()

bool cpp_languaget::from_expr ( const exprtexpr,
std::string &  code,
const namespacetns 
)
overridevirtual

Formats the given expression in a language-specific way.

Parameters
expr the expression to format
code the formatted expression
ns a namespace
Returns
false if conversion succeeds

Reimplemented from languaget.

Definition at line 202 of file cpp_language.cpp.

◆  from_type()

bool cpp_languaget::from_type ( const typettype,
std::string &  code,
const namespacetns 
)
overridevirtual

Formats the given type in a language-specific way.

Parameters
type the type to format
code the formatted type
ns a namespace
Returns
false if conversion succeeds

Reimplemented from languaget.

Definition at line 211 of file cpp_language.cpp.

◆  generate_support_functions()

bool cpp_languaget::generate_support_functions ( symbol_table_basetsymbol_table,
message_handlertmessage_handler 
)
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 136 of file cpp_language.cpp.

◆  id()

std::string cpp_languaget::id ( ) const
inlineoverridevirtual

Implements languaget.

Definition at line 94 of file cpp_language.h.

◆  main_symbol()

std::string cpp_languaget::main_symbol ( )
inlineprotected

Definition at line 108 of file cpp_language.h.

◆  merge_symbol_table()

bool cpp_languaget::merge_symbol_table ( symbol_table_basetdest,
const std::string &  module,
class replace_symboltreplace_symbol 
) const

◆  modules_provided()

void cpp_languaget::modules_provided ( std::set< std::string > &  modules )
overridevirtual

Reimplemented from languaget.

Definition at line 51 of file cpp_language.cpp.

◆  new_language()

std::unique_ptr< languaget > cpp_languaget::new_language ( )
inlineoverridevirtual

Implements languaget.

Definition at line 89 of file cpp_language.h.

◆  parse()

bool cpp_languaget::parse ( std::istream &  instream,
const std::string &  path,
message_handlertmessage_handler 
)
overridevirtual

Implements languaget.

Definition at line 84 of file cpp_language.cpp.

◆  preprocess()

bool cpp_languaget::preprocess ( std::istream &  instream,
const std::string &  path,
std::ostream &  outstream,
message_handlertmessage_handler 
)
overridevirtual

ANSI-C preprocessing.

Reimplemented from languaget.

Definition at line 57 of file cpp_language.cpp.

◆  set_language_options()

void cpp_languaget::set_language_options ( const optionst &  ,
)
inlineoverridevirtual

Set language-specific options.

Reimplemented from languaget.

Definition at line 27 of file cpp_language.h.

◆  show_parse() [1/2]

void cpp_languaget::show_parse ( std::ostream &  out,
const cpp_itemtitem 
)
protected

Definition at line 150 of file cpp_language.cpp.

◆  show_parse() [2/2]

void cpp_languaget::show_parse ( std::ostream &  out,
)
overridevirtual

Implements languaget.

Definition at line 144 of file cpp_language.cpp.

◆  to_expr()

bool cpp_languaget::to_expr ( const std::string &  code,
const std::string &  module,
exprtexpr,
const namespacetns,
message_handlertmessage_handler 
)
overridevirtual

Parses the given string into an expression.

Parameters
code the string to parse
module prefix to be used for identifiers
expr the parsed expression
ns a namespace
message_handler a message handler
Returns
false if the conversion succeeds

Implements languaget.

Definition at line 229 of file cpp_language.cpp.

◆  type_to_name()

bool cpp_languaget::type_to_name ( const typettype,
std::string &  name,
const namespacetns 
)
overridevirtual

Encodes the given type in a language-specific way.

Parameters
type the type to encode
name the encoded type
ns a namespace
Returns
false if the conversion succeeds

Reimplemented from languaget.

Definition at line 220 of file cpp_language.cpp.

◆  typecheck()

bool cpp_languaget::typecheck ( symbol_table_basetsymbol_table,
const std::string &  module,
message_handlertmessage_handler 
)
overridevirtual

Implements languaget.

Definition at line 118 of file cpp_language.cpp.

Member Data Documentation

◆  cpp_parse_tree

cpp_parse_treet cpp_languaget::cpp_parse_tree
protected

Definition at line 101 of file cpp_language.h.

◆  object_factory_params

c_object_factory_parameterst cpp_languaget::object_factory_params
protected

Definition at line 104 of file cpp_language.h.

◆  parse_path

std::string cpp_languaget::parse_path
protected

Definition at line 102 of file cpp_language.h.


The documentation for this class was generated from the following files:

AltStyle によって変換されたページ (->オリジナル) /