34 std::set<std::string> s;
58 std::istream &instream,
59 const std::string &path,
60 std::ostream &outstream,
64 return c_preprocess(instream, outstream, message_handler);
68 const char *ext=
strrchr(path.c_str(),
'.');
69 if(ext!=
nullptr && std::string(ext)==
".ipp")
71 std::ifstream infile(path);
75 while(infile.read(&ch, 1))
85 std::istream &instream,
86 const std::string &path,
95 std::ostringstream o_preprocessed;
99 if(
preprocess(instream, path, o_preprocessed, message_handler))
102 std::istringstream i_preprocessed(o_preprocessed.str());
106 cpp_parser.set_file(path);
107 cpp_parser.in=&i_preprocessed;
110 bool result=cpp_parser.parse();
120 const std::string &module,
133 return linking(symbol_table, new_symbol_table, message_handler);
159 out <<
"LINKAGE " << linkage_spec.
linkage().
get(ID_value) <<
":\n";
161 for(
const auto &i : linkage_spec.
items())
174 for(
const auto &i : namespace_spec.
items())
194 out <<
"UNKNOWN: " << item.
pretty() <<
'\n';
199 return std::make_unique<cpp_languaget>();
230 const std::string &code,
240 std::istringstream i_preprocessed(code);
245 cpp_parser.in=&i_preprocessed;
247 bool result=cpp_parser.parse();
249 if(cpp_parser.parse_tree.items.empty())
bool ansi_c_entry_point(symbol_table_baset &symbol_table, message_handlert &message_handler, const c_object_factory_parameterst &object_factory_parameters)
bool c_preprocess(std::istream &instream, std::ostream &outstream, message_handlert &message_handler)
ANSI-C preprocessing.
struct configt::ansi_ct ansi_c
void output(std::ostream &out) const
bool is_namespace_spec() const
cpp_linkage_spect & get_linkage_spec()
cpp_declarationt & get_declaration()
bool is_declaration() const
bool is_linkage_spec() const
cpp_namespace_spect & get_namespace_spec()
bool from_type(const typet &type, std::string &code, const namespacet &ns) override
Formats the given type in a language-specific way.
bool parse(std::istream &instream, const std::string &path, message_handlert &message_handler) override
bool type_to_name(const typet &type, std::string &name, const namespacet &ns) override
Encodes the given type in a language-specific way.
c_object_factory_parameterst object_factory_params
bool typecheck(symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler) override
bool preprocess(std::istream &instream, const std::string &path, std::ostream &outstream, message_handlert &message_handler) override
ANSI-C preprocessing.
void show_parse(std::ostream &out, message_handlert &) override
bool generate_support_functions(symbol_table_baset &symbol_table, message_handlert &message_handler) override
Create language-specific support functions, such as __CPROVER_start, __CPROVER_initialize and languag...
std::set< std::string > extensions() const override
~cpp_languaget() override
bool from_expr(const exprt &expr, std::string &code, const namespacet &ns) override
Formats the given expression in a language-specific way.
void modules_provided(std::set< std::string > &modules) override
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.
cpp_parse_treet cpp_parse_tree
const itemst & items() const
const itemst & items() const
const irep_idt & get_namespace() const
void swap(cpp_parse_treet &cpp_parse_tree)
bool get_namespace() const
Base class for all expressions.
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
const irep_idt & get(const irep_idt &name) const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
The symbol table base class interface.
The type of an expression, extends irept.
void cpp_internal_additions(std::ostream &out)
std::unique_ptr< languaget > new_cpp_language()
std::string cpp_type2name(const typet &type)
bool cpp_typecheck(cpp_parse_treet &cpp_parse_tree, symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler)
C++ Language Type Checking.
std::string type2cpp(const typet &type, const namespacet &ns)
std::string expr2cpp(const exprt &expr, const namespacet &ns)
std::string get_base_name(const std::string &in, bool strip_suffix)
cleans a filename from path and extension
bool linking(symbol_table_baset &dest_symbol_table, const symbol_table_baset &new_symbol_table, message_handlert &message_handler)
Merges the symbol table new_symbol_table into dest_symbol_table, renaming symbols from new_symbol_tab...
void remove_internal_symbols(symbol_table_baset &symbol_table, message_handlert &mh, const bool keep_file_local)
Removes internal symbols from a symbol table A symbol is EXPORTED if it is a.
Remove symbols that are internal only.
char * strrchr(const char *src, int c)