Go to the documentation of this file.
47 std::stringstream func_decl_stream;
48 std::stringstream compound_body_stream;
49 std::stringstream global_var_stream;
50 std::stringstream global_decl_stream;
51 std::stringstream global_decl_header_stream;
52 std::stringstream func_body_stream;
60 const symbolt &symbol=named_symbol.second;
62 if(symbol.
type.
id()!=ID_code)
69 for(code_typet::parameterst::iterator
70 it2=parameters.begin();
71 it2!=parameters.end();
74 typet &type=it2->type();
76 if(type.
id() == ID_union_tag && type.
get_bool(ID_C_transparent_union))
82 new_type_sym.
type.
set(ID_C_transparent_union,
true);
85 symbols_transparent.
add(new_type_sym);
88 type.
remove(ID_C_transparent_union);
92 for(
const auto &symbol_pair : symbols_transparent.
symbols)
97 typedef std::unordered_map<irep_idt, unsigned> unique_tagst;
98 unique_tagst unique_tags;
102 std::set<std::string> symbols_sorted;
106 bool tag_added=
false;
111 if((symbol.
type.
id()==ID_union || symbol.
type.
id()==ID_struct) &&
115 symbol.
type.
set(ID_tag, ID_anonymous);
118 else if(symbol.
type.
id()==ID_c_enum &&
122 symbol.
type.
add(ID_tag).
set(ID_C_base_name, ID_anonymous);
126 const std::string name_str=
id2string(named_symbol.first);
128 (symbol.
type.
id()==ID_union ||
129 symbol.
type.
id()==ID_struct ||
130 symbol.
type.
id()==ID_c_enum))
132 std::string new_tag=symbol.
type.
id()==ID_c_enum?
137 if(tag_pos!=std::string::npos)
138 new_tag.erase(0, tag_pos+4);
139 const std::string new_tag_base=new_tag;
141 for(std::pair<unique_tagst::iterator, bool>
142 unique_entry=unique_tags.insert(std::make_pair(new_tag, 0));
143 !unique_entry.second;
144 unique_entry=unique_tags.insert(std::make_pair(new_tag, 0)))
146 new_tag=new_tag_base+
"$"+
148 ++(unique_entry.first->second);
151 if(symbol.
type.
id()==ID_c_enum)
153 symbol.
type.
add(ID_tag).
set(ID_C_base_name, new_tag);
157 symbol.
type.
set(ID_tag, new_tag);
162 if((!tag_added || symbol.
is_type) &&
167 bool inserted=symbols_sorted.insert(name_str).second;
174 bool skip_function_main=
false;
175 std::vector<std::string> header_files;
176 for(std::set<std::string>::const_iterator
177 it=symbols_sorted.begin();
178 it!=symbols_sorted.end();
186 (type_id==ID_struct ||
192 global_decl_stream <<
"// " << symbol.
name <<
'\n';
193 global_decl_stream <<
"// " << symbol.
location <<
'\n';
195 std::string location_file =
200 location_file.length() > 1 &&
201 location_file[location_file.length() - 1] ==
'h')
203 std::vector<std::string>::iterator it =
204 find(header_files.begin(), header_files.end(), location_file);
205 if(it == header_files.end())
207 header_files.push_back(location_file);
208 global_decl_header_stream <<
"#include \"" << location_file
213 if(type_id==ID_c_enum)
215 else if(type_id == ID_struct)
234 else if(symbol.
type.
id()==ID_code)
236 goto_functionst::function_mapt::const_iterator func_entry=
241 func_entry->second.body_available() &&
242 (symbol.
name == ID_main ||
245 skip_function_main=
true;
251 for(std::set<std::string>::const_iterator
252 it=symbols_sorted.begin();
253 it!=symbols_sorted.end();
258 if(symbol.
type.
id()!=ID_code ||
271 for(std::set<std::string>::const_iterator
272 it=symbols_sorted.begin();
273 it!=symbols_sorted.end();
280 (symbol.
type.
id() == ID_struct || symbol.
type.
id() == ID_union))
283 compound_body_stream);
288 for(std::set<std::string>::const_iterator
292 os <<
"#include <" << *it <<
">\n";
297 os << global_decl_header_stream.str() <<
'\n';
299 if(global_var_stream.str().find(
"NULL")!=std::string::npos ||
300 func_body_stream.str().find(
"NULL")!=std::string::npos)
302 os <<
"#ifndef NULL\n"
303 <<
"#define NULL ((void*)0)\n"
306 if(func_body_stream.str().find(
"FENCE")!=std::string::npos)
308 os <<
"#ifndef FENCE\n"
309 <<
"#define FENCE(x) ((void)0)\n"
312 if(func_body_stream.str().find(
"IEEE_FLOAT_")!=std::string::npos)
314 os <<
"#ifndef IEEE_FLOAT_EQUAL\n"
315 <<
"#define IEEE_FLOAT_EQUAL(x,y) ((x)==(y))\n"
317 <<
"#ifndef IEEE_FLOAT_NOTEQUAL\n"
318 <<
"#define IEEE_FLOAT_NOTEQUAL(x,y) ((x)!=(y))\n"
323 os << global_decl_stream.str() <<
'\n';
329 os << func_decl_stream.str() <<
'\n';
331 os << compound_body_stream.str() <<
'\n';
333 os << global_var_stream.str() <<
'\n';
335 os << func_body_stream.str();
341 std::ostream &os_body)
351 if(symbol.
type.
id() == ID_struct)
357 else if(symbol.
type.
id() == ID_union)
363 else if(symbol.
type.
id() == ID_c_enum)
373 const typet &unresolved,
378 type.
id() == ID_c_enum_tag || type.
id() == ID_struct_tag ||
379 type.
id() == ID_union_tag)
387 else if(type.
id()==ID_array || type.
id()==ID_pointer)
395 if(type.
id()==ID_array)
400 for(find_symbols_sett::const_iterator
407 type_symbol.
type.
id() == ID_c_enum
409 : (type_symbol.
type.
id() == ID_union ? ID_union_tag
416 else if(type.
id()==ID_struct || type.
id()==ID_union)
418 else if(type.
id()==ID_c_enum)
424 const typet &unresolved,
436 const irept &bases = type.
find(ID_bases);
437 std::stringstream base_decls;
475 std::stringstream struct_body;
479 const typet &comp_type = comp.type();
481 if(comp_type.
id()==ID_code ||
482 comp.get_bool(ID_from_base) ||
483 comp.get_is_padding())
486 const typet *non_array_type = &comp_type;
487 while(non_array_type->
id()==ID_array)
488 non_array_type = &(non_array_type->
subtype());
492 if(non_array_type->
id()!=ID_pointer)
500 struct_body <<
indent(1) <<
"// " << comp_name <<
'\n';
505 std::string fake_unique_name=
"NO/SUCH/NS::"+
id2string(comp_name);
506 std::string s=
make_decl(fake_unique_name, comp.type());
509 if(comp_type.
id()==ID_c_bit_field &&
520 else if(comp_type.
id()==ID_signedbv)
524 struct_body <<
"long long int " << comp_name
527 struct_body <<
"__signedbv<" << t.
get_width() <<
"> "
532 else if(comp_type.
id()==ID_unsignedbv)
536 struct_body <<
"unsigned long long " << comp_name
539 struct_body <<
"__unsignedbv<" << t.
get_width() <<
"> "
547 struct_body <<
";\n";
550 typet unresolved_clean=unresolved;
555 td_entry.first.get(ID_identifier) == unresolved.
get(ID_identifier) &&
558 unresolved_clean.
remove(ID_C_typedef);
559 typedef_str = td_entry.second;
560 std::pair<typedef_mapt::iterator, bool> td_map_entry =
563 if(!td_map_entry.first->second.early)
564 td_map_entry.first->second.type_decl_str.clear();
571 if(!base_decls.str().empty())
574 os <<
": " << base_decls.str();
578 os << struct_body.str();
593 if(type.
get_bool(ID_C_transparent_union))
594 os <<
" __attribute__ ((__transparent_union__))";
596 os <<
" __attribute__ ((__packed__))";
597 if(!typedef_str.
empty())
598 os <<
" " << typedef_str;
618 for(c_enum_typet::memberst::iterator
623 const irep_idt bn=it->get_base_name();
630 it->set_base_name(new_bn);
634 std::make_pair(bn, it->get_base_name()));
640 os <<
" __attribute__ ((__packed__))";
647 std::list<irep_idt> &local_static,
648 std::list<irep_idt> &local_type_decls)
669 std::unordered_set<irep_idt> typedef_names;
671 typedef_names.insert(td.first);
696 std::unordered_set<irep_idt> deps;
710 std::unordered_set<irep_idt> &dependencies)
715 std::unordered_set<irep_idt> local_deps;
717 if(type.
id()==ID_code)
722 for(
const auto ¶m : code_type.
parameters())
725 else if(type.
id()==ID_pointer || type.
id()==ID_array)
730 type.
id() == ID_c_enum_tag || type.
id() == ID_struct_tag ||
731 type.
id() == ID_union_tag)
737 const irep_idt &typedef_str=type.
get(ID_C_typedef);
739 if(!typedef_str.
empty())
741 std::pair<typedef_mapt::iterator, bool> entry=
745 (early && entry.first->second.type_decl_str.empty()))
747 if(typedef_str==
"__gnuc_va_list" || typedef_str ==
"va_list")
757 std::ostringstream oss;
758 oss <<
"typedef " <<
make_decl(typedef_str, t) <<
';';
760 entry.first->second.type_decl_str=oss.str();
761 entry.first->second.dependencies=local_deps;
767 entry.first->second.early=
true;
769 for(
const auto &d : local_deps)
773 td_entry->second.early=
true;
777 dependencies.insert(typedef_str);
780 dependencies.insert(local_deps.begin(), local_deps.end());
790 std::map<std::string, symbolt> symbols_sorted;
792 symbols_sorted.insert(
793 {
id2string(symbol_entry.first), symbol_entry.second});
795 for(
const auto &symbol_entry : symbols_sorted)
797 const symbolt &symbol=symbol_entry.second;
819 std::vector<typedef_infot> typedefs_sorted;
824 std::map<std::string, typedef_infot> to_insert;
826 std::unordered_set<irep_idt> typedefs_done;
827 std::unordered_map<irep_idt, std::unordered_set<irep_idt>> forward_deps,
831 if(!td.second.type_decl_str.empty())
833 if(td.second.dependencies.empty())
835 to_insert.insert({
id2string(td.first), td.second});
839 forward_deps.insert({td.first, td.second.dependencies});
840 for(
const auto &d : td.second.dependencies)
841 reverse_deps[d].insert(td.first);
845 while(!to_insert.empty())
850 to_insert.erase(to_insert.begin());
852 typedefs_sorted.push_back(t);
857 if(r_it==reverse_deps.end())
861 std::unordered_set<irep_idt> &r_deps = r_it->second;
862 for(std::unordered_set<irep_idt>::iterator it = r_deps.begin();
865 auto f_it=forward_deps.find(*it);
866 if(f_it==forward_deps.end())
873 std::unordered_set<irep_idt> &f_deps = f_it->second;
882 to_insert.insert({
id2string(*it), td_entry->second});
883 forward_deps.erase(*it);
893 for(
const auto &td : typedefs_sorted)
894 os << td.type_decl_str <<
'\n';
896 if(!typedefs_sorted.empty())
921 os <<
"// " << symbol.
name <<
'\n';
922 os <<
"// " << symbol.
location <<
'\n';
928 std::set<std::string> symbols_sorted;
929 for(find_symbols_sett::const_iterator
934 bool inserted=symbols_sorted.insert(
id2string(*it)).second;
938 for(std::set<std::string>::const_iterator
939 it=symbols_sorted.begin();
940 it!=symbols_sorted.end();
953 local_static_decls.emplace(symbol.
name, d);
957 os <<
"// " << symbol.
name <<
'\n';
958 os <<
"// " << symbol.
location <<
'\n';
960 std::list<irep_idt> empty_static, empty_types;
975 const symbolt *argc_sym=
nullptr;
983 const symbolt *argv_sym=
nullptr;
994 const symbolt *return_sym=
nullptr;
995 if(!
ns.
lookup(
"return'", return_sym))
1005 if(code.get_statement()==ID_function_call)
1008 if(func.
id()==ID_symbol)
1027 const bool skip_main,
1028 std::ostream &os_decl,
1029 std::ostream &os_body,
1038 goto_functionst::function_mapt::const_iterator func_entry=
1041 func_entry->second.body_available())
1044 std::list<irep_idt> type_decls, local_static;
1046 std::unordered_set<irep_idt> typedef_names;
1048 typedef_names.insert(td.first);
1052 func_entry->second.body,
1083 os_body <<
"// " << symbol.
name <<
'\n';
1084 os_body <<
"// " << symbol.
location <<
'\n';
1101 symbol.
name!=ID_main)
1103 os_decl <<
"// " << symbol.
name <<
'\n';
1104 os_decl <<
"// " << symbol.
location <<
'\n';
1109 os_decl <<
"// " << symbol.
name <<
'\n';
1110 os_decl <<
"// " << symbol.
location <<
'\n';
1124 exprt::operandst::iterator &before)
1132 exprt::operandst::iterator first_found=operands.end();
1139 if(it->id()==ID_code &&
1151 found=syms.find(identifier)!=syms.end();
1172 if(first_found==operands.end())
1189 if(first_found!=operands.end())
1201 const std::list<irep_idt> &local_static,
1203 std::list<irep_idt> &type_decls)
1207 for(std::list<irep_idt>::const_reverse_iterator
1208 it=local_static.rbegin();
1209 it!=local_static.rend();
1212 local_static_declst::const_iterator d_it=
1213 local_static_decls.find(*it);
1217 std::list<irep_idt> redundant;
1221 exprt::operandst::iterator before=b.
operands().end();
1228 dest_ptr->
operands().insert(before, d);
1235 const std::list<irep_idt> &type_decls)
1239 for(std::list<irep_idt>::const_reverse_iterator
1240 it=type_decls.rbegin();
1241 it!=type_decls.rend();
1247 std::ostringstream os_body;
1248 os_body << *it <<
" */\n";
1250 type.
id() == ID_c_enum
1252 : (type.
id() == ID_union ? ID_union_tag : ID_struct_tag);
1262 exprt::operandst::iterator before=b.
operands().end();
1269 dest_ptr->
operands().insert(before, skip);
1281 if(expr.
id()==ID_struct)
1293 exprt::operandst::iterator o_it=old_ops.begin();
1294 for(
const auto &old_comp : old_components)
1296 const bool is_zero_bit_field =
1297 old_comp.type().id() == ID_c_bit_field &&
1300 if(!old_comp.get_is_padding() && !is_zero_bit_field)
1309 else if(expr.
id()==ID_union)
1315 !u_type_f.
get_bool(ID_C_transparent_union))
1322 else if(u.
op().
id()==ID_constant &&
1344 expr.
id() == ID_typecast &&
1351 else if(expr.
id()==ID_code &&
1352 to_code(expr).get_statement()==ID_function_call &&
1367 if(parameters.size()==arguments.size())
1369 code_typet::parameterst::const_iterator it=parameters.begin();
1373 if(type.
id()==ID_union &&
1374 type.
get_bool(ID_C_transparent_union))
1376 if(it2->id() == ID_typecast && it2->type() == type)
1380 if(it2->id()==ID_constant &&
1383 const typet &comp_type=
1386 if(comp_type.
id()==ID_pointer)
1396 else if(expr.
id()==ID_constant &&
1397 expr.
type().
id()==ID_signedbv)
1402 if(!cformat.
empty())
1404 declared_enum_constants_mapt::const_iterator entry=
1408 entry->first!=entry->second)
1409 expr.
set(ID_C_cformat, entry->second);
1412 expr.
remove(ID_C_cformat);
1423 if(type.
id()==ID_code)
1429 for(code_typet::parameterst::iterator
1436 if(type.
id()==ID_array)
1440 (type.
id()!=ID_union && type.
id()!=ID_struct) ||
1464 const bool use_system_headers,
1465 const bool use_all_headers,
1466 const bool include_harness,
1482 const bool use_system_headers,
1483 const bool use_all_headers,
1484 const bool include_harness,
1501 std::string base_name =
1504 return (base_name == module && symbol_module == module);
1509 const bool use_system_headers,
1510 const bool use_all_headers,
1511 const bool include_harness,
1513 const std::string module,
1518 it != symbol_table.
end();
1521 symbolt &new_symbol = it.get_writeable_symbol();
1524 new_symbol.
type.
set(ID_C_do_not_dump, 0);
1528 new_symbol.
type.
set(ID_C_do_not_dump, 1);
void copy_to_operands(const exprt &expr)
Copy the given argument to the end of exprt's operands.
std::unordered_map< irep_idt, irep_idt > declared_enum_constants_mapt
#define UNREACHABLE
This should be used to mark dead code.
const componentst & components() const
bool has_symbol(const irep_idt &name) const
Check whether a symbol exists in the symbol table.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
const irep_idt & get_function() const
std::string get_base_name(const std::string &in, bool strip_suffix)
cleans a filename from path and extension
A codet representing sequential composition of program statements.
void collect_typedefs_rec(const typet &type, bool early, std::unordered_set< irep_idt > &dependencies)
Find any typedef names contained in the input type and store their declaration strings in typedef_map...
#define Forall_expr(it, expr)
dump_c_configurationt enable_include_headers()
void set_identifier(const irep_idt &identifier)
const typet & subtype() const
dump_c_configurationt disable_include_global_vars()
static std::string indent(const unsigned n)
const goto_functionst & goto_functions
void set_comment(const irep_idt &comment)
static dump_c_configurationt default_configuration
The default used for dump-c and dump-cpp.
void find_type_and_expr_symbols(const exprt &src, find_symbols_sett &dest)
#define Forall_operands(it, expr)
const componentt & get_component(const irep_idt &component_name) const
Get the reference to a component with given name.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
#define CHECK_RETURN(CONDITION)
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
The type of an expression, extends irept.
std::vector< parametert > parameterst
void find_symbols_or_nexts(const exprt &src, find_symbols_sett &dest)
Add to the set dest the sub-expressions of src with id ID_symbol or ID_next_symbol.
Used for configuring the behaviour of dump_c.
Base type for structs and unions.
typet type
Type of symbol.
void find_non_pointer_type_symbols(const exprt &src, find_symbols_sett &dest)
std::vector< c_enum_membert > memberst
irept & add(const irep_namet &name)
const irept & find(const irep_namet &name) const
void replace(const union_find_replacet &replace_map, string_not_contains_constraintt &constraint)
void update()
Update all indices.
optionalt< std::string > main
bool follow_compounds
Define whether to follow compunds recursively.
A codet representing the declaration of a local variable.
Union constructor from single element.
static instructiont make_end_function(const source_locationt &l=source_locationt::nil())
targett add(instructiont &&instruction)
Adds a given instruction at the end.
void convert_function_declaration(const symbolt &symbol, const bool skip_main, std::ostream &os_decl, std::ostream &os_body, local_static_declst &local_static_decls)
system_library_symbolst system_symbols
Base class for all expressions.
std::vector< componentt > componentst
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
irep_idt base_name
Base (non-scoped) name.
std::unique_ptr< languaget > language
A struct tag type, i.e., struct_typet with an identifier.
void convert_compound(const typet &type, const typet &unresolved, bool recursive, std::ostream &os)
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
static bool find_block_position_rec(const irep_idt &identifier, codet &root, code_blockt *&dest, exprt::operandst::iterator &before)
struct configt::ansi_ct ansi_c
dump_c_configurationt disable_include_function_bodies()
function_mapt function_map
Expression to hold a symbol (variable)
static instructiont make_decl(const symbol_exprt &symbol, const source_locationt &l=source_locationt::nil())
void insert_local_type_decls(code_blockt &b, const std::list< irep_idt > &type_decls)
std::string expr_to_string(const exprt &expr)
convertedt converted_compound
static instructiont make_assignment(const code_assignt &_code, const source_locationt &l=source_locationt::nil())
Create an assignment instruction.
virtual iteratort begin() override
A union tag type, i.e., union_typet with an identifier.
Fixed-width bit-vector with unsigned binary interpretation.
std::set< std::string > system_headers
const codet & to_code(const exprt &expr)
std::unique_ptr< languaget > new_cpp_language()
std::string make_decl(const irep_idt &identifier, const typet &type)
Struct constructor from list of elements.
void dump_typedefs(std::ostream &os) const
Print all typedefs that are not covered via typedef struct xyz { ...
code_operandst & statements()
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
typet & type()
Return the type of the expression.
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
declared_enum_constants_mapt declared_enum_constants
codet representation of a function call statement.
bool get_bool(const irep_namet &name) const
bool include_typedefs
Include the typedefs in the dump.
std::ostream & operator<<(std::ostream &out, dump_ct &src)
std::string strip_string(const std::string &s)
Remove all whitespace characters from either end of a string.
convertedt converted_global
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
void cleanup_type(typet &type)
const tag_typet & to_tag_type(const typet &type)
Cast a typet to a tag_typet.
const unsignedbv_typet & to_unsignedbv_type(const typet &type)
Cast a typet to an unsignedbv_typet.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
bool has_operands() const
Return true if there is at least one operand.
virtual iteratort end() override
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
const std::string & id2string(const irep_idt &d)
bool is_type_internal(const typet &type, std::set< std::string > &out_system_headers) const
Helper function to call is_symbol_internal_symbol on a nameless fake symbol with the given type,...
void convert_compound_enum(const typet &type, std::ostream &os)
void cleanup_expr(exprt &expr)
std::unordered_map< irep_idt, code_declt > local_static_declst
void dump_c(const goto_functionst &src, const bool use_system_headers, const bool use_all_headers, const bool include_harness, const namespacet &ns, std::ostream &out)
#define PRECONDITION(CONDITION)
const source_locationt & source_location() const
const irep_idt & get_identifier() const
bool get_is_padding() const
Fixed-width bit-vector with two's complement interpretation.
std::unordered_set< irep_idt > convertedt
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a typet to a c_bit_field_typet.
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
static bool module_local_declaration(const symbolt &symbol, const std::string module)
#define Forall_subtypes(it, type)
#define INITIALIZE_FUNCTION
void dump_c_type_header(const goto_functionst &src, const bool use_system_headers, const bool use_all_headers, const bool include_harness, const namespacet &ns, const std::string module, std::ostream &out)
void cleanup_decl(code_declt &decl, std::list< irep_idt > &local_static, std::list< irep_idt > &local_type_decls)
std::size_t long_long_int_width
Dump Goto-Program as C/C++ Source.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const irep_idt & id() const
void insert_local_static_decls(code_blockt &b, const std::list< irep_idt > &local_static, local_static_declst &local_static_decls, std::list< irep_idt > &type_decls)
void remove(const irep_namet &name)
const code_function_callt & to_code_function_call(const codet &code)
std::vector< exprt > operandst
exprt::operandst argumentst
bool include_compounds
Include struct definitions in the dump.
void operator()(std::ostream &out)
void add(const codet &code)
A tag-based type, i.e., typet with an identifier.
bool include_headers
Include headers type declarations are borrowed from.
const parameterst & parameters() const
bool include_function_decls
Include the function declarations in the dump.
std::size_t get_width() const
irep_idt get_component_name() const
bool is_zero() const
Return whether the expression is a constant representing 0.
bool add(const symbolt &symbol)
Add a new symbol to the symbol table.
const std::string & get_string(const irep_namet &name) const
A collection of goto functions.
exprt value
Initial value of symbol.
#define forall_irep(it, irep)
bool include_global_decls
Include the global declarations in the dump.
#define POSTCONDITION(CONDITION)
const symbol_table_baset & get_symbol_table() const
Return first symbol table registered with the namespace.
Structure type, corresponds to C style structs.
C enum tag type, i.e., c_enum_typet with an identifier.
A codet representing a skip statement.
std::unordered_set< irep_idt > find_symbols_sett
dump_c_configurationt disable_include_function_decls()
bool include_global_vars
Include global variable definitions in the dump.
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
const irep_idt & get(const irep_namet &name) const
source_locationt location
Source code location of definition of symbol.
bool include_function_bodies
Include the functions in the dump.
Dump Goto-Program as C/C++ Source.
void set(const irep_namet &name, const irep_idt &value)
symbol_tablet copied_symbol_table
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
typedef_typest typedef_types
void cleanup_harness(code_blockt &b)
Replace CPROVER internal symbols in b by printable values and generate necessary declarations.
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a typet to a signedbv_typet.
std::unique_ptr< languaget > new_ansi_c_language()
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
A generic container class for the GOTO intermediate representation of one function.
void convert_compound_declaration(const symbolt &symbol, std::ostream &os_body)
declare compound types
const irep_idt & get_file() const
bool is_symbol_internal_symbol(const symbolt &symbol, std::set< std::string > &out_system_headers) const
To find out if a symbol is an internal symbol.
const typet & return_type() const
const code_blockt & to_code_block(const codet &code)
There are a large number of kinds of tree structured or tree-like data in CPROVER.
const dump_c_configurationt dump_c_config
static dump_c_configurationt type_header_configuration
The config used for dump-c-type-header.
void convert_global_variable(const symbolt &symbol, std::ostream &os, local_static_declst &local_static_decls)
static irep_idt entry_point()
Get the identifier of the entry point to a goto model.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
void collect_typedefs(const typet &type, bool early)
Find any typedef names contained in the input type and store their declaration strings in typedef_map...
source_locationt & add_source_location()
Semantic type conversion.
unsignedbv_typet size_type()
const irep_idt & get_statement() const
irep_idt module
Name of module the symbol belongs to.
Dump C from Goto Program.
const irep_idt & get_value() const
void set_identifier(const irep_idt &identifier)
irep_idt name
The unique identifier.
void dump_cpp(const goto_functionst &src, const bool use_system_headers, const bool use_all_headers, const bool include_harness, const namespacet &ns, std::ostream &out)
std::string type_to_string(const typet &type)
convertedt converted_enum
void gather_global_typedefs()
Find all global typdefs in the symbol table and store them in typedef_types.
Replace expression or type symbols by an expression or type, respectively.
Data structure for representing an arbitrary statement in a program.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.