Go to the documentation of this file.
88 if(
pos!=std::string::npos)
99 if(c_pos!=std::string::npos &&
100 dest.rfind(
"::")==c_pos)
101 dest.erase(0, c_pos+2);
102 else if(c_pos!=std::string::npos)
122 for(
const auto &symbol_id : symbols)
133 func = func.substr(0, func.rfind(
"::"));
143 if(!
shorthands.insert(std::make_pair(symbol_id, sh)).second)
147 for(
const auto &symbol_id : symbols)
163 has_collision=!
ns.
lookup(sh, symbol);
184 const std::string symbol_str =
id2string(symbol_id);
185 const std::string func = symbol_str.substr(0, symbol_str.find(
"::"));
191 const auto func_type =
192 type_checked_cast<code_typet>(func_symbol->
type);
193 const auto params = func_type.parameters();
194 for(
const auto ¶m : params)
196 const auto param_id = param.get_identifier();
197 if(param_id != symbol_id && sh ==
id_shorthand(param_id))
199 has_collision =
true;
210 shorthands.insert(std::make_pair(symbol_id, sh));
222 const std::string &declarator)
224 std::unique_ptr<qualifierst> clone = qualifiers.
clone();
226 new_qualifiers.
read(src);
228 std::string q=new_qualifiers.
as_string();
230 std::string d = declarator.empty() ? declarator :
" " + declarator;
237 if(src.
id()==ID_bool)
241 else if(src.
id()==ID_c_bool)
245 else if(src.
id()==ID_string)
249 else if(src.
id()==ID_natural ||
250 src.
id()==ID_integer ||
251 src.
id()==ID_rational)
255 else if(src.
id()==ID_empty)
259 else if(src.
id()==ID_complex)
264 else if(src.
id()==ID_floatbv)
273 return q+
"long double"+d;
278 return q +
CPROVER_PREFIX +
"floatbv[" + swidth +
"][" + fwidth +
"]";
281 else if(src.
id()==ID_fixedbv)
289 else if(src.
id()==ID_c_bit_field)
295 else if(src.
id()==ID_signedbv ||
296 src.
id()==ID_unsignedbv)
302 if(c_type==ID_char &&
305 if(src.
id()==ID_signedbv)
306 return q+
"signed char"+d;
308 return q+
"unsigned char"+d;
310 else if(c_type!=ID_wchar_t && !c_type_str.
empty())
311 return q+c_type_str+d;
318 std::string sign_str=
is_signed?
"signed ":
"unsigned ";
324 return q+sign_str+
"int"+d;
330 return q+sign_str+
"long int"+d;
335 return q+sign_str+
"char"+d;
341 return q+sign_str+
"short int"+d;
347 return q+sign_str+
"long long int"+d;
353 return q + sign_str +
"__int128" + d;
361 else if(src.
id()==ID_struct)
365 else if(src.
id()==ID_union)
369 std::string dest=q+
"union";
393 else if(src.
id()==ID_c_enum)
425 for(c_enum_typet::memberst::const_iterator it = members.begin();
431 if(it != members.begin())
434 result +=
id2string(it->get_base_name());
445 else if(src.
id()==ID_c_enum_tag)
449 std::string result=q+
"enum";
454 else if(src.
id()==ID_pointer)
458 sub_qualifiers.
read(base_type);
461 std::string new_declarator=
"*";
463 if(!q.empty() && (!declarator.empty() || base_type.
id() == ID_pointer))
465 new_declarator+=
" "+q;
468 new_declarator+=declarator;
472 base_type.
id() == ID_code ||
475 new_declarator=
"("+new_declarator+
")";
478 return convert_rec(base_type, sub_qualifiers, new_declarator);
480 else if(src.
id()==ID_array)
484 else if(src.
id()==ID_struct_tag)
489 std::string dest=q+
"struct";
497 else if(src.
id()==ID_union_tag)
502 std::string dest=q+
"union";
510 else if(src.
id()==ID_code)
516 std::string dest=declarator+
"(";
520 if(parameters.empty())
527 for(code_typet::parameterst::const_iterator
528 it=parameters.begin();
529 it!=parameters.end();
532 if(it!=parameters.begin())
535 if(it->get_identifier().empty())
539 std::string arg_declarator=
564 const typet *non_ptr_type = &return_type;
565 while(non_ptr_type->
id()==ID_pointer)
568 if(non_ptr_type->
id()==ID_code ||
569 non_ptr_type->
id()==ID_array)
570 dest=
convert_rec(return_type, ret_qualifiers, dest);
572 dest=
convert_rec(return_type, ret_qualifiers,
"")+
" "+dest;
578 if(dest[dest.size()-1]==
' ')
579 dest.resize(dest.size()-1);
584 else if(src.
id()==ID_vector)
588 const mp_integer size_int = numeric_cast_v<mp_integer>(vector_type.
size());
593 if(tmp==
"signed char" || tmp==
"char")
595 else if(tmp==
"signed short int")
597 else if(tmp==
"signed int")
599 else if(tmp==
"signed long long int")
601 else if(tmp==
"float")
603 else if(tmp==
"double")
609 dest+=
" __attribute__((vector_size (";
611 dest+=
"*sizeof("+subtype+
"))))";
616 else if(src.
id()==ID_constructor ||
617 src.
id()==ID_destructor)
619 return q+
"__attribute__(("+
id2string(src.
id())+
")) void"+d;
640 const std::string &qualifiers_str,
641 const std::string &declarator_str)
663 const std::string &qualifiers,
664 const std::string &declarator,
665 bool inc_struct_body,
666 bool inc_padding_components)
671 assert(inc_struct_body || !inc_padding_components);
675 std::string dest=qualifiers+
"struct";
688 if(
component.get_is_padding() && !inc_padding_components)
718 const std::string &declarator_str)
735 const std::string &declarator_str,
736 bool inc_size_if_possible)
739 std::string array_suffix;
741 if(
to_array_type(src).size().is_nil() || !inc_size_if_possible)
751 declarator_str + array_suffix);
756 unsigned &precedence)
766 if(to_type.
id()==ID_c_bool &&
770 if(to_type.
id()==ID_bool &&
774 std::string dest =
"(" +
convert(to_type) +
")";
790 const std::string &symbol1,
791 const std::string &symbol2,
837 const std::string &symbol,
849 std::string dest=symbol+
" { ";
879 for(
size_t i=1; i<src.
operands().size(); i+=2)
881 std::string op1, op2;
887 if(src.
operands()[i].id()==ID_member_name)
890 src.
operands()[i].get(ID_component_name);
905 display_component_name=component_name;
909 op1=
"."+
id2string(display_component_name);
931 std::string dest =
"LET ";
935 const auto &values = src.
values();
936 auto values_it = values.begin();
960 std::string op0, op1, op2;
974 const exprt &designator = src.
op1();
1001 std::string dest=
"cond {\n";
1018 condition=!condition;
1028 const std::string &symbol,
1029 unsigned precedence,
1030 bool full_parentheses)
1049 bool use_parentheses0=
1051 (precedence==p0 && full_parentheses) ||
1052 (precedence==p0 && src.
id()!=op0.
id());
1054 if(use_parentheses0)
1057 if(use_parentheses0)
1064 bool use_parentheses1=
1066 (precedence==p1 && full_parentheses) ||
1067 (precedence==p1 && src.
id()!=op1.
id());
1069 if(use_parentheses1)
1072 if(use_parentheses1)
1080 const std::string &symbol,
1081 unsigned precedence,
1082 bool full_parentheses)
1112 bool use_parentheses=
1114 (precedence==p && full_parentheses) ||
1115 (precedence==p && src.
id()!=it->id());
1129 const std::string &symbol,
1130 unsigned precedence)
1135 std::string dest=symbol;
1158 std::string dest =
"ALLOCATE";
1162 src.
type().
id() == ID_pointer &&
1169 dest += op0 +
", " + op1;
1177 unsigned &precedence)
1187 unsigned &precedence)
1202 unsigned &precedence)
1217 unsigned &precedence)
1220 return "PROB_UNIFORM(" +
convert(src.
type()) +
"," +
1228 std::string dest=name;
1249 unsigned precedence)
1256 if(*op0.rbegin()==
';')
1257 op0.resize(op0.size()-1);
1261 if(*op1.rbegin()==
';')
1262 op1.resize(op1.size()-1);
1264 std::string dest=op0;
1273 unsigned precedence)
1302 std::string dest=name;
1323 unsigned precedence)
1333 unsigned precedence)
1384 const std::string &symbol,
1385 unsigned precedence)
1424 const exprt &src,
unsigned &precedence)
1429 std::string dest=
"POINTER_ARITHMETIC(";
1461 const exprt &src,
unsigned &precedence)
1468 std::string dest=
"POINTER_DIFFERENCE(";
1473 op =
convert(binary_expr.op0().type());
1501 unsigned precedence;
1506 return "."+src.
get_string(ID_component_name);
1511 unsigned precedence;
1521 unsigned precedence)
1523 const auto &compound = src.
compound();
1528 if(compound.id() == ID_dereference)
1534 if(precedence > p || pointer.id() == ID_typecast)
1537 if(precedence > p || pointer.id() == ID_typecast)
1546 if(precedence > p || compound.id() == ID_typecast)
1549 if(precedence > p || compound.id() == ID_typecast)
1557 if(full_type.
id()!=ID_struct &&
1558 full_type.
id()!=ID_union)
1566 if(!component_name.
empty())
1573 if(!comp_expr.
get(ID_pretty_name).
empty())
1595 unsigned precedence)
1605 unsigned precedence)
1615 unsigned &precedence)
1631 to_unary_expr(src).op().
id() == ID_predicate_passive_symbol)
1637 std::unordered_map<irep_idt, irep_idt>::const_iterator entry =
1667 return "nondet_symbol("+
id2string(
id)+
")";
1672 const std::string &
id=src.
get_string(ID_identifier);
1673 return "ps("+
id+
")";
1678 const std::string &
id=src.
get_string(ID_identifier);
1679 return "pns("+
id+
")";
1684 const std::string &
id=src.
get_string(ID_identifier);
1685 return "pps("+
id+
")";
1690 const std::string &
id=src.
get_string(ID_identifier);
1696 return "nondet_bool()";
1701 unsigned &precedence)
1706 std::string result=
"<";
1726 const typet &type =
static_cast<const typet &
>(expr.
find(ID_C_c_sizeof_type));
1733 if(type_size_expr.has_value())
1734 type_size = numeric_cast<mp_integer>(*type_size_expr);
1735 auto val = numeric_cast<mp_integer>(expr);
1738 !type_size.has_value() || *type_size < 0 || !val.has_value() ||
1739 *val < *type_size || (*type_size == 0 && *val > 0))
1747 "sizeof value does not fit size_type");
1753 remainder = *val % *type_size;
1758 exprt result(ID_sizeof, t);
1759 result.
set(ID_type_arg, type);
1771 unsigned &precedence)
1778 if(type.
id()==ID_integer ||
1779 type.
id()==ID_natural ||
1780 type.
id()==ID_rational)
1784 else if(type.
id()==ID_c_enum ||
1785 type.
id()==ID_c_enum_tag)
1791 if(c_enum_type.
id()!=ID_c_enum)
1799 for(
const auto &member : members)
1801 if(member.get_value() == value)
1802 return "/*enum*/" +
id2string(member.get_base_name());
1811 std::string value_as_string =
1815 return value_as_string;
1817 return "/*enum*/" + value_as_string;
1819 else if(type.
id()==ID_rational)
1821 else if(type.
id()==ID_bv)
1826 else if(type.
id()==ID_bool)
1830 else if(type.
id()==ID_unsignedbv ||
1831 type.
id()==ID_signedbv ||
1832 type.
id()==ID_c_bit_field ||
1833 type.
id()==ID_c_bool)
1841 type.
id() == ID_c_bit_field
1843 : type.
get(ID_C_c_type);
1845 if(type.
id()==ID_c_bool)
1855 else if(int_value==
'\r')
1857 else if(int_value==
'\t')
1859 else if(int_value==
'\'')
1861 else if(int_value==
'\\')
1863 else if(int_value>=
' ' && int_value<126)
1866 dest += numeric_cast_v<char>(int_value);
1883 if(c_type==ID_unsigned_int)
1885 else if(c_type==ID_unsigned_long_int)
1887 else if(c_type==ID_signed_long_int)
1889 else if(c_type==ID_unsigned_long_long_int)
1891 else if(c_type==ID_signed_long_long_int)
1898 if(sizeof_expr_opt.has_value())
1901 dest =
convert(sizeof_expr_opt.value()) +
" /*" + dest +
"*/ ";
1907 else if(type.
id()==ID_floatbv)
1911 if(!dest.empty() && isdigit(dest[dest.size() - 1]))
1913 if(dest.find(
'.')==std::string::npos)
1923 else if(dest.size()==4 &&
1924 (dest[0]==
'+' || dest[0]==
'-'))
1930 else if(dest ==
"-inf")
1932 else if(dest ==
"+NaN")
1934 else if(dest ==
"-NaN")
1940 std::string suffix =
"";
1951 dest =
"(1.0" + suffix +
"/0.0" + suffix +
")";
1952 else if(dest ==
"-inf")
1953 dest =
"(-1.0" + suffix +
"/0.0" + suffix +
")";
1954 else if(dest ==
"+NaN")
1955 dest =
"(0.0" + suffix +
"/0.0" + suffix +
")";
1956 else if(dest ==
"-NaN")
1957 dest =
"(-0.0" + suffix +
"/0.0" + suffix +
")";
1961 else if(type.
id()==ID_fixedbv)
1965 if(!dest.empty() && isdigit(dest[dest.size() - 1]))
1973 else if(type.
id() == ID_array)
1977 else if(type.
id()==ID_pointer)
1986 dest=
"(("+
convert(type)+
")"+dest+
")";
1990 value ==
"NULL+offset")
2001 else if(type.
id()==ID_string)
2013 unsigned &precedence)
2034 unsigned &precedence)
2050 unsigned &precedence,
2051 bool include_padding_components)
2055 if(full_type.
id()!=ID_struct)
2064 if(components.size()!=src.
operands().size())
2067 std::string dest=
"{ ";
2069 exprt::operandst::const_iterator o_it=src.
operands().begin();
2077 if(o_it->type().id()==ID_code)
2080 if(
component.get_is_padding() && !include_padding_components)
2098 std::string tmp=
convert(*o_it);
2100 if(last_size+40<dest.size())
2103 last_size=dest.size();
2123 unsigned &precedence)
2127 if(type.
id() != ID_vector)
2130 std::string dest=
"{ ";
2152 if(last_size+40<dest.size())
2155 last_size=dest.size();
2170 unsigned &precedence)
2172 std::string dest=
"{ ";
2196 bool all_constant=
true;
2199 if(!it->is_constant())
2203 src.
get_bool(ID_C_string_constant) && all_constant &&
2213 dest.reserve(dest.size()+1+src.
operands().size());
2215 bool last_was_hex=
false;
2236 case '\n': dest+=
"\\n";
break;
2237 case '\t': dest+=
"\\t";
break;
2238 case '\v': dest+=
"\\v";
break;
2239 case '\b': dest+=
"\\b";
break;
2240 case '\r': dest+=
"\\r";
break;
2241 case '\f': dest+=
"\\f";
break;
2242 case '\a': dest+=
"\\a";
break;
2243 case '\\': dest+=
"\\\\";
break;
2244 case '"': dest+=
"\\\"";
break;
2247 if(ch>=
' ' && ch!=127 && ch<0xff)
2248 dest+=
static_cast<char>(ch);
2251 std::ostringstream oss;
2252 oss <<
"\\x" << std::hex << ch;
2270 if(it->is_not_nil())
2290 unsigned &precedence)
2292 std::string dest=
"{ ";
2299 std::string tmp1=
convert(*it);
2303 std::string tmp2=
convert(*it);
2305 std::string tmp=
"["+tmp1+
"]="+tmp2;
2325 if(src.
id()!=ID_compound_literal)
2342 if(src.
id()!=ID_compound_literal)
2381 const auto complement_width_expr =
2386 if(src.
id() == ID_rol)
2389 lhs_expr =
shl_exprt(op0, distance_modulo_width);
2391 rhs_expr =
ashr_exprt(op0, complement_width_expr);
2393 else if(src.
id() == ID_ror)
2396 lhs_expr =
ashr_exprt(op0, distance_modulo_width);
2398 rhs_expr =
shl_exprt(op0, complement_width_expr);
2412 unsigned precedence;
2418 const exprt &designator =
static_cast<const exprt &
>(src.
find(ID_designator));
2419 if(designator.
operands().size() != 1)
2421 unsigned precedence;
2429 if(designator_id.
id() == ID_member)
2431 dest =
"." +
id2string(designator_id.
get(ID_component_name));
2434 designator_id.
id() == ID_index && designator_id.
operands().size() == 1)
2440 unsigned precedence;
2510 unsigned &precedence)
2514 std::string dest=
"overflow(\"";
2541 return std::string(indent,
' ');
2556 if(!src.
operands()[1].operands().empty() ||
2557 !src.
operands()[2].operands().empty() ||
2558 !src.
operands()[3].operands().empty() ||
2559 !src.
operands()[4].operands().empty())
2567 if(it->operands().size()==2)
2582 if(it->operands().size()==2)
2599 if(it->id()==ID_gcc_asm_clobbered_register)
2628 unsigned precedence;
2654 unsigned precedence;
2683 unsigned precedence;
2720 unsigned precedence;
2762 unsigned precedence;
2778 const exprt &op=*it;
2780 if(op.
get(ID_statement)!=ID_block)
2782 unsigned precedence;
2815 unsigned precedence;
2823 const symbolt *symbol=
nullptr;
2834 dest +=
"__declspec(dllexport) ";
2837 if(symbol->
type.
id()==ID_code &&
2859 unsigned precedence;
2872 unsigned precedence;
2910 for(
const auto &statement : src.
statements())
2912 if(statement.get_statement() == ID_label)
2947 std::string expr_str;
2952 unsigned precedence;
2957 if(dest.empty() || *dest.rbegin()!=
';')
2967 static bool comment_done=
false;
2982 std::ostringstream oss;
2990 [](
const std::pair<irep_idt, irept> &p) { return p.first; });
3001 if(statement==ID_expression)
3004 if(statement==ID_block)
3007 if(statement==ID_switch)
3010 if(statement==ID_for)
3013 if(statement==ID_while)
3016 if(statement==ID_asm)
3019 if(statement==ID_skip)
3022 if(statement==ID_dowhile)
3025 if(statement==ID_ifthenelse)
3028 if(statement==ID_return)
3031 if(statement==ID_goto)
3034 if(statement==ID_printf)
3037 if(statement==ID_fence)
3046 if(statement==ID_assume)
3049 if(statement==ID_assert)
3052 if(statement==ID_break)
3055 if(statement==ID_continue)
3058 if(statement==ID_decl)
3061 if(statement==ID_decl_block)
3064 if(statement==ID_dead)
3067 if(statement==ID_assign)
3070 if(statement==
"lock")
3073 if(statement==
"unlock")
3076 if(statement==ID_atomic_begin)
3079 if(statement==ID_atomic_end)
3082 if(statement==ID_function_call)
3085 if(statement==ID_label)
3088 if(statement==ID_switch_case)
3091 if(statement==ID_array_set)
3094 if(statement==ID_array_copy)
3097 if(statement==ID_array_replace)
3100 if(statement == ID_set_may || statement == ID_set_must)
3104 unsigned precedence;
3122 unsigned precedence;
3135 unsigned precedence;
3148 unsigned precedence;
3179 if(it!=arguments.begin())
3194 std::string dest=
indent_str(indent)+
"printf(";
3216 std::string dest=
indent_str(indent)+
"FENCE(";
3219 { ID_WRfence, ID_RRfence, ID_RWfence, ID_WWfence,
3220 ID_RRcumul, ID_RWcumul, ID_WWcumul, ID_WRcumul,
3225 for(
unsigned i=0; !att[i].
empty(); i++)
3246 std::string dest=
indent_str(indent)+
"INPUT(";
3268 std::string dest=
indent_str(indent)+
"OUTPUT(";
3289 std::string dest=
indent_str(indent)+
"ARRAY_SET(";
3311 std::string dest=
indent_str(indent)+
"ARRAY_COPY(";
3333 std::string dest=
indent_str(indent)+
"ARRAY_REPLACE(";
3356 unsigned precedence;
3369 unsigned precedence;
3381 std::string labels_string;
3385 labels_string+=
"\n";
3388 labels_string+=
":\n";
3392 return labels_string+tmp;
3399 std::string labels_string;
3403 labels_string+=
"\n";
3405 labels_string+=
"default:\n";
3409 labels_string+=
"\n";
3411 labels_string+=
"case ";
3413 labels_string+=
":\n";
3416 unsigned next_indent=indent;
3422 return labels_string+tmp;
3432 unsigned precedence;
3440 static_cast<const codet &
>(src.
find(ID_code));
3442 std::string dest=
"\n";
3447 std::string assumption_str=
convert(assumption);
3449 dest+=assumption_str;
3462 std::string assertion_str=
convert(assertion);
3464 dest+=assertion_str;
3499 unsigned &precedence)
3504 std::string dest=
"sizeof(";
3515 const auto &cond = src.
operands().front();
3522 const auto &targets = src.
operands()[1];
3527 if(it != targets.operands().begin())
3538 if(
auto type_ptr = type_try_dynamic_cast<unsignedbv_typet>(src.
type()))
3540 const std::size_t width = type_ptr->get_width();
3541 if(width == 8 || width == 16 || width == 32 || width == 64)
3548 unsigned precedence;
3554 unsigned &precedence)
3558 if(src.
id()==ID_plus)
3561 else if(src.
id()==ID_minus)
3564 else if(src.
id()==ID_unary_minus)
3567 else if(src.
id()==ID_unary_plus)
3570 else if(src.
id()==ID_floatbv_typecast)
3574 std::string dest=
"FLOAT_TYPECAST(";
3603 else if(src.
id()==ID_sign)
3611 else if(src.
id()==ID_popcount)
3619 else if(src.
id()==
"pointer_arithmetic")
3622 else if(src.
id()==
"pointer_difference")
3625 else if(src.
id() == ID_null_object)
3626 return "NULL-object";
3628 else if(src.
id()==ID_integer_address ||
3629 src.
id()==ID_integer_address_object ||
3630 src.
id()==ID_stack_object ||
3631 src.
id()==ID_static_object)
3636 else if(src.
id()==
"builtin-function")
3639 else if(src.
id()==ID_array_of)
3642 else if(src.
id()==ID_bswap)
3654 else if(src.
id()==ID_address_of)
3658 if(
object.
id() == ID_label)
3659 return "&&" +
object.
get_string(ID_identifier);
3660 else if(
object.
id() == ID_index &&
to_index_expr(
object).index().is_zero())
3668 else if(src.
id()==ID_dereference)
3672 if(src.
type().
id() == ID_code)
3675 pointer.id() == ID_plus && pointer.operands().size() == 2 &&
3685 else if(src.
id()==ID_index)
3688 else if(src.
id()==ID_member)
3691 else if(src.
id()==
"array-member-value")
3694 else if(src.
id()==
"struct-member-value")
3697 else if(src.
id()==ID_function_application)
3700 else if(src.
id()==ID_side_effect)
3703 if(statement==ID_preincrement)
3705 else if(statement==ID_predecrement)
3707 else if(statement==ID_postincrement)
3709 else if(statement==ID_postdecrement)
3711 else if(statement==ID_assign_plus)
3713 else if(statement==ID_assign_minus)
3715 else if(statement==ID_assign_mult)
3717 else if(statement==ID_assign_div)
3719 else if(statement==ID_assign_mod)
3721 else if(statement==ID_assign_shl)
3723 else if(statement==ID_assign_shr)
3725 else if(statement==ID_assign_bitand)
3727 else if(statement==ID_assign_bitxor)
3729 else if(statement==ID_assign_bitor)
3731 else if(statement==ID_assign)
3733 else if(statement==ID_function_call)
3736 else if(statement == ID_allocate)
3738 else if(statement==ID_printf)
3740 else if(statement==ID_nondet)
3742 else if(statement==
"prob_coin")
3744 else if(statement==
"prob_unif")
3746 else if(statement==ID_statement_expression)
3748 else if(statement == ID_va_start)
3754 else if(src.
id()==ID_literal)
3757 else if(src.
id()==ID_not)
3760 else if(src.
id()==ID_bitnot)
3763 else if(src.
id()==ID_mult)
3766 else if(src.
id()==ID_div)
3769 else if(src.
id()==ID_mod)
3772 else if(src.
id()==ID_shl)
3775 else if(src.
id()==ID_ashr || src.
id()==ID_lshr)
3778 else if(src.
id()==ID_lt || src.
id()==ID_gt ||
3779 src.
id()==ID_le || src.
id()==ID_ge)
3785 else if(src.
id()==ID_notequal)
3788 else if(src.
id()==ID_equal)
3791 else if(src.
id()==ID_complex)
3794 else if(src.
id()==ID_bitand)
3797 else if(src.
id()==ID_bitxor)
3800 else if(src.
id()==ID_bitor)
3803 else if(src.
id()==ID_and)
3806 else if(src.
id()==ID_or)
3809 else if(src.
id()==ID_xor)
3812 else if(src.
id()==ID_implies)
3815 else if(src.
id()==ID_if)
3818 else if(src.
id()==ID_forall)
3821 else if(src.
id()==ID_exists)
3824 else if(src.
id()==ID_lambda)
3827 else if(src.
id()==ID_with)
3830 else if(src.
id()==ID_update)
3833 else if(src.
id()==ID_member_designator)
3836 else if(src.
id()==ID_index_designator)
3839 else if(src.
id()==ID_symbol)
3842 else if(src.
id()==ID_nondet_symbol)
3845 else if(src.
id()==ID_predicate_symbol)
3848 else if(src.
id()==ID_predicate_next_symbol)
3851 else if(src.
id()==ID_predicate_passive_symbol)
3854 else if(src.
id()==
"quant_symbol")
3857 else if(src.
id()==ID_nondet_bool)
3860 else if(src.
id()==ID_object_descriptor)
3863 else if(src.
id()==
"Hoare")
3866 else if(src.
id()==ID_code)
3869 else if(src.
id()==ID_constant)
3872 else if(src.
id() == ID_annotated_pointer_constant)
3878 else if(src.
id()==ID_string_constant)
3882 else if(src.
id()==ID_struct)
3885 else if(src.
id()==ID_vector)
3888 else if(src.
id()==ID_union)
3891 else if(src.
id()==ID_array)
3894 else if(src.
id() == ID_array_list)
3897 else if(src.
id()==ID_typecast)
3900 else if(src.
id()==ID_comma)
3903 else if(src.
id()==ID_ptr_object)
3904 return "PTR_OBJECT("+
id2string(src.
get(ID_identifier))+
")";
3906 else if(src.
id()==ID_cond)
3916 else if(src.
id()==ID_unknown)
3919 else if(src.
id()==ID_invalid)
3922 else if(src.
id()==ID_extractbit)
3925 else if(src.
id()==ID_extractbits)
3928 else if(src.
id()==ID_initializer_list ||
3929 src.
id()==ID_compound_literal)
3935 else if(src.
id()==ID_designated_initializer)
3941 else if(src.
id()==ID_sizeof)
3944 else if(src.
id()==ID_let)
3947 else if(src.
id()==ID_type)
3950 else if(src.
id() == ID_rol || src.
id() == ID_ror)
3953 else if(src.
id() == ID_conditional_target_group)
3958 else if(src.
id() == ID_bitreverse)
3962 if(function_string_opt.has_value())
3963 return *function_string_opt;
3971 static const std::map<irep_idt, std::string> function_names = {
3972 {
"buffer_size",
"BUFFER_SIZE"},
3973 {
"is_zero_string",
"IS_ZERO_STRING"},
3974 {
"object_value",
"OBJECT_VALUE"},
3975 {
"pointer_base",
"POINTER_BASE"},
3976 {
"pointer_cons",
"POINTER_CONS"},
3977 {
"zero_string",
"ZERO_STRING"},
3978 {
"zero_string_length",
"ZERO_STRING_LENGTH"},
3980 {ID_alignof,
"alignof"},
3981 {ID_builtin_offsetof,
"builtin_offsetof"},
3982 {ID_complex_imag,
"__imag__"},
3983 {ID_complex_real,
"__real__"},
3984 {ID_concatenation,
"CONCATENATION"},
3985 {ID_count_leading_zeros,
"__builtin_clz"},
3986 {ID_count_trailing_zeros,
"__builtin_ctz"},
3987 {ID_dynamic_object,
"DYNAMIC_OBJECT"},
3988 {ID_live_object,
"LIVE_OBJECT"},
3989 {ID_writeable_object,
"WRITEABLE_OBJECT"},
3990 {ID_find_first_set,
"__builtin_ffs"},
3991 {ID_floatbv_div,
"FLOAT/"},
3992 {ID_floatbv_minus,
"FLOAT-"},
3993 {ID_floatbv_mult,
"FLOAT*"},
3994 {ID_floatbv_plus,
"FLOAT+"},
3995 {ID_floatbv_rem,
"FLOAT%"},
3996 {ID_gcc_builtin_va_arg,
"gcc_builtin_va_arg"},
3999 {ID_good_pointer,
"GOOD_POINTER"},
4000 {ID_ieee_float_equal,
"IEEE_FLOAT_EQUAL"},
4001 {ID_ieee_float_notequal,
"IEEE_FLOAT_NOTEQUAL"},
4002 {ID_infinity,
"INFINITY"},
4003 {ID_is_dynamic_object,
"IS_DYNAMIC_OBJECT"},
4004 {ID_is_invalid_pointer,
"IS_INVALID_POINTER"},
4006 {ID_isfinite,
"isfinite"},
4007 {ID_isinf,
"isinf"},
4008 {ID_isnan,
"isnan"},
4009 {ID_isnormal,
"isnormal"},
4010 {ID_object_size,
"OBJECT_SIZE"},
4011 {ID_pointer_object,
"POINTER_OBJECT"},
4012 {ID_pointer_offset,
"POINTER_OFFSET"},
4017 {ID_rw_ok,
"RW_OK"},
4018 {ID_width,
"WIDTH"},
4021 const auto function_entry = function_names.find(src.
id());
4022 if(function_entry == function_names.end())
4030 unsigned precedence;
4041 const std::string &identifier)
4053 expr2c.get_shorthands(expr);
4054 return expr2c.convert(expr);
4069 return expr2c.convert(type);
4079 const std::string &identifier,
4084 return expr2c.convert_with_identifier(type, identifier);
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
std::string MetaString(const std::string &in)
virtual void read(const typet &src) override
#define UNREACHABLE
This should be used to mark dead code.
const componentst & components() const
void irep2lisp(const irept &src, lispexprt &dest)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const exprt & case_op() const
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const irep_idt & get_function() const
const irep_idt & get_comment() const
const unsignedbv_typet & to_unsignedbv_type(const typet &type)
Cast a typet to an unsignedbv_typet.
bool has_ellipsis() const
std::string convert_code_while(const code_whilet &src, unsigned indent)
A codet representing sequential composition of program statements.
const update_exprt & to_update_expr(const exprt &expr)
Cast an exprt to an update_exprt.
static exprt conditional_cast(const exprt &expr, const typet &type)
std::string convert_bitreverse(const bitreverse_exprt &src)
const char * c_str() const
const extractbit_exprt & to_extractbit_expr(const exprt &expr)
Cast an exprt to an extractbit_exprt.
std::string convert_prob_uniform(const exprt &src, unsigned &precedence)
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
codet representation of a switch-case, i.e. a case statement within a switch.
const code_function_callt & to_code_function_call(const goto_instruction_codet &code)
std::string convert_code_fence(const codet &src, unsigned indent)
side_effect_expr_function_callt & to_side_effect_expr_function_call(exprt &expr)
const lambda_exprt & to_lambda_expr(const exprt &expr)
Cast an exprt to a lambda_exprt.
const div_exprt & to_div_expr(const exprt &expr)
Cast an exprt to a div_exprt.
std::string convert_cond(const exprt &src, unsigned precedence)
Expression corresponding to op() where the bytes starting at position offset (given in number of byte...
const exprt & cond() const
codet representing a while statement.
Expression to hold a nondeterministic choice.
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.
std::string convert_union(const exprt &src, unsigned &precedence)
bool print_enum_int_value
When printing an enum-typed constant, print the integer representation.
std::string convert_conditional_target_group(const exprt &src)
codet representation of an inline assembler statement.
virtual std::string convert_annotated_pointer_constant(const annotated_pointer_constant_exprt &src, unsigned &precedence)
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
codet representation of a for statement.
const irep_idt & get_identifier() const
std::string convert_statement_expression(const exprt &src, unsigned &precendence)
The type of an expression, extends irept.
const irept::named_subt & get_pragmas() const
std::vector< parametert > parameterst
static std::string clean_identifier(const irep_idt &id)
const codet & then_case() const
An expression with three operands.
const byte_extract_exprt & to_byte_extract_expr(const exprt &expr)
std::string convert_comma(const exprt &src, unsigned precedence)
std::string convert_pointer_arithmetic(const exprt &src, unsigned &precedence)
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
bool use_library_macros
This is the string that will be printed for null pointers.
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
const irept & find(const irep_idt &name) const
std::string convert_code_assert(const codet &src, unsigned indent)
Base type for structs and unions.
std::string convert_with_identifier(const typet &src, const std::string &identifier)
Build a declaration string, which requires converting both a type and putting an identifier in the sy...
typet type
Type of symbol.
floatbv_typet long_double_type()
const constant_exprt & size() const
std::string to_ansi_c_string() const
A side_effect_exprt representation of a function call side effect.
const annotated_pointer_constant_exprt & to_annotated_pointer_constant_expr(const exprt &expr)
Cast an exprt to an annotated_pointer_constant_exprt.
std::vector< c_enum_membert > memberst
bool is_signed(const typet &t)
Convenience function – is the type signed?
std::string convert_code_function_call(const code_function_callt &src, unsigned indent)
virtual std::string convert_constant(const constant_exprt &src, unsigned &precedence)
std::string convert_update(const update_exprt &, unsigned precedence)
std::string convert_let(const let_exprt &, unsigned precedence)
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
std::string convert_byte_extract(const byte_extract_exprt &, unsigned precedence)
void replace(const union_find_replacet &replace_map, string_not_contains_constraintt &constraint)
std::string convert_code_decl_block(const codet &src, unsigned indent)
std::string convert_nondet_bool()
const string_constantt & to_string_constant(const exprt &expr)
The plus expression Associativity is not specified.
std::string convert_code_expression(const codet &src, unsigned indent)
Base class for all expressions.
const exprt & iter() const
std::string convert_quantified_symbol(const exprt &src)
std::vector< componentt > componentst
Generic base class for unary expressions.
std::string convert_array_list(const exprt &src, unsigned &precedence)
A base class for binary expressions.
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
irep_idt base_name
Base (non-scoped) name.
A struct tag type, i.e., struct_typet with an identifier.
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
std::string from_type(const namespacet &ns, const irep_idt &identifier, const typet &type)
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
bool can_cast_type< signedbv_typet >(const typet &type)
Check whether a reference to a typet is a signedbv_typet.
static expr2c_configurationt default_configuration
This prints a human readable C like syntax that closely mirrors the internals of the GOTO program.
const code_whilet & to_code_while(const codet &code)
const irep_idt & get_pretty_name() const
std::string convert_code_input(const codet &src, unsigned indent)
const exprt & cond() const
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
const bitnot_exprt & to_bitnot_expr(const exprt &expr)
Cast an exprt to a bitnot_exprt.
std::string convert_Hoare(const exprt &src)
std::string convert_code(const codet &src)
bool is_true() const
Return whether the expression is a constant representing true.
virtual std::string convert_constant_bool(bool boolean_value)
To get the C-like representation of a given boolean value.
std::string convert_array_of(const exprt &src, unsigned precedence)
std::string convert_unary_post(const exprt &src, const std::string &symbol, unsigned precedence)
struct configt::ansi_ct ansi_c
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
const complex_typet & to_complex_type(const typet &type)
Cast a typet to a complex_typet.
std::string convert_code_ifthenelse(const code_ifthenelset &src, unsigned indent)
Expression to hold a symbol (variable)
bool has_suffix(const std::string &s, const std::string &suffix)
virtual std::string convert_struct_type(const typet &src, const std::string &qualifiers_str, const std::string &declarator_str)
To generate C-like string for defining the given struct.
std::string convert_code_switch_case(const code_switch_caset &src, unsigned indent)
std::string convert_predicate_symbol(const exprt &src)
const code_fort & to_code_for(const codet &code)
std::unordered_map< irep_idt, irep_idt > shorthands
codet representation of an if-then-else statement.
A union tag type, i.e., union_typet with an identifier.
Fixed-width bit-vector with unsigned binary interpretation.
const floatbv_typecast_exprt & to_floatbv_typecast_expr(const exprt &expr)
Cast an exprt to a floatbv_typecast_exprt.
std::string convert_trinary(const ternary_exprt &src, const std::string &symbol1, const std::string &symbol2, unsigned precedence)
const fixedbv_typet & to_fixedbv_type(const typet &type)
Cast a typet to a fixedbv_typet.
const irep_idt & get(const irep_idt &name) const
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
const code_switch_caset & to_code_switch_case(const codet &code)
std::string convert_overflow(const exprt &src, unsigned &precedence)
std::unordered_map< irep_idt, std::unordered_set< irep_idt > > ns_collision
code_operandst & statements()
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
const codet & to_code(const exprt &expr)
const nondet_symbol_exprt & to_nondet_symbol_expr(const exprt &expr)
Cast an exprt to a nondet_symbol_exprt.
binding_exprt::variablest & variables()
convenience accessor for binding().variables()
std::string convert_code_frontend_decl(const codet &, unsigned indent)
typet & type()
Return the type of the expression.
std::string convert_typecast(const typecast_exprt &src, unsigned &precedence)
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
goto_instruction_codet representation of a function call statement.
std::string convert_predicate_passive_symbol(const exprt &src)
std::size_t get_component_number() const
bool can_cast_type< code_typet >(const typet &type)
Check whether a reference to a typet is a code_typet.
virtual std::string convert(const typet &src)
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
codet representation of a do while statement.
std::string convert_code_array_set(const codet &src, unsigned indent)
std::string convert_code_for(const code_fort &src, unsigned indent)
const typet & element_type() const
The type of the elements of the vector.
std::string convert_member_designator(const exprt &src)
std::string convert_array_member_value(const exprt &src, unsigned precedence)
bool can_cast_expr< unary_minus_overflow_exprt >(const exprt &base)
const exprt & init() const
signedbv_typet signed_int_type()
bool has_prefix(const std::string &s, const std::string &prefix)
std::string convert_nondet_symbol(const nondet_symbol_exprt &)
const mod_exprt & to_mod_expr(const exprt &expr)
Cast an exprt to a mod_exprt.
std::string convert_code_printf(const codet &src, unsigned indent)
std::string expr2string() const
const code_frontend_assignt & to_code_frontend_assign(const codet &code)
#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.
const std::string & id2string(const irep_idt &d)
static std::string indent_str(unsigned indent)
const exprt & compound() const
std::string to_ansi_c_string() const
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
#define forall_operands(it, expr)
const byte_update_exprt & to_byte_update_expr(const exprt &expr)
#define SYMEX_DYNAMIC_PREFIX
void set(const irep_idt &name, const irep_idt &value)
std::string expr2c(const exprt &expr, const namespacet &ns, const expr2c_configurationt &configuration)
Stream & join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter, TransformFunc &&transform_func)
Prints items to an stream, separated by a constant delimiter.
const code_ifthenelset & to_code_ifthenelse(const codet &code)
codet representation of a label for branch targets.
virtual std::unique_ptr< qualifierst > clone() const =0
const irep_idt & get_identifier() const
optionalt< mp_integer > pointer_offset_bits(const typet &type, const namespacet &ns)
std::string convert_pointer_difference(const exprt &src, unsigned &precedence)
bitvector_typet wchar_t_type()
std::string convert_prob_coin(const exprt &src, unsigned &precedence)
const code_labelt & to_code_label(const codet &code)
const let_exprt & to_let_expr(const exprt &expr)
Cast an exprt to a let_exprt.
floatbv_typet float_type()
const plus_exprt & to_plus_expr(const exprt &expr)
Cast an exprt to a plus_exprt.
bool include_struct_padding_components
When printing struct_typet or struct_exprt, include the artificial padding components introduced to k...
std::string convert_code_frontend_assign(const code_frontend_assignt &, unsigned indent)
std::string convert_code_asm(const code_asmt &src, unsigned indent)
const std::string & id_string() const
Application of (mathematical) function.
const notequal_exprt & to_notequal_expr(const exprt &expr)
Cast an exprt to an notequal_exprt.
Binary multiplication Associativity is not specified.
std::size_t long_long_int_width
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
const std::string & get_string(const irep_idt &name) const
const code_dowhilet & to_code_dowhile(const codet &code)
std::string convert_code_lock(const codet &src, unsigned indent)
std::string convert_code_label(const code_labelt &src, unsigned indent)
std::string convert_unary(const unary_exprt &, const std::string &symbol, unsigned precedence)
std::string convert_extractbits(const extractbits_exprt &src, unsigned precedence)
A codet representing an assignment in the program.
unsignedbv_typet unsigned_int_type()
std::string convert_array(const exprt &src)
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const exprt & cond() const
std::string convert_code_goto(const codet &src, unsigned indent)
virtual std::string convert_symbol(const exprt &src)
const codet & body() const
const irep_idt & id() const
std::string convert_predicate_next_symbol(const exprt &src)
static optionalt< exprt > build_sizeof_expr(const constant_exprt &expr, const namespacet &ns)
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
std::string convert_byte_update(const byte_update_exprt &, unsigned precedence)
A base class for variable bindings (quantifiers, let, lambda)
std::vector< exprt > operandst
std::string convert_code_assume(const codet &src, unsigned indent)
virtual std::string convert_struct(const exprt &src, unsigned &precedence)
Pointer-typed bitvector constant annotated with the pointer expression that the bitvector is the nume...
const shl_exprt & to_shl_expr(const exprt &expr)
Cast an exprt to a shl_exprt.
std::string convert_index(const binary_exprt &, unsigned precedence)
std::string convert_initializer_list(const exprt &src)
const parameterst & parameters() const
std::string convert_side_effect_expr_function_call(const side_effect_expr_function_callt &src)
const expr2c_configurationt & configuration
nonstd::optional< T > optionalt
const shift_exprt & to_shift_expr(const exprt &expr)
Cast an exprt to a shift_exprt.
const with_exprt & to_with_expr(const exprt &expr)
Cast an exprt to a with_exprt.
Operator to update elements in structs and arrays.
std::string convert_code_continue(unsigned indent)
std::string convert_code_break(unsigned indent)
floatbv_typet double_type()
const typet & underlying_type() const
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a typet to a signedbv_typet.
std::string convert_code_array_copy(const codet &src, unsigned indent)
std::string convert_extractbit(const extractbit_exprt &, unsigned precedence)
bitvector_typet char_type()
bool can_cast_expr< code_outputt >(const exprt &base)
std::size_t get_width() const
const irep_idt & get_label() const
std::string convert_norep(const exprt &src, unsigned &precedence)
std::string convert_literal(const exprt &src)
code_asmt & to_code_asm(codet &code)
Extract member of struct or union.
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a typet to a c_bit_field_typet.
Deprecated expression utility functions.
std::string convert_function_application(const function_application_exprt &src)
A base class for shift and rotate operators.
find_symbols_sett find_symbol_identifiers(const exprt &src)
Find identifiers of the sub expressions with id ID_symbol, considering both free and bound variables.
std::string convert_with(const exprt &src, unsigned precedence)
bool can_cast_type< unsignedbv_typet >(const typet &type)
Check whether a reference to a typet is a unsignedbv_typet.
const code_frontend_returnt & to_code_frontend_return(const codet &code)
Structure type, corresponds to C style structs.
C enum tag type, i.e., c_enum_typet with an identifier.
std::string convert_code_block(const code_blockt &src, unsigned indent)
std::string c_type_as_string(const irep_idt &c_type)
std::size_t get_fraction_bits() const
const quantifier_exprt & to_quantifier_expr(const exprt &expr)
Cast an exprt to a quantifier_exprt.
std::string convert_code_array_replace(const codet &src, unsigned indent)
bool print_struct_body_in_type
When printing a struct_typet, should the components of the struct be printed inline.
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
const not_exprt & to_not_expr(const exprt &expr)
Cast an exprt to an not_exprt.
std::string convert_code_unlock(const codet &src, unsigned indent)
const bitreverse_exprt & to_bitreverse_expr(const exprt &expr)
Cast an exprt to a bitreverse_exprt.
source_locationt location
Source code location of definition of symbol.
const implies_exprt & to_implies_expr(const exprt &expr)
Cast an exprt to a implies_exprt.
std::string convert_nondet(const exprt &src, unsigned &precedence)
bool can_cast_expr< binary_overflow_exprt >(const exprt &base)
void get_shorthands(const exprt &expr)
const codet & body() const
std::string convert_code_dowhile(const code_dowhilet &src, unsigned indent)
exprt::operandst & arguments()
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
const codet & body() const
std::string convert_object_descriptor(const exprt &src, unsigned &precedence)
const codet & else_case() const
const typet & base_type() const
The type of the data what we point to.
std::size_t long_double_width
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
std::string convert_sizeof(const exprt &src, unsigned &precedence)
virtual std::string convert_array_type(const typet &src, const qualifierst &qualifiers, const std::string &declarator_str)
To generate a C-like type declaration of an array.
const equal_exprt & to_equal_expr(const exprt &expr)
Cast an exprt to an equal_exprt.
bool can_cast_expr< code_inputt >(const exprt &base)
std::size_t short_int_width
irep_idt id_shorthand(const irep_idt &identifier) const
const typet & subtype() const
const exprt & cond() const
const extractbits_exprt & to_extractbits_expr(const exprt &expr)
Cast an exprt to an extractbits_exprt.
const vector_typet & to_vector_type(const typet &type)
Cast a typet to a vector_typet.
const typet & return_type() const
optionalt< exprt > size_of_expr(const typet &type, const namespacet &ns)
const code_blockt & to_code_block(const codet &code)
static expr2c_configurationt clean_configuration
This prints compilable C that loses some of the internal details of the GOTO program.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
irep_idt get_component_name() const
There are a large number of kinds of tree structured or tree-like data in CPROVER.
std::string convert_code_dead(const codet &src, unsigned indent)
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
bool include_array_size
When printing array_typet, should the size of the array be printed.
std::string type2c(const typet &type, const namespacet &ns, const expr2c_configurationt &configuration)
std::string convert_struct_member_value(const exprt &src, unsigned precedence)
bool is_null_pointer(const constant_exprt &expr)
Returns true if expr has a pointer type and a value NULL; it also returns true when expr has value ze...
#define forall_expr(it, expr)
const typet & underlying_type() const
std::string convert_rox(const shift_exprt &src, unsigned precedence)
Conversion function from rol/ror expressions to C code strings Note that this constructs a complex ex...
virtual std::string convert_rec(const typet &src, const qualifierst &qualifiers, const std::string &declarator)
std::string convert_index_designator(const exprt &src)
Used for configuring the behaviour of expr2c and type2c.
const irep_idt & get_flavor() const
Semantic type conversion.
std::string convert_code_switch(const codet &src, unsigned indent)
unsignedbv_typet size_type()
std::string convert_member(const member_exprt &src, unsigned precedence)
const irep_idt & get_statement() const
A constant literal expression.
std::string true_string
This is the string that will be printed for the true boolean expression.
virtual std::string convert_with_precedence(const exprt &src, unsigned &precedence)
virtual std::string as_string() const override
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
exprt & where()
convenience accessor for binding().where()
std::string convert_multi_ary(const exprt &src, const std::string &symbol, unsigned precedence, bool full_parentheses)
const binary_relation_exprt & to_binary_relation_expr(const exprt &expr)
Cast an exprt to a binary_relation_exprt.
const irep_idt & get_value() const
const source_locationt & source_location() const
bool is_incomplete() const
A struct/union may be incomplete.
std::string convert_complex(const exprt &src, unsigned precedence)
std::string convert_code_output(const codet &src, unsigned indent)
optionalt< std::string > convert_function(const exprt &src)
Returns a string if src is a function with a known conversion, else returns nullopt.
const function_application_exprt & to_function_application_expr(const exprt &expr)
Cast an exprt to a function_application_exprt.
bool expand_typedef
Print the expanded type instead of a typedef name, even when a typedef is present.
exprt & symbolic_pointer()
std::string convert_designated_initializer(const exprt &src)
std::string convert_vector(const exprt &src, unsigned &precedence)
std::string convert_binary(const binary_exprt &, const std::string &symbol, unsigned precedence, bool full_parentheses)
bool get_bool(const irep_idt &name) const
std::string false_string
This is the string that will be printed for the false boolean expression.
std::size_t long_int_width
Modulo defined as lhs-(rhs * truncate(lhs/rhs)).
const memberst & members() const
const typet & element_type() const
The type of the elements of the array.
std::string convert_allocate(const exprt &src, unsigned &precedence)
std::string convert_code_return(const codet &src, unsigned indent)
Reverse the order of bits in a bit-vector.
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.
const std::string integer2string(const mp_integer &n, unsigned base)
std::string convert_binding(const binding_exprt &, const std::string &symbol, unsigned precedence)