87 if(
pos!=std::string::npos)
98 if(c_pos!=std::string::npos &&
99 dest.rfind(
"::")==c_pos)
100 dest.erase(0, c_pos+2);
101 else if(c_pos!=std::string::npos)
121 for(
const auto &symbol_id : symbols)
132 func = func.substr(0, func.rfind(
"::"));
142 if(!
shorthands.insert(std::make_pair(symbol_id, sh)).second)
146 for(
const auto &symbol_id : symbols)
162 has_collision=!
ns.
lookup(sh, symbol);
183 const std::string symbol_str =
id2string(symbol_id);
184 const std::string func = symbol_str.substr(0, symbol_str.find(
"::"));
190 const auto func_type =
191 type_checked_cast<code_typet>(func_symbol->
type);
192 const auto params = func_type.parameters();
193 for(
const auto ¶m : params)
195 const auto param_id = param.get_identifier();
196 if(param_id != symbol_id && sh ==
id_shorthand(param_id))
198 has_collision =
true;
209 shorthands.insert(std::make_pair(symbol_id, sh));
221 const std::string &declarator)
223 std::unique_ptr<c_qualifierst> clone = qualifiers.
clone();
225 new_qualifiers.
read(src);
227 std::string q=new_qualifiers.
as_string();
229 std::string d = declarator.empty() ? declarator :
" " + declarator;
236 if(src.
id()==ID_bool)
240 else if(src.
id()==ID_c_bool)
244 else if(src.
id()==ID_string)
248 else if(src.
id()==ID_natural ||
249 src.
id()==ID_integer ||
250 src.
id()==ID_rational)
254 else if(src.
id()==ID_empty)
258 else if(src.
id()==ID_complex)
263 else if(src.
id()==ID_floatbv)
272 return q+
"long double"+d;
277 return q +
CPROVER_PREFIX +
"floatbv[" + swidth +
"][" + fwidth +
"]";
280 else if(src.
id()==ID_fixedbv)
288 else if(src.
id()==ID_c_bit_field)
294 else if(src.
id()==ID_signedbv ||
295 src.
id()==ID_unsignedbv)
301 if(c_type==ID_char &&
304 if(src.
id()==ID_signedbv)
305 return q+
"signed char"+d;
307 return q+
"unsigned char"+d;
309 else if(c_type!=ID_wchar_t && !c_type_str.
empty())
310 return q+c_type_str+d;
317 std::string sign_str=
is_signed?
"signed ":
"unsigned ";
323 return q+sign_str+
"int"+d;
329 return q+sign_str+
"long int"+d;
334 return q+sign_str+
"char"+d;
340 return q+sign_str+
"short int"+d;
346 return q+sign_str+
"long long int"+d;
352 return q + sign_str +
"__int128" + d;
360 else if(src.
id()==ID_struct)
364 else if(src.
id()==ID_union)
368 std::string dest=q+
"union";
392 else if(src.
id()==ID_c_enum)
424 for(c_enum_typet::memberst::const_iterator it = members.begin();
430 if(it != members.begin())
433 result +=
id2string(it->get_base_name());
444 else if(src.
id()==ID_c_enum_tag)
448 std::string result=q+
"enum";
453 else if(src.
id()==ID_pointer)
457 sub_qualifiers.
read(base_type);
460 std::string new_declarator=
"*";
462 if(!q.empty() && (!declarator.empty() || base_type.
id() == ID_pointer))
464 new_declarator+=
" "+q;
467 new_declarator+=declarator;
471 base_type.
id() == ID_code ||
474 new_declarator=
"("+new_declarator+
")";
477 return convert_rec(base_type, sub_qualifiers, new_declarator);
479 else if(src.
id()==ID_array)
483 else if(src.
id()==ID_struct_tag)
488 std::string dest=q+
"struct";
496 else if(src.
id()==ID_union_tag)
501 std::string dest=q+
"union";
509 else if(src.
id()==ID_code)
515 std::string dest=declarator+
"(";
519 if(parameters.empty())
526 for(code_typet::parameterst::const_iterator
527 it=parameters.begin();
528 it!=parameters.end();
531 if(it!=parameters.begin())
534 if(it->get_identifier().empty())
538 std::string arg_declarator=
563 const typet *non_ptr_type = &return_type;
564 while(non_ptr_type->
id()==ID_pointer)
567 if(non_ptr_type->
id()==ID_code ||
568 non_ptr_type->
id()==ID_array)
569 dest=
convert_rec(return_type, ret_qualifiers, dest);
571 dest=
convert_rec(return_type, ret_qualifiers,
"")+
" "+dest;
577 if(dest[dest.size()-1]==
' ')
578 dest.resize(dest.size()-1);
583 else if(src.
id()==ID_vector)
587 const mp_integer size_int = numeric_cast_v<mp_integer>(vector_type.
size());
592 if(tmp==
"signed char" || tmp==
"char")
594 else if(tmp==
"signed short int")
596 else if(tmp==
"signed int")
598 else if(tmp==
"signed long long int")
600 else if(tmp==
"float")
602 else if(tmp==
"double")
608 dest+=
" __attribute__((vector_size (";
610 dest+=
"*sizeof("+subtype+
"))))";
615 else if(src.
id()==ID_constructor ||
616 src.
id()==ID_destructor)
618 return q+
"__attribute__(("+
id2string(src.
id())+
")) void"+d;
639 const std::string &qualifiers_str,
640 const std::string &declarator_str)
662 const std::string &qualifiers,
663 const std::string &declarator,
664 bool inc_struct_body,
665 bool inc_padding_components)
671 inc_struct_body || !inc_padding_components,
"inconsistent configuration");
675 std::string dest=qualifiers+
"struct";
688 if(
component.get_is_padding() && !inc_padding_components)
716 const std::string &declarator_str)
733 const std::string &declarator_str,
734 bool inc_size_if_possible)
737 std::string array_suffix;
739 if(
to_array_type(src).size().is_nil() || !inc_size_if_possible)
749 declarator_str + array_suffix);
754 unsigned &precedence)
764 if(to_type.
id()==ID_c_bool &&
768 if(to_type.
id()==ID_bool &&
772 std::string dest =
"(" +
convert(to_type) +
")";
788 const std::string &symbol1,
789 const std::string &symbol2,
835 const std::string &symbol,
847 std::string dest=symbol+
" { ";
877 for(
size_t i=1; i<src.
operands().size(); i+=2)
879 std::string op1, op2;
885 if(src.
operands()[i].id()==ID_member_name)
888 src.
operands()[i].get(ID_component_name);
891 (old.type().id() == ID_struct_tag || old.type().id() == ID_union_tag)
893 .get_component(component_name)
900 display_component_name=component_name;
904 op1=
"."+
id2string(display_component_name);
926 std::string dest =
"LET ";
930 const auto &values = src.
values();
931 auto values_it = values.begin();
955 std::string op0, op1, op2;
969 const exprt &designator = src.
op1();
971 for(
const auto &op : designator.
operands())
996 std::string dest=
"cond {\n";
998 for(
const auto &operand : src.
operands())
1013 condition=!condition;
1023 const std::string &symbol,
1024 unsigned precedence,
1025 bool full_parentheses)
1044 bool use_parentheses0=
1046 (precedence==p0 && full_parentheses) ||
1047 (precedence==p0 && src.
id()!=op0.
id());
1049 if(use_parentheses0)
1052 if(use_parentheses0)
1059 bool use_parentheses1=
1061 (precedence==p1 && full_parentheses) ||
1062 (precedence==p1 && src.
id()!=op1.
id());
1064 if(use_parentheses1)
1067 if(use_parentheses1)
1075 const std::string &symbol,
1076 unsigned precedence,
1077 bool full_parentheses)
1085 for(
const auto &operand : src.
operands())
1107 bool use_parentheses = precedence > p ||
1108 (precedence == p && full_parentheses) ||
1109 (precedence == p && src.
id() != operand.id());
1123 const std::string &symbol,
1124 unsigned precedence)
1129 std::string dest=symbol;
1152 std::string dest =
"ALLOCATE";
1156 src.
type().
id() == ID_pointer &&
1163 dest += op0 +
", " + op1;
1171 unsigned &precedence)
1181 unsigned &precedence)
1196 unsigned &precedence)
1211 unsigned &precedence)
1214 return "PROB_UNIFORM(" +
convert(src.
type()) +
"," +
1222 std::string dest=name;
1243 unsigned precedence)
1250 if(*op0.rbegin()==
';')
1251 op0.resize(op0.size()-1);
1255 if(*op1.rbegin()==
';')
1256 op1.resize(op1.size()-1);
1258 std::string dest=op0;
1267 unsigned precedence)
1296 std::string dest=name;
1317 unsigned precedence)
1327 unsigned precedence)
1378 const std::string &symbol,
1379 unsigned precedence)
1418 const exprt &src,
unsigned &precedence)
1423 std::string dest=
"POINTER_ARITHMETIC(";
1455 const exprt &src,
unsigned &precedence)
1462 std::string dest=
"POINTER_DIFFERENCE(";
1467 op =
convert(binary_expr.op0().type());
1495 unsigned precedence;
1500 return "."+src.
get_string(ID_component_name);
1505 unsigned precedence;
1515 unsigned precedence)
1517 const auto &compound = src.
compound();
1522 if(compound.id() == ID_dereference)
1528 if(precedence > p || pointer.id() == ID_typecast)
1531 if(precedence > p || pointer.id() == ID_typecast)
1540 if(precedence > p || compound.id() == ID_typecast)
1543 if(precedence > p || compound.id() == ID_typecast)
1550 compound.type().id() != ID_struct && compound.type().id() != ID_union &&
1551 compound.type().id() != ID_struct_tag &&
1552 compound.type().id() != ID_union_tag)
1558 (compound.type().id() == ID_struct_tag ||
1559 compound.type().id() == ID_union_tag)
1565 if(!component_name.
empty())
1567 const auto &comp_expr = struct_union_type.
get_component(component_name);
1569 if(comp_expr.is_nil())
1572 if(!comp_expr.get_pretty_name().empty())
1573 dest +=
id2string(comp_expr.get_pretty_name());
1585 const auto &comp_expr = struct_union_type.
components()[n];
1587 if(!comp_expr.get_pretty_name().empty())
1588 dest +=
id2string(comp_expr.get_pretty_name());
1590 dest +=
id2string(comp_expr.get_name());
1597 unsigned precedence)
1607 unsigned precedence)
1617 unsigned &precedence)
1633 to_unary_expr(src).op().
id() == ID_predicate_passive_symbol)
1639 std::unordered_map<irep_idt, irep_idt>::const_iterator entry =
1674 const std::string &
id=src.
get_string(ID_identifier);
1675 return "ps("+
id+
")";
1680 const std::string &
id=src.
get_string(ID_identifier);
1681 return "pns("+
id+
")";
1686 const std::string &
id=src.
get_string(ID_identifier);
1687 return "pps("+
id+
")";
1692 const std::string &
id=src.
get_string(ID_identifier);
1698 return "nondet_bool()";
1703 unsigned &precedence)
1708 std::string result=
"<";
1725 static std::optional<exprt>
1728 const typet &type =
static_cast<const typet &
>(expr.
find(ID_C_c_sizeof_type));
1734 std::optional<mp_integer> type_size;
1735 if(type_size_expr.has_value())
1736 type_size = numeric_cast<mp_integer>(*type_size_expr);
1737 auto val = numeric_cast<mp_integer>(expr);
1740 !type_size.has_value() || *type_size < 0 || !val.has_value() ||
1741 *val < *type_size || (*type_size == 0 && *val > 0))
1749 "sizeof value does not fit size_type");
1760 exprt result(ID_sizeof, t);
1761 result.
set(ID_type_arg, type);
1773 unsigned &precedence)
1780 if(type.
id()==ID_integer ||
1781 type.
id()==ID_natural ||
1782 type.
id()==ID_rational)
1786 else if(type.
id()==ID_c_enum ||
1787 type.
id()==ID_c_enum_tag)
1793 if(c_enum_type.
id()!=ID_c_enum)
1801 for(
const auto &member : members)
1803 if(member.get_value() == value)
1804 return "/*enum*/" +
id2string(member.get_base_name());
1813 std::string value_as_string =
1817 return value_as_string;
1819 return "/*enum*/" + value_as_string;
1821 else if(type.
id()==ID_rational)
1823 else if(type.
id()==ID_bv)
1828 else if(type.
id()==ID_bool)
1832 else if(type.
id()==ID_unsignedbv ||
1833 type.
id()==ID_signedbv ||
1834 type.
id()==ID_c_bit_field ||
1835 type.
id()==ID_c_bool)
1842 type.
id() == ID_signedbv ||
1843 (type.
id() == ID_c_bit_field &&
1847 type.
id() == ID_c_bit_field
1849 : type.
get(ID_C_c_type);
1851 if(type.
id()==ID_c_bool)
1861 else if(int_value==
'\r')
1863 else if(int_value==
'\t')
1865 else if(int_value==
'\'')
1867 else if(int_value==
'\\')
1869 else if(int_value>=
' ' && int_value<126)
1872 dest += numeric_cast_v<char>(int_value);
1889 if(c_type==ID_unsigned_int)
1891 else if(c_type==ID_unsigned_long_int)
1893 else if(c_type==ID_signed_long_int)
1895 else if(c_type==ID_unsigned_long_long_int)
1897 else if(c_type==ID_signed_long_long_int)
1904 if(sizeof_expr_opt.has_value())
1907 dest =
convert(sizeof_expr_opt.value()) +
" /*" + dest +
"*/ ";
1913 else if(type.
id()==ID_floatbv)
1917 if(!dest.empty() &&
isdigit(dest[dest.size() - 1]))
1919 if(dest.find(
'.')==std::string::npos)
1929 else if(dest.size()==4 &&
1930 (dest[0]==
'+' || dest[0]==
'-'))
1936 else if(dest ==
"-inf")
1938 else if(dest ==
"+NaN")
1940 else if(dest ==
"-NaN")
1946 std::string suffix =
"";
1957 dest =
"(1.0" + suffix +
"/0.0" + suffix +
")";
1958 else if(dest ==
"-inf")
1959 dest =
"(-1.0" + suffix +
"/0.0" + suffix +
")";
1960 else if(dest ==
"+NaN")
1961 dest =
"(0.0" + suffix +
"/0.0" + suffix +
")";
1962 else if(dest ==
"-NaN")
1963 dest =
"(-0.0" + suffix +
"/0.0" + suffix +
")";
1967 else if(type.
id()==ID_fixedbv)
1971 if(!dest.empty() &&
isdigit(dest[dest.size() - 1]))
1979 else if(type.
id() == ID_array)
1983 else if(type.
id()==ID_pointer)
1992 dest=
"(("+
convert(type)+
")"+dest+
")";
1995 value ==
"INVALID" || value.
starts_with(
"INVALID-") ||
1996 value ==
"NULL+offset")
2007 else if(type.
id()==ID_string)
2019 unsigned &precedence)
2040 unsigned &precedence)
2056 unsigned &precedence,
2057 bool include_padding_components)
2059 if(src.
type().
id() != ID_struct && src.
type().
id() != ID_struct_tag)
2063 src.
type().
id() == ID_struct_tag
2070 if(components.size()!=src.
operands().size())
2073 std::string dest=
"{ ";
2075 exprt::operandst::const_iterator o_it=src.
operands().begin();
2084 o_it->type().id() != ID_code,
"struct member must not be of code type");
2086 if(
component.get_is_padding() && !include_padding_components)
2104 std::string tmp=
convert(*o_it);
2106 if(last_size+40<dest.size())
2109 last_size=dest.size();
2129 unsigned &precedence)
2133 if(type.
id() != ID_vector)
2136 std::string dest=
"{ ";
2142 for(
const auto &op : src.
operands())
2156 std::string tmp =
convert(op);
2158 if(last_size+40<dest.size())
2161 last_size=dest.size();
2176 unsigned &precedence)
2178 std::string dest=
"{ ";
2202 bool all_constant=
true;
2204 for(
const auto &op : src.
operands())
2206 if(!op.is_constant())
2211 src.
get_bool(ID_C_string_constant) && all_constant &&
2221 dest.reserve(dest.size()+1+src.
operands().size());
2223 bool last_was_hex=
false;
2244 case '\n': dest+=
"\\n";
break;
2245 case '\t': dest+=
"\\t";
break;
2246 case '\v': dest+=
"\\v";
break;
2247 case '\b': dest+=
"\\b";
break;
2248 case '\r': dest+=
"\\r";
break;
2249 case '\f': dest+=
"\\f";
break;
2250 case '\a': dest+=
"\\a";
break;
2251 case '\\': dest+=
"\\\\";
break;
2252 case '"': dest+=
"\\\"";
break;
2255 if(ch>=
' ' && ch!=127 && ch<0xff)
2256 dest+=
static_cast<char>(ch);
2259 std::ostringstream oss;
2260 oss <<
"\\x" << std::hex << ch;
2278 if(it->is_not_nil())
2298 unsigned &precedence)
2300 std::string dest=
"{ ";
2307 std::string tmp1=
convert(*it);
2311 std::string tmp2=
convert(*it);
2313 std::string tmp=
"["+tmp1+
"]="+tmp2;
2333 if(src.
id()!=ID_compound_literal)
2350 if(src.
id()!=ID_compound_literal)
2389 const auto complement_width_expr =
2394 if(src.
id() == ID_rol)
2397 lhs_expr =
shl_exprt(op0, distance_modulo_width);
2399 rhs_expr =
ashr_exprt(op0, complement_width_expr);
2401 else if(src.
id() == ID_ror)
2404 lhs_expr =
ashr_exprt(op0, distance_modulo_width);
2406 rhs_expr =
shl_exprt(op0, complement_width_expr);
2420 unsigned precedence;
2426 const exprt &designator =
static_cast<const exprt &
>(src.
find(ID_designator));
2427 if(designator.
operands().size() != 1)
2429 unsigned precedence;
2437 if(designator_id.
id() == ID_member)
2439 dest =
"." +
id2string(designator_id.
get(ID_component_name));
2442 designator_id.
id() == ID_index && designator_id.
operands().size() == 1)
2448 unsigned precedence;
2518 unsigned &precedence)
2522 std::string dest=
"overflow(\"";
2532 for(
const auto &op : src.
operands())
2549 return std::string(indent,
' ');
2564 if(!src.
operands()[1].operands().empty() ||
2565 !src.
operands()[2].operands().empty() ||
2566 !src.
operands()[3].operands().empty() ||
2567 !src.
operands()[4].operands().empty())
2575 if(it->operands().size()==2)
2590 if(it->operands().size()==2)
2607 if(it->id()==ID_gcc_asm_clobbered_register)
2636 unsigned precedence;
2662 unsigned precedence;
2691 unsigned precedence;
2728 unsigned precedence;
2770 unsigned precedence;
2786 const exprt &op=*it;
2788 if(op.
get(ID_statement)!=ID_block)
2790 unsigned precedence;
2795 for(
const auto &operand : op.
operands())
2823 unsigned precedence;
2831 const symbolt *symbol=
nullptr;
2842 dest +=
"__declspec(dllexport) ";
2845 if(symbol->
type.
id()==ID_code &&
2867 unsigned precedence;
2880 unsigned precedence;
2918 for(
const auto &statement : src.
statements())
2920 if(statement.get_statement() == ID_label)
2940 for(
const auto &op : src.
operands())
2955 std::string expr_str;
2960 unsigned precedence;
2965 if(dest.empty() || *dest.rbegin()!=
';')
2975 static bool comment_done=
false;
2990 std::ostringstream oss;
2998 [](
const std::pair<irep_idt, irept> &p) { return p.first; });
3009 if(statement==ID_expression)
3012 if(statement==ID_block)
3015 if(statement==ID_switch)
3018 if(statement==ID_for)
3021 if(statement==ID_while)
3024 if(statement==ID_asm)
3027 if(statement==ID_skip)
3030 if(statement==ID_dowhile)
3033 if(statement==ID_ifthenelse)
3036 if(statement==ID_return)
3039 if(statement==ID_goto)
3042 if(statement==ID_printf)
3045 if(statement==ID_fence)
3054 if(statement==ID_assume)
3057 if(statement==ID_assert)
3060 if(statement==ID_break)
3063 if(statement==ID_continue)
3066 if(statement==ID_decl)
3069 if(statement==ID_decl_block)
3072 if(statement==ID_dead)
3075 if(statement==ID_assign)
3078 if(statement==
"lock")
3081 if(statement==
"unlock")
3084 if(statement==ID_atomic_begin)
3087 if(statement==ID_atomic_end)
3090 if(statement==ID_function_call)
3093 if(statement==ID_label)
3096 if(statement==ID_switch_case)
3099 if(statement==ID_array_set)
3102 if(statement==ID_array_copy)
3105 if(statement==ID_array_replace)
3108 if(statement == ID_set_may || statement == ID_set_must)
3112 unsigned precedence;
3130 unsigned precedence;
3143 unsigned precedence;
3156 unsigned precedence;
3187 if(it!=arguments.begin())
3202 std::string dest=
indent_str(indent)+
"printf(";
3224 std::string dest=
indent_str(indent)+
"FENCE(";
3227 { ID_WRfence, ID_RRfence, ID_RWfence, ID_WWfence,
3228 ID_RRcumul, ID_RWcumul, ID_WWcumul, ID_WRcumul,
3233 for(
unsigned i=0; !att[i].
empty(); i++)
3254 std::string dest=
indent_str(indent)+
"INPUT(";
3276 std::string dest=
indent_str(indent)+
"OUTPUT(";
3297 std::string dest=
indent_str(indent)+
"ARRAY_SET(";
3319 std::string dest=
indent_str(indent)+
"ARRAY_COPY(";
3341 std::string dest=
indent_str(indent)+
"ARRAY_REPLACE(";
3364 unsigned precedence;
3377 unsigned precedence;
3389 std::string labels_string;
3393 labels_string+=
"\n";
3396 labels_string+=
":\n";
3400 return labels_string+tmp;
3407 std::string labels_string;
3411 labels_string+=
"\n";
3413 labels_string+=
"default:\n";
3417 labels_string+=
"\n";
3419 labels_string+=
"case ";
3421 labels_string+=
":\n";
3424 unsigned next_indent=indent;
3430 return labels_string+tmp;
3440 unsigned precedence;
3448 static_cast<const codet &
>(src.
find(ID_code));
3450 std::string dest=
"\n";
3455 std::string assumption_str=
convert(assumption);
3457 dest+=assumption_str;
3470 std::string assertion_str=
convert(assertion);
3472 dest+=assertion_str;
3498 if(expr_width_opt.has_value())
3516 unsigned &precedence)
3521 std::string dest=
"sizeof(";
3532 const auto &cond = src.
operands().front();
3539 const auto &targets = src.
operands()[1];
3544 if(it != targets.operands().begin())
3555 if(
auto type_ptr = type_try_dynamic_cast<unsignedbv_typet>(src.
type()))
3557 const std::size_t width = type_ptr->get_width();
3558 if(width == 8 || width == 16 || width == 32 || width == 64)
3565 unsigned precedence;
3571 std::string dest = src.
id() == ID_r_ok ?
"R_OK"
3572 : src.
id() == ID_w_ok ?
"W_OK"
3591 std::string dest = src.
id() == ID_prophecy_r_ok ?
"R_OK"
3592 : src.
id() == ID_prophecy_w_ok ?
"W_OK"
3647 unsigned &precedence)
3651 if(src.
id()==ID_plus)
3654 else if(src.
id()==ID_minus)
3657 else if(src.
id()==ID_unary_minus)
3660 else if(src.
id()==ID_unary_plus)
3663 else if(src.
id()==ID_floatbv_typecast)
3667 std::string dest=
"FLOAT_TYPECAST(";
3696 else if(src.
id()==ID_sign)
3704 else if(src.
id()==ID_popcount)
3712 else if(src.
id()==
"pointer_arithmetic")
3715 else if(src.
id()==
"pointer_difference")
3718 else if(src.
id() == ID_null_object)
3719 return "NULL-object";
3721 else if(src.
id()==ID_integer_address ||
3722 src.
id()==ID_integer_address_object ||
3723 src.
id()==ID_stack_object ||
3724 src.
id()==ID_static_object)
3729 else if(src.
id()==
"builtin-function")
3732 else if(src.
id()==ID_array_of)
3735 else if(src.
id()==ID_bswap)
3747 else if(src.
id()==ID_address_of)
3751 if(
object.
id() == ID_label)
3752 return "&&" +
object.
get_string(ID_identifier);
3753 else if(
object.
id() == ID_index &&
to_index_expr(
object).index().is_zero())
3761 else if(src.
id()==ID_dereference)
3765 if(src.
type().
id() == ID_code)
3768 pointer.id() == ID_plus && pointer.operands().size() == 2 &&
3778 else if(src.
id()==ID_index)
3781 else if(src.
id()==ID_member)
3784 else if(src.
id()==
"array-member-value")
3787 else if(src.
id()==
"struct-member-value")
3790 else if(src.
id()==ID_function_application)
3793 else if(src.
id()==ID_side_effect)
3796 if(statement==ID_preincrement)
3798 else if(statement==ID_predecrement)
3800 else if(statement==ID_postincrement)
3802 else if(statement==ID_postdecrement)
3804 else if(statement==ID_assign_plus)
3806 else if(statement==ID_assign_minus)
3808 else if(statement==ID_assign_mult)
3810 else if(statement==ID_assign_div)
3812 else if(statement==ID_assign_mod)
3814 else if(statement==ID_assign_shl)
3816 else if(statement==ID_assign_shr)
3818 else if(statement==ID_assign_bitand)
3820 else if(statement==ID_assign_bitxor)
3822 else if(statement==ID_assign_bitor)
3824 else if(statement==ID_assign)
3826 else if(statement==ID_function_call)
3829 else if(statement == ID_allocate)
3831 else if(statement==ID_printf)
3833 else if(statement==ID_nondet)
3835 else if(statement==
"prob_coin")
3837 else if(statement==
"prob_unif")
3839 else if(statement==ID_statement_expression)
3841 else if(statement == ID_va_start)
3847 else if(src.
id()==ID_literal)
3850 else if(src.
id()==ID_not)
3853 else if(src.
id()==ID_bitnot)
3856 else if(src.
id()==ID_mult)
3859 else if(src.
id()==ID_div)
3862 else if(src.
id()==ID_mod)
3865 else if(src.
id()==ID_shl)
3868 else if(src.
id()==ID_ashr || src.
id()==ID_lshr)
3871 else if(src.
id()==ID_lt || src.
id()==ID_gt ||
3872 src.
id()==ID_le || src.
id()==ID_ge)
3878 else if(src.
id()==ID_notequal)
3881 else if(src.
id()==ID_equal)
3884 else if(src.
id()==ID_complex)
3887 else if(src.
id()==ID_bitand)
3890 else if(src.
id()==ID_bitxor)
3893 else if(src.
id()==ID_bitor)
3896 else if(src.
id()==ID_and)
3899 else if(src.
id()==ID_or)
3902 else if(src.
id()==ID_xor)
3905 else if(src.
id()==ID_implies)
3908 else if(src.
id()==ID_if)
3911 else if(src.
id()==ID_forall)
3914 else if(src.
id()==ID_exists)
3917 else if(src.
id()==ID_lambda)
3920 else if(src.
id()==ID_with)
3923 else if(src.
id()==ID_update)
3926 else if(src.
id()==ID_member_designator)
3929 else if(src.
id()==ID_index_designator)
3932 else if(src.
id()==ID_symbol)
3935 else if(src.
id()==ID_nondet_symbol)
3938 else if(src.
id()==ID_predicate_symbol)
3941 else if(src.
id()==ID_predicate_next_symbol)
3944 else if(src.
id()==ID_predicate_passive_symbol)
3947 else if(src.
id()==
"quant_symbol")
3950 else if(src.
id()==ID_nondet_bool)
3953 else if(src.
id()==ID_object_descriptor)
3956 else if(src.
id()==
"Hoare")
3959 else if(src.
id()==ID_code)
3965 else if(src.
id() == ID_annotated_pointer_constant)
3971 else if(src.
id()==ID_string_constant)
3974 else if(src.
id()==ID_struct)
3977 else if(src.
id()==ID_vector)
3980 else if(src.
id()==ID_union)
3983 else if(src.
id()==ID_array)
3986 else if(src.
id() == ID_array_list)
3989 else if(src.
id()==ID_typecast)
3992 else if(src.
id()==ID_comma)
3995 else if(src.
id()==ID_ptr_object)
3996 return "PTR_OBJECT("+
id2string(src.
get(ID_identifier))+
")";
3998 else if(src.
id()==ID_cond)
4008 else if(src.
id()==ID_unknown)
4011 else if(src.
id()==ID_invalid)
4014 else if(src.
id()==ID_extractbit)
4017 else if(src.
id()==ID_extractbits)
4020 else if(src.
id()==ID_initializer_list ||
4021 src.
id()==ID_compound_literal)
4027 else if(src.
id()==ID_designated_initializer)
4033 else if(src.
id()==ID_sizeof)
4036 else if(src.
id()==ID_let)
4039 else if(src.
id()==ID_type)
4042 else if(src.
id() == ID_rol || src.
id() == ID_ror)
4045 else if(src.
id() == ID_conditional_target_group)
4050 else if(src.
id() == ID_bitreverse)
4053 else if(src.
id() == ID_r_ok || src.
id() == ID_w_ok || src.
id() == ID_rw_ok)
4057 auto prophecy_r_or_w_ok =
4058 expr_try_dynamic_cast<prophecy_r_or_w_ok_exprt>(src))
4063 else if(src.
id() == ID_pointer_in_range)
4066 else if(src.
id() == ID_prophecy_pointer_in_range)
4073 if(function_string_opt.has_value())
4074 return *function_string_opt;
4082 static const std::map<irep_idt, std::string> function_names = {
4083 {
"buffer_size",
"BUFFER_SIZE"},
4084 {
"is_zero_string",
"IS_ZERO_STRING"},
4085 {
"object_value",
"OBJECT_VALUE"},
4086 {
"pointer_base",
"POINTER_BASE"},
4087 {
"pointer_cons",
"POINTER_CONS"},
4088 {
"zero_string",
"ZERO_STRING"},
4089 {
"zero_string_length",
"ZERO_STRING_LENGTH"},
4091 {ID_alignof,
"alignof"},
4092 {ID_builtin_offsetof,
"builtin_offsetof"},
4093 {ID_complex_imag,
"__imag__"},
4094 {ID_complex_real,
"__real__"},
4095 {ID_concatenation,
"CONCATENATION"},
4096 {ID_count_leading_zeros,
"__builtin_clz"},
4097 {ID_count_trailing_zeros,
"__builtin_ctz"},
4098 {ID_dynamic_object,
"DYNAMIC_OBJECT"},
4099 {ID_live_object,
"LIVE_OBJECT"},
4100 {ID_writeable_object,
"WRITEABLE_OBJECT"},
4101 {ID_find_first_set,
"__builtin_ffs"},
4102 {ID_separate,
"SEPARATE"},
4103 {ID_floatbv_div,
"FLOAT/"},
4104 {ID_floatbv_minus,
"FLOAT-"},
4105 {ID_floatbv_mult,
"FLOAT*"},
4106 {ID_floatbv_plus,
"FLOAT+"},
4107 {ID_floatbv_rem,
"FLOAT%"},
4108 {ID_gcc_builtin_va_arg,
"gcc_builtin_va_arg"},
4111 {ID_ieee_float_equal,
"IEEE_FLOAT_EQUAL"},
4112 {ID_ieee_float_notequal,
"IEEE_FLOAT_NOTEQUAL"},
4113 {ID_infinity,
"INFINITY"},
4114 {ID_is_dynamic_object,
"IS_DYNAMIC_OBJECT"},
4115 {ID_is_invalid_pointer,
"IS_INVALID_POINTER"},
4117 {ID_isfinite,
"isfinite"},
4118 {ID_isinf,
"isinf"},
4119 {ID_isnan,
"isnan"},
4120 {ID_isnormal,
"isnormal"},
4127 {ID_width,
"WIDTH"},
4130 const auto function_entry = function_names.find(src.
id());
4131 if(function_entry == function_names.end())
4139 unsigned precedence;
4150 const std::string &identifier)
4162 expr2c.get_shorthands(expr);
4163 return expr2c.convert(expr);
4178 return expr2c.convert(type);
4188 const std::string &identifier,
4193 return expr2c.convert_with_identifier(type, identifier);
const shift_exprt & to_shift_expr(const exprt &expr)
Cast an exprt to a shift_exprt.
const extractbit_exprt & to_extractbit_expr(const exprt &expr)
Cast an exprt to an extractbit_exprt.
const extractbits_exprt & to_extractbits_expr(const exprt &expr)
Cast an exprt to an extractbits_exprt.
const bitreverse_exprt & to_bitreverse_expr(const exprt &expr)
Cast an exprt to a bitreverse_exprt.
const bitnot_exprt & to_bitnot_expr(const exprt &expr)
Cast an exprt to a bitnot_exprt.
bool can_cast_expr< binary_overflow_exprt >(const exprt &base)
bool can_cast_expr< unary_minus_overflow_exprt >(const exprt &base)
const shl_exprt & to_shl_expr(const exprt &expr)
Cast an exprt to a shl_exprt.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a typet to a signedbv_typet.
bool can_cast_type< signedbv_typet >(const typet &type)
Check whether a reference to a typet is a signedbv_typet.
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
const fixedbv_typet & to_fixedbv_type(const typet &type)
Cast a typet to a fixedbv_typet.
bool can_cast_type< unsignedbv_typet >(const typet &type)
Check whether a reference to a typet is a unsignedbv_typet.
const unsignedbv_typet & to_unsignedbv_type(const typet &type)
Cast a typet to an unsignedbv_typet.
const byte_update_exprt & to_byte_update_expr(const exprt &expr)
const byte_extract_exprt & to_byte_extract_expr(const exprt &expr)
std::string MetaString(const std::string &in)
floatbv_typet float_type()
unsignedbv_typet unsigned_int_type()
std::string c_type_as_string(const irep_idt &c_type)
signedbv_typet signed_int_type()
bitvector_typet char_type()
bitvector_typet wchar_t_type()
floatbv_typet long_double_type()
floatbv_typet double_type()
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a typet to a c_bit_field_typet.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
Pointer-typed bitvector constant annotated with the pointer expression that the bitvector is the nume...
exprt & symbolic_pointer()
const typet & element_type() const
The type of the elements of the array.
A base class for binary expressions.
A base class for variable bindings (quantifiers, let, lambda)
Reverse the order of bits in a bit-vector.
std::size_t get_width() const
Expression corresponding to op() where the bytes starting at position offset (given in number of byte...
const typet & underlying_type() const
C enum tag type, i.e., c_enum_typet with an identifier.
const typet & underlying_type() const
std::vector< c_enum_membert > memberst
virtual void read(const typet &src)
virtual std::unique_ptr< c_qualifierst > clone() const
virtual std::string as_string() const
codet representation of an inline assembler statement.
const irep_idt & get_flavor() const
A codet representing sequential composition of program statements.
code_operandst & statements()
codet representation of a do while statement.
const exprt & cond() const
const codet & body() const
codet representation of a for statement.
const exprt & init() const
const exprt & iter() const
const exprt & cond() const
const codet & body() const
A codet representing an assignment in the program.
goto_instruction_codet representation of a function call statement.
codet representation of an if-then-else statement.
const codet & then_case() const
const exprt & cond() const
const codet & else_case() const
codet representation of a label for branch targets.
const irep_idt & get_label() const
codet representation of a switch-case, i.e. a case statement within a switch.
const exprt & case_op() const
std::vector< parametert > parameterst
const typet & return_type() const
bool has_ellipsis() const
const parameterst & parameters() const
codet representing a while statement.
const exprt & cond() const
const codet & body() const
Data structure for representing an arbitrary statement in a program.
const irep_idt & get_statement() const
struct configt::ansi_ct ansi_c
A constant literal expression.
const irep_idt & get_value() const
bool is_null_pointer() const
Returns true if expr has a pointer type and a value NULL; it also returns true when expr has value ze...
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
bool starts_with(const char *s) const
equivalent of as_string().starts_with(s)
const char * c_str() const
std::optional< std::string > convert_function(const exprt &src)
Returns a string if src is a function with a known conversion, else returns nullopt.
std::string convert_nondet(const exprt &src, unsigned &precedence)
std::string convert_literal(const exprt &src)
std::string convert_code_continue(unsigned indent)
std::string convert_code_switch_case(const code_switch_caset &src, unsigned indent)
std::string convert_typecast(const typecast_exprt &src, unsigned &precedence)
std::string convert_comma(const exprt &src, unsigned precedence)
std::string convert_code_assert(const codet &src, unsigned indent)
std::string convert_union(const exprt &src, unsigned &precedence)
virtual std::string convert_rec(const typet &src, const c_qualifierst &qualifiers, const std::string &declarator)
std::string convert_code_expression(const codet &src, unsigned indent)
std::string convert_code_goto(const codet &src, unsigned indent)
std::string convert_code_switch(const codet &src, unsigned indent)
std::string convert_pointer_in_range(const pointer_in_range_exprt &src)
std::string convert_initializer_list(const exprt &src)
std::string convert_quantified_symbol(const exprt &src)
std::string convert_binding(const binding_exprt &, const std::string &symbol, unsigned precedence)
std::string convert_function_application(const function_application_exprt &src)
std::string convert_code_unlock(const codet &src, unsigned indent)
std::string convert_code_decl_block(const codet &src, unsigned indent)
static std::string indent_str(unsigned indent)
std::string convert_byte_update(const byte_update_exprt &, unsigned precedence)
std::string convert_code(const codet &src)
std::string convert_pointer_arithmetic(const exprt &src, unsigned &precedence)
std::string convert_let(const let_exprt &, unsigned precedence)
std::string convert_nondet_bool()
std::string convert_norep(const exprt &src, unsigned &precedence)
const expr2c_configurationt & configuration
std::unordered_map< irep_idt, std::unordered_set< irep_idt > > ns_collision
std::string convert_code_output(const codet &src, unsigned indent)
std::string convert_code_while(const code_whilet &src, unsigned indent)
std::string convert_index_designator(const exprt &src)
std::string convert_code_frontend_decl(const codet &, unsigned indent)
std::string convert_pointer_difference(const exprt &src, unsigned &precedence)
std::string convert_code_block(const code_blockt &src, unsigned indent)
std::string convert_code_asm(const code_asmt &src, unsigned indent)
std::string convert_prophecy_pointer_in_range(const prophecy_pointer_in_range_exprt &src)
std::string convert_allocate(const exprt &src, unsigned &precedence)
std::string convert_Hoare(const exprt &src)
std::string convert_sizeof(const exprt &src, unsigned &precedence)
std::string convert_code_lock(const codet &src, unsigned indent)
std::string convert_r_or_w_ok(const r_or_w_ok_exprt &src)
std::string convert_code_dowhile(const code_dowhilet &src, unsigned indent)
irep_idt id_shorthand(const irep_idt &identifier) const
std::string convert_cond(const exprt &src, unsigned precedence)
std::string convert_side_effect_expr_function_call(const side_effect_expr_function_callt &src)
std::string convert_overflow(const exprt &src, unsigned &precedence)
std::string convert_member(const member_exprt &src, unsigned precedence)
void get_shorthands(const exprt &expr)
std::string convert_code_for(const code_fort &src, unsigned indent)
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...
std::string convert_extractbits(const extractbits_exprt &src, unsigned precedence)
virtual std::string convert_struct(const exprt &src, unsigned &precedence)
std::string convert_trinary(const ternary_exprt &src, const std::string &symbol1, const std::string &symbol2, unsigned precedence)
std::string convert_prob_coin(const exprt &src, unsigned &precedence)
std::string convert_update(const update_exprt &, unsigned precedence)
std::string convert_nondet_symbol(const nondet_symbol_exprt &)
std::string convert_code_printf(const codet &src, unsigned indent)
std::string convert_unary(const unary_exprt &, const std::string &symbol, unsigned precedence)
std::string convert_code_ifthenelse(const code_ifthenelset &src, unsigned indent)
std::string convert_index(const binary_exprt &, unsigned precedence)
std::string convert_member_designator(const exprt &src)
std::string convert_byte_extract(const byte_extract_exprt &, unsigned precedence)
std::string convert_code_label(const code_labelt &src, unsigned indent)
virtual std::string convert_symbol(const exprt &src)
virtual std::string convert_constant(const constant_exprt &src, unsigned &precedence)
std::string convert_code_array_copy(const codet &src, unsigned indent)
std::string convert_statement_expression(const exprt &src, unsigned &precendence)
std::string convert_struct_member_value(const exprt &src, unsigned precedence)
std::string convert_code_dead(const codet &src, unsigned indent)
virtual std::string convert_annotated_pointer_constant(const annotated_pointer_constant_exprt &src, unsigned &precedence)
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_with_precedence(const exprt &src, unsigned &precedence)
std::string convert_designated_initializer(const exprt &src)
std::string convert_vector(const exprt &src, unsigned &precedence)
std::string convert_multi_ary(const exprt &src, const std::string &symbol, unsigned precedence, bool full_parentheses)
std::string convert_array_member_value(const exprt &src, unsigned precedence)
std::string convert_unary_post(const exprt &src, const std::string &symbol, unsigned precedence)
std::unordered_map< irep_idt, irep_idt > shorthands
std::string convert_complex(const exprt &src, unsigned precedence)
std::string convert_code_function_call(const code_function_callt &src, unsigned indent)
std::string convert_code_fence(const codet &src, unsigned indent)
std::string convert_bitreverse(const bitreverse_exprt &src)
virtual std::string convert(const typet &src)
std::string convert_code_return(const codet &src, unsigned indent)
std::string convert_code_break(unsigned indent)
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_with(const exprt &src, unsigned precedence)
std::string convert_code_frontend_assign(const code_frontend_assignt &, unsigned indent)
std::string convert_object_descriptor(const exprt &src, unsigned &precedence)
std::string convert_predicate_passive_symbol(const exprt &src)
std::string convert_array_list(const exprt &src, unsigned &precedence)
std::string convert_array_of(const exprt &src, unsigned precedence)
std::string convert_code_array_replace(const codet &src, unsigned indent)
std::string convert_conditional_target_group(const exprt &src)
std::string convert_code_assume(const codet &src, unsigned indent)
virtual std::string convert_array_type(const typet &src, const c_qualifierst &qualifiers, const std::string &declarator_str)
To generate a C-like type declaration of an array.
std::string convert_code_input(const codet &src, unsigned indent)
std::string convert_extractbit(const extractbit_exprt &, unsigned precedence)
std::string convert_predicate_next_symbol(const exprt &src)
std::string convert_code_array_set(const codet &src, unsigned indent)
std::string convert_binary(const binary_exprt &, const std::string &symbol, unsigned precedence, bool full_parentheses)
virtual std::string convert_constant_bool(bool boolean_value)
To get the C-like representation of a given boolean value.
std::string convert_predicate_symbol(const exprt &src)
std::string convert_prophecy_r_or_w_ok(const prophecy_r_or_w_ok_exprt &src)
std::string convert_array(const exprt &src)
std::string convert_prob_uniform(const exprt &src, unsigned &precedence)
Base class for all expressions.
std::vector< exprt > operandst
bool has_operands() const
Return true if there is at least one operand.
bool is_true() const
Return whether the expression is a constant representing true.
const source_locationt & source_location() const
typet & type()
Return the type of the expression.
bool is_constant() const
Return whether the expression is a constant.
std::size_t get_fraction_bits() const
std::string to_ansi_c_string() const
Application of (mathematical) function.
std::string to_ansi_c_string() const
There are a large number of kinds of tree structured or tree-like data in CPROVER.
bool get_bool(const irep_idt &name) const
const irept & find(const irep_idt &name) const
const irep_idt & get(const irep_idt &name) const
const std::string & id_string() const
void set(const irep_idt &name, const irep_idt &value)
const irep_idt & id() const
const std::string & get_string(const irep_idt &name) const
exprt & where()
convenience accessor for binding().where()
binding_exprt::variablest & variables()
convenience accessor for binding().variables()
std::string expr2string() const
Extract member of struct or union.
const exprt & compound() const
irep_idt get_component_name() const
std::size_t get_component_number() const
Modulo defined as lhs-(rhs * truncate(lhs/rhs)).
Binary multiplication Associativity is not specified.
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
Expression to hold a nondeterministic choice.
const irep_idt & get_identifier() const
The plus expression Associativity is not specified.
pointer_in_range(a, b, c) evaluates to true iff same_object(a, b, c) ∧ r_ok(a, offset(c)-offset(a)) ∧...
const exprt & lower_bound() const
const exprt & pointer() const
const exprt & upper_bound() const
const typet & base_type() const
The type of the data what we point to.
pointer_in_range (see pointer_in_range_exprt) with prophecy expressions to encode whether a pointer r...
const exprt & upper_bound() const
const exprt & lower_bound() const
const exprt & pointer() const
A base class for a predicate that indicates that an address range is ok to read or write or both.
const exprt & size() const
const exprt & pointer() const
A base class for a predicate that indicates that an address range is ok to read or write or both.
const exprt & size() const
const exprt & pointer() const
A base class for shift and rotate operators.
A side_effect_exprt representation of a function call side effect.
exprt::operandst & arguments()
const irep_idt & get_function() const
const irep_idt & get_comment() const
const irept::named_subt & get_pragmas() const
A struct tag type, i.e., struct_typet with an identifier.
Structure type, corresponds to C style structs.
const irep_idt & get_pretty_name() const
Base type for structs and unions.
const componentt & get_component(const irep_idt &component_name) const
Get the reference to a component with given name.
bool is_incomplete() const
A struct/union may be incomplete.
const componentst & components() const
std::vector< componentt > componentst
Expression to hold a symbol (variable)
const irep_idt & get_identifier() const
irep_idt base_name
Base (non-scoped) name.
source_locationt location
Source code location of definition of symbol.
typet type
Type of symbol.
An expression with three operands.
const typet & subtype() const
Semantic type conversion.
static exprt conditional_cast(const exprt &expr, const typet &type)
The type of an expression, extends irept.
Generic base class for unary expressions.
A union tag type, i.e., union_typet with an identifier.
Fixed-width bit-vector with unsigned binary interpretation.
Operator to update elements in structs and arrays.
const constant_exprt & size() const
const typet & element_type() const
The type of the elements of the vector.
bool has_prefix(const std::string &s, const std::string &prefix)
std::string expr2c(const exprt &expr, const namespacet &ns, const expr2c_configurationt &configuration)
static std::optional< exprt > build_sizeof_expr(const constant_exprt &expr, const namespacet &ns)
std::string type2c(const typet &type, const namespacet &ns, const expr2c_configurationt &configuration)
static std::string clean_identifier(const irep_idt &id)
#define forall_operands(it, expr)
#define forall_expr(it, expr)
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.
API to expression classes for floating-point arithmetic.
const floatbv_typecast_exprt & to_floatbv_typecast_expr(const exprt &expr)
Cast an exprt to a floatbv_typecast_exprt.
bool can_cast_expr< code_inputt >(const exprt &base)
bool can_cast_expr< code_outputt >(const exprt &base)
const code_function_callt & to_code_function_call(const goto_instruction_codet &code)
const std::string & id2string(const irep_idt &d)
std::string from_type(const namespacet &ns, const irep_idt &identifier, const typet &type)
void irep2lisp(const irept &src, lispexprt &dest)
double remainder(double x, double y)
const lambda_exprt & to_lambda_expr(const exprt &expr)
Cast an exprt to a lambda_exprt.
const function_application_exprt & to_function_application_expr(const exprt &expr)
Cast an exprt to a function_application_exprt.
const quantifier_exprt & to_quantifier_expr(const exprt &expr)
Cast an exprt to a quantifier_exprt.
const std::string integer2string(const mp_integer &n, unsigned base)
API to expression classes for Pointers.
const r_or_w_ok_exprt & to_r_or_w_ok_expr(const exprt &expr)
const annotated_pointer_constant_exprt & to_annotated_pointer_constant_expr(const exprt &expr)
Cast an exprt to an annotated_pointer_constant_exprt.
const prophecy_pointer_in_range_exprt & to_prophecy_pointer_in_range_expr(const exprt &expr)
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
const pointer_in_range_exprt & to_pointer_in_range_expr(const exprt &expr)
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
std::optional< mp_integer > pointer_offset_bits(const typet &type, const namespacet &ns)
std::optional< exprt > size_of_expr(const typet &type, const namespacet &ns)
#define SYMEX_DYNAMIC_PREFIX
#define CHECK_RETURN(CONDITION)
#define UNREACHABLE
This should be used to mark dead code.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
const code_ifthenelset & to_code_ifthenelse(const codet &code)
const code_whilet & to_code_while(const codet &code)
const code_switch_caset & to_code_switch_case(const codet &code)
const code_labelt & to_code_label(const codet &code)
side_effect_expr_function_callt & to_side_effect_expr_function_call(exprt &expr)
const code_dowhilet & to_code_dowhile(const codet &code)
const code_blockt & to_code_block(const codet &code)
const code_frontend_returnt & to_code_frontend_return(const codet &code)
const code_frontend_assignt & to_code_frontend_assign(const codet &code)
const code_fort & to_code_for(const codet &code)
code_asmt & to_code_asm(codet &code)
const codet & to_code(const exprt &expr)
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
const notequal_exprt & to_notequal_expr(const exprt &expr)
Cast an exprt to an notequal_exprt.
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
const update_exprt & to_update_expr(const exprt &expr)
Cast an exprt to an update_exprt.
const let_exprt & to_let_expr(const exprt &expr)
Cast an exprt to a let_exprt.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const mod_exprt & to_mod_expr(const exprt &expr)
Cast an exprt to a mod_exprt.
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
const not_exprt & to_not_expr(const exprt &expr)
Cast an exprt to an not_exprt.
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
const div_exprt & to_div_expr(const exprt &expr)
Cast an exprt to a div_exprt.
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
const with_exprt & to_with_expr(const exprt &expr)
Cast an exprt to a with_exprt.
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
const equal_exprt & to_equal_expr(const exprt &expr)
Cast an exprt to an equal_exprt.
const plus_exprt & to_plus_expr(const exprt &expr)
Cast an exprt to a plus_exprt.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
const nondet_symbol_exprt & to_nondet_symbol_expr(const exprt &expr)
Cast an exprt to a nondet_symbol_exprt.
const implies_exprt & to_implies_expr(const exprt &expr)
Cast an exprt to a implies_exprt.
const binary_relation_exprt & to_binary_relation_expr(const exprt &expr)
Cast an exprt to a binary_relation_exprt.
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const vector_typet & to_vector_type(const typet &type)
Cast a typet to a vector_typet.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
bool is_constant(const typet &type)
This method tests, if the given typet is a constant.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
bool can_cast_type< code_typet >(const typet &type)
Check whether a reference to a typet is a code_typet.
const complex_typet & to_complex_type(const typet &type)
Cast a typet to a complex_typet.
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
const struct_or_union_tag_typet & to_struct_or_union_tag_type(const typet &type)
Cast a typet to a struct_or_union_tag_typet.
const string_constantt & to_string_constant(const exprt &expr)
void replace(const union_find_replacet &replace_map, string_not_contains_constraintt &constraint)
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
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.
std::size_t long_double_width
std::size_t long_long_int_width
std::size_t long_int_width
std::size_t short_int_width
Used for configuring the behaviour of expr2c and type2c.
bool print_enum_int_value
When printing an enum-typed constant, print the integer representation.
static expr2c_configurationt clean_configuration
This prints compilable C that loses some of the internal details of the GOTO program.
bool expand_typedef
Print the expanded type instead of a typedef name, even when a typedef is present.
static expr2c_configurationt default_configuration
This prints a human readable C like syntax that closely mirrors the internals of the GOTO program.
std::string true_string
This is the string that will be printed for the true boolean expression.
bool print_struct_body_in_type
When printing a struct_typet, should the components of the struct be printed inline.
bool use_library_macros
This is the string that will be printed for null pointers.
bool include_struct_padding_components
When printing struct_typet or struct_exprt, include the artificial padding components introduced to k...
std::string false_string
This is the string that will be printed for the false boolean expression.
bool include_array_size
When printing array_typet, should the size of the array be printed.
bool has_suffix(const std::string &s, const std::string &suffix)
bool is_signed(const typet &t)
Convenience function – is the type signed?