23 #include <ansi-c/ansi_c_y.tab.h>
33 static unsigned __indent;
37 indenter() { __indent+=2; }
38 ~indenter() { __indent-=2; }
44 lex.LookAhead(0, _tk); \
45 std::cout << std::string(__indent, ' ') << "Text [" << _tk.line_no << "]: " \
46 << _tk.text << '\n'; \
122 return "CLASS_TEMPLATE";
124 return "MEMBER_TEMPLATE";
126 return "FUNCTION_TEMPLATE";
130 return "NON_TYPE_TEMPLATE_PARAMETER";
132 return "TYPE_TEMPLATE_PARAMETER";
134 return "TEMPLATE_TEMPLATE_PARAMETER";
140 typedef std::map<irep_idt, new_scopet>
id_mapt;
147 inline void print(std::ostream &out)
const
165 void print_rec(std::ostream &,
unsigned indent)
const;
188 for(id_mapt::const_iterator
193 out << std::string(indent,
' ') << it->first <<
": "
195 it->second.print_rec(out, indent+2);
203 lex(_cpp_parser.token_buffer),
280 typet &trailing_return_type);
402 if(p->
id()==ID_merged_type)
405 p = &merged_type.last_type();
421 if(cpp_name.
get_sub().size()==1 &&
422 cpp_name.
get_sub().front().id()==ID_name)
423 id=cpp_name.
get_sub().front().get(ID_identifier);
470 if(dest.
id()!=ID_merged_type)
483 sub.emplace(sub.begin(), src);
489 #define ERROR_TOKENS 4
499 source_location.
set_file(t[0].filename);
502 std::string
message =
"parse error before '";
557 std::cout << std::string(__indent,
' ') <<
"Parser::rDefinition 1 " << t
563 else if(t==TOK_TYPEDEF)
565 else if(t==TOK_TEMPLATE)
569 else if(t==TOK_EXTERN &&
lex.
LookAhead(1)==TOK_TEMPLATE)
571 else if(t==TOK_NAMESPACE)
573 else if(t==TOK_INLINE &&
lex.
LookAhead(1)==TOK_NAMESPACE)
575 else if(t==TOK_USING &&
579 else if(t==TOK_USING)
581 else if(t==TOK_STATIC_ASSERT)
612 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedef 1\n";
641 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 1\n";
657 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 2\n";
674 std::cout << std::string(__indent,
' ') <<
"Parser::rTypedefUsing 3\n";
698 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 0\n";
709 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 0.1\n";
721 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 1\n";
729 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 2\n";
737 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 3\n";
746 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeSpecifier 4\n";
758 if(t==TOK_IDENTIFIER || t==TOK_SCOPE
759 || t==TOK_CONSTEXPR || t==TOK_CONST || t==TOK_VOLATILE || t==TOK_RESTRICT
760 || t==TOK_CHAR || t==TOK_INT || t==TOK_SHORT || t==TOK_LONG
761 || t==TOK_CHAR16_T || t==TOK_CHAR32_T
762 || t==TOK_WCHAR_T || t==TOK_COMPLEX
763 || t==TOK_SIGNED || t==TOK_UNSIGNED || t==TOK_FLOAT || t==TOK_DOUBLE
764 || t==TOK_INT8 || t==TOK_INT16 || t==TOK_INT32 || t==TOK_INT64
766 || t==TOK_PTR32 || t==TOK_PTR64
767 || t==TOK_GCC_FLOAT80 || t==TOK_GCC_FLOAT128
768 || t==TOK_VOID || t==TOK_BOOL || t==TOK_CPROVER_BOOL
769 || t==TOK_CLASS || t==TOK_STRUCT || t==TOK_UNION || t==TOK_ENUM
774 || t==TOK_UNDERLYING_TYPE
813 linkage_spec.
items().push_back(item);
829 bool is_inline=
false;
846 name=tk2.
data.
get(ID_C_base_name);
976 items.push_back(item);
980 items.push_back(item);
1012 typet template_type;
1031 std::cout << std::string(__indent,
' ') <<
"BODY: "
1032 << body.
pretty() <<
'\n';
1033 std::cout << std::string(__indent,
' ') <<
"TEMPLATE_TYPE: "
1034 << template_type.
pretty() <<
'\n';
1036 body.
add(ID_template_type).
swap(template_type);
1037 body.
set(ID_is_template,
true);
1047 body.
add(ID_template_type).
swap(template_type);
1048 body.
set(ID_is_template,
true);
1068 decl=
typet(ID_template);
1081 irept &template_parameters=decl.
add(ID_template_parameters);
1105 if(template_parameters.
get_sub().empty())
1130 args.
get_sub().back().swap(a);
1141 args.
get_sub().back().swap(a);
1158 std::cout << std::string(__indent,
' ') <<
"Parser::rTempArgDeclaration 0\n";
1163 if((t0==TOK_CLASS || t0==TOK_TYPENAME))
1173 declaration.
set(ID_is_type,
true);
1174 declaration.
type()=
typet(
"cpp-template-type");
1184 bool has_ellipsis=
false;
1233 std::cout << std::string(__indent,
' ') <<
"Parser::rTempArgDeclaration 1\n";
1236 if(t0==TOK_TEMPLATE)
1240 typet template_type;
1271 std::cout << std::string(__indent,
' ')
1272 <<
"Parser::rTempArgDeclaration 2\n";
1276 declaration.
set(ID_is_type,
false);
1282 std::cout << std::string(__indent,
' ')
1283 <<
"Parser::rTempArgDeclaration 3\n";
1286 bool has_ellipsis=
false;
1303 std::cout << std::string(__indent,
' ')
1304 <<
"Parser::rTempArgDeclaration 4\n";
1390 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 0.1 token: "
1402 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 0.2\n";
1410 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 1\n";
1418 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 3\n";
1421 typet cv_q, integral;
1435 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 4\n";
1449 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 5\n";
1453 declaration, storage_spec, member_spec, integral, cv_q);
1460 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclaration 6 " << t
1465 ((t==TOK_IDENTIFIER &&
lex.
LookAhead(1)==
'=') || t==
'*'))
1476 typet cv_q, integral;
1502 integral.
swap(cv_q);
1541 std::cout << std::string(__indent,
' ')
1542 <<
"Parser::rIntegralDeclaration 1 token: "
1550 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 2\n";
1556 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 3\n";
1569 std::cout << std::string(__indent,
' ')
1570 <<
"Parser::rIntegralDeclaration 4\n";
1578 std::cout << std::string(__indent,
' ')
1579 <<
"Parser::rIntegralDeclaration 5\n";
1599 std::cout << std::string(__indent,
' ') <<
"Parser::rIntegralDeclaration 6 "
1608 declaration.
type().
id() == ID_auto &&
1610 declaration.
declarators().front().type().id() == ID_function_type &&
1611 declaration.
declarators().front().type().subtype().is_not_nil())
1613 declaration.
type() = declaration.
declarators().front().type().subtype();
1614 declaration.
declarators().front().type().subtype().make_nil();
1618 std::cout << std::string(__indent,
' ')
1619 <<
"Parser::rIntegralDeclaration 7\n";
1625 std::cout << std::string(__indent,
' ')
1626 <<
"Parser::rIntegralDeclaration 8 "
1627 << declaration.
pretty() <<
'\n';
1635 std::cout << std::string(__indent,
' ')
1636 <<
"Parser::rIntegralDeclaration 9\n";
1646 std::cout << std::string(__indent,
' ')
1647 <<
"Parser::rIntegralDeclaration 10\n";
1659 std::cout << std::string(__indent,
' ') <<
"Parser::rConstDeclaration\n";
1684 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 1\n";
1687 if(!
rName(type_name))
1693 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 2\n";
1707 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 3\n";
1711 bool is_operator =
false;
1716 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 4\n";
1719 assert(!type_name.
get_sub().empty());
1721 for(std::size_t i=0; i < type_name.
get_sub().size(); i++)
1723 if(type_name.
get_sub()[i].id() == ID_operator)
1734 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 5\n";
1738 typet type = type_name;
1742 typet trailing_return_type;
1744 conv_operator_declarator, type_name, trailing_return_type))
1747 type_name=
typet(
"cpp-cast-operator");
1749 declaration.
declarators().push_back(conv_operator_declarator);
1754 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 6\n";
1757 assert(!type_name.
get_sub().empty());
1759 bool is_destructor=
false;
1768 typet trailing_return_type;
1770 constructor_declarator, type_name, trailing_return_type))
1774 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 7\n";
1779 type_name=trailing_return_type;
1781 type_name=
typet(is_destructor?ID_destructor:ID_constructor);
1783 declaration.
declarators().push_back(constructor_declarator);
1788 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 8\n";
1806 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 9\n";
1818 declaration.
type().
swap(type_name);
1823 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 10\n";
1829 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 11\n";
1838 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclaration 12\n";
1862 std::cout << std::string(__indent,
' ') <<
"Parser::isConstructorDecl "
1871 if(t==
'*' || t==
'&' || t==
'(')
1873 else if(t==TOK_STDCALL || t==TOK_FASTCALL || t==TOK_CLRCALL || t==TOK_CDECL)
1877 else if(t==TOK_IDENTIFIER)
1901 while(t0==TOK_IDENTIFIER)
1924 else if(v==
'\0' || v==
';' || v==
'}')
1928 else if(u==
'\0' || u==
';' || u==
'}')
1953 member_spec.
clear();
1958 t == TOK_FRIEND || t == TOK_INLINE || t == TOK_VIRTUAL ||
1959 t == TOK_EXPLICIT || t == TOK_MSC_FORCEINLINE)
1967 case TOK_MSC_FORCEINLINE:
1970 case TOK_VIRTUAL: member_spec.
set_virtual(
true);
break;
1971 case TOK_FRIEND: member_spec.
set_friend(
true);
break;
1972 case TOK_EXPLICIT: member_spec.
set_explicit(
true);
break;
1996 t==TOK_THREAD_LOCAL)
2003 case TOK_STATIC: storage_spec.
set_static();
break;
2004 case TOK_EXTERN: storage_spec.
set_extern();
break;
2005 case TOK_AUTO: storage_spec.
set_auto();
break;
2007 case TOK_MUTABLE: storage_spec.
set_mutable();
break;
2008 case TOK_GCC_ASM: storage_spec.
set_asm();
break;
2027 if(t==TOK_CONSTEXPR ||
2028 t==TOK_CONST || t==TOK_VOLATILE || t==TOK_RESTRICT ||
2029 t==TOK_PTR32 || t==TOK_PTR64 ||
2030 t==TOK_GCC_ATTRIBUTE || t==TOK_GCC_ASM)
2039 p=
typet(ID_constexpr);
2051 p=
typet(ID_volatile);
2057 p=
typet(ID_restrict);
2074 case TOK_GCC_ATTRIBUTE:
2129 exprt exp(ID_alignof);
2130 exp.
add(ID_type_arg).
swap(tname);
2133 typet attr(ID_aligned);
2135 attr.
add(ID_size, exp);
2152 typet attr(ID_aligned);
2154 attr.
add(ID_size, exp);
2168 std::cout << std::string(__indent,
' ') <<
"Parser::rAttribute "
2185 case TOK_GCC_ATTRIBUTE_PACKED:
2187 typet attr(ID_packed);
2193 case TOK_GCC_ATTRIBUTE_TRANSPARENT_UNION:
2195 typet attr(ID_transparent_union);
2201 case TOK_GCC_ATTRIBUTE_VECTOR_SIZE:
2216 attr.
set(ID_size, exp);
2222 case TOK_GCC_ATTRIBUTE_ALIGNED:
2224 typet attr(ID_aligned);
2241 attr.
add(ID_size, exp);
2248 case TOK_GCC_ATTRIBUTE_MODE:
2262 typet attr(ID_gcc_attribute_mode);
2264 attr.
set(ID_size, name.
get(ID_identifier));
2269 case TOK_GCC_ATTRIBUTE_GNU_INLINE:
2271 typet attr(ID_static);
2277 case TOK_GCC_ATTRIBUTE_WEAK:
2279 typet attr(ID_weak);
2285 case TOK_GCC_ATTRIBUTE_ALIAS:
2298 typet attr(ID_alias);
2305 case TOK_GCC_ATTRIBUTE_SECTION:
2318 typet attr(ID_section);
2325 case TOK_GCC_ATTRIBUTE_NORETURN:
2327 typet attr(ID_noreturn);
2333 case TOK_GCC_ATTRIBUTE_CONSTRUCTOR:
2335 typet attr(ID_constructor);
2341 case TOK_GCC_ATTRIBUTE_DESTRUCTOR:
2343 typet attr(ID_destructor);
2387 typet attr(ID_noreturn);
2414 std::cout << std::string(__indent,
' ')
2415 <<
"Parser::optIntegralTypeOrClassSpec 0\n";
2425 bool is_integral=
false;
2435 std::cout << std::string(__indent,
' ')
2436 <<
"Parser::optIntegralTypeOrClassSpec 1\n";
2443 case TOK_CHAR: type_id=ID_char;
break;
2444 case TOK_CHAR16_T: type_id=ID_char16_t;
break;
2445 case TOK_CHAR32_T: type_id=ID_char32_t;
break;
2446 case TOK_INT: type_id=ID_int;
break;
2447 case TOK_SHORT: type_id=ID_short;
break;
2448 case TOK_LONG: type_id=ID_long;
break;
2449 case TOK_SIGNED: type_id=ID_signed;
break;
2450 case TOK_WCHAR_T: type_id=ID_wchar_t;
break;
2451 case TOK_COMPLEX: type_id=ID_complex;
break;
2452 case TOK_UNSIGNED: type_id=ID_unsigned;
break;
2453 case TOK_FLOAT: type_id=ID_float;
break;
2454 case TOK_DOUBLE: type_id=ID_double;
break;
2455 case TOK_VOID: type_id=ID_void;
break;
2456 case TOK_INT8: type_id=ID_int8;
break;
2457 case TOK_INT16: type_id=ID_int16;
break;
2458 case TOK_INT32: type_id=ID_int32;
break;
2459 case TOK_INT64: type_id=ID_int64;
break;
2460 case TOK_GCC_INT128: type_id=ID_gcc_int128;
break;
2461 case TOK_GCC_FLOAT80: type_id=ID_gcc_float80;
break;
2462 case TOK_GCC_FLOAT128: type_id=ID_gcc_float128;
break;
2464 type_id = ID_c_bool;
2466 case TOK_CPROVER_BOOL: type_id=ID_proper_bool;
break;
2467 case TOK_AUTO: type_id = ID_auto;
break;
2471 if(!type_id.
empty())
2488 std::cout << std::string(__indent,
' ')
2489 <<
"Parser::optIntegralTypeOrClassSpec 2\n";
2496 std::cout << std::string(__indent,
' ')
2497 <<
"Parser::optIntegralTypeOrClassSpec 3\n";
2500 if(t==TOK_CLASS || t==TOK_STRUCT || t==TOK_UNION || t==TOK_INTERFACE)
2502 else if(t==TOK_ENUM)
2504 else if(t==TOK_TYPEOF)
2507 std::cout << std::string(__indent,
' ')
2508 <<
"Parser::optIntegralTypeOrClassSpec 4\n";
2515 std::cout << std::string(__indent,
' ')
2516 <<
"Parser::optIntegralTypeOrClassSpec 5\n";
2536 p.
add(ID_type_arg).
swap(tname);
2545 std::cout << std::string(__indent,
' ')
2546 <<
"Parser::optIntegralTypeOrClassSpec 6\n";
2554 std::cout << std::string(__indent,
' ')
2555 <<
"Parser::optIntegralTypeOrClassSpec 7\n";
2562 std::cout << std::string(__indent,
' ')
2563 <<
"Parser::optIntegralTypeOrClassSpec 8\n";
2566 p.
add(ID_expr_arg).
swap(expr);
2570 else if(t==TOK_DECLTYPE)
2575 p=
typet(ID_decltype);
2591 p.
add(ID_expr_arg).
swap(expr);
2595 else if(t==TOK_UNDERLYING_TYPE)
2602 p=
typet(ID_msc_underlying_type);
2619 p.
add(ID_type_arg).
swap(tname);
2638 typet &trailing_return_type)
2642 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 0\n";
2649 constructor.
name().
swap(type_name);
2656 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 1\n";
2659 irept ¶meters=constructor.
type().
add(ID_parameters);
2669 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 2\n";
2672 typet &cv=
static_cast<typet &
>(constructor.
add(ID_method_qualifier));
2681 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 3\n";
2693 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 4\n";
2707 std::cout << std::string(__indent,
' ') <<
"Parser::rConstructorDecl 5\n";
2719 constructor.
value()=
codet(
"cpp-pure-virtual");
2789 else if(t==TOK_ELLIPSIS)
2835 bool should_be_declarator,
2846 declarators.push_back(declarator);
2864 bool should_be_declarator,
2877 typet bit_field_type(ID_c_bit_field);
2878 bit_field_type.
set(ID_size, e);
2891 declarator,
kDeclarator, should_be_declarator, is_statement))
2936 if(declarator.
type().
id()!=ID_function_type)
2952 typet bit_field_type(ID_c_bit_field);
2953 bit_field_type.
set(ID_size, e);
2960 dw.
swap(declarator);
2977 while(t==TOK_STDCALL || t==TOK_FASTCALL || t==TOK_CLRCALL || t==TOK_CDECL)
3007 bool should_be_declarator,
3014 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 1\n";
3021 typet d_outer, d_inner;
3036 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 2\n";
3044 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 3\n";
3055 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 4\n";
3063 if(!should_be_declarator)
3068 if(t!=
'[' && t!=
'(')
3074 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 5\n";
3081 (kind==
kDeclarator || t==TOK_IDENTIFIER || t==TOK_SCOPE))
3084 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 6\n";
3093 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 7\n";
3106 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 8\n";
3126 typet function_type(ID_function_type);
3128 function_type.
add(ID_parameters).
swap(args);
3132 d_outer.
swap(d_inner);
3138 init_args.
swap(args);
3143 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 9\n";
3152 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 10\n";
3173 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 11\n";
3191 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 12\n";
3206 std::list<typet> tl;
3207 tl.push_back(d_outer);
3208 while(tl.back().id() == ID_array)
3210 tl.push_back(tl.back().subtype());
3215 d_outer.
swap(array_type);
3218 tl.back().subtype().swap(d_outer);
3219 d_outer.
swap(tl.back());
3230 std::cout << std::string(__indent,
' ') <<
"Parser::rDeclarator2 13\n";
3256 std::cout << std::string(__indent,
' ') <<
"Parser::optPtrOperator 1\n";
3259 std::list<typet> t_list;
3266 std::cout << std::string(__indent,
' ') <<
"Parser::optPtrOperator 2 " << t
3272 typet op(ID_frontend_pointer);
3283 t_list.push_back(op);
3288 typet op(ID_block_pointer);
3299 t_list.push_back(op);
3313 t_list.push_back(cv);
3316 t_list.push_back(op);
3329 typet op(ID_frontend_pointer);
3330 op.
set(ID_C_reference,
true);
3332 t_list.push_front(op);
3334 else if(t==TOK_ANDAND)
3338 typet op(ID_frontend_pointer);
3339 op.
set(ID_C_rvalue_reference,
true);
3341 t_list.push_front(op);
3345 for(std::list<typet>::reverse_iterator
3350 if(it->id()==ID_merged_type)
3353 merged_type.last_type().subtype().swap(ptrs);
3357 assert(it->is_not_nil());
3358 it->subtype().swap(ptrs);
3378 init=
irept(ID_member_initializers);
3408 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 1\n";
3417 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 2\n";
3420 init=
codet(ID_member_initializer);
3421 init.
add(ID_member).
swap(name);
3431 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 3\n";
3450 std::cout << std::string(__indent,
' ') <<
"Parser::rMemberInit 4\n";
3490 std::cout << std::string(__indent,
' ') <<
"Parser::rName 0\n";
3500 name.
set(ID_typename,
true);
3510 std::cout << std::string(__indent,
' ') <<
"Parser::rName 1\n";
3518 std::cout << std::string(__indent,
' ') <<
"Parser::rName 2 "
3526 std::cout << std::string(__indent,
' ') <<
"Parser::rName 3\n";
3536 std::cout << std::string(__indent,
' ') <<
"Parser::rName 4\n";
3543 components.push_back(
irept(ID_template_args));
3544 components.back().
add(ID_arguments).
swap(args);
3552 case TOK_IDENTIFIER:
3554 std::cout << std::string(__indent,
' ') <<
"Parser::rName 5\n";
3563 if(t!=TOK_SCOPE && t!=
'<')
3570 std::cout << std::string(__indent,
' ') <<
"Parser::rName 6\n";
3573 components.push_back(
irept(
"::"));
3579 std::cout << std::string(__indent,
' ') <<
"Parser::rName 7\n";
3587 components.push_back(
irept(
"~"));
3593 std::cout << std::string(__indent,
' ') <<
"Parser::rName 8\n";
3597 components.push_back(
irept(ID_operator));
3600 components.push_back(
irept());
3653 operator_id = std::string(1,
static_cast<char>(t));
3656 case TOK_MULTASSIGN: operator_id=
"*=";
break;
3657 case TOK_DIVASSIGN: operator_id=
"/=";
break;
3658 case TOK_MODASSIGN: operator_id=
"%=";
break;
3659 case TOK_PLUSASSIGN: operator_id=
"+=";
break;
3660 case TOK_MINUSASSIGN: operator_id=
"-=";
break;
3661 case TOK_SHLASSIGN: operator_id=
"<<=";
break;
3662 case TOK_SHRASSIGN: operator_id=
">>=";
break;
3663 case TOK_ANDASSIGN: operator_id=
"&=";
break;
3664 case TOK_XORASSIGN: operator_id=
"^=";
break;
3665 case TOK_ORASSIGN: operator_id=
"|=";
break;
3666 case TOK_SHIFTLEFT: operator_id=
"<<";
break;
3667 case TOK_SHIFTRIGHT: operator_id=
">>";
break;
3668 case TOK_EQ: operator_id=
"==";
break;
3669 case TOK_NE: operator_id=
"!=";
break;
3670 case TOK_LE: operator_id=
"<=";
break;
3671 case TOK_GE: operator_id=
">=";
break;
3672 case TOK_ANDAND: operator_id=
"&&";
break;
3673 case TOK_OROR: operator_id=
"||";
break;
3674 case TOK_INCR: operator_id=
"++";
break;
3675 case TOK_DECR: operator_id=
"--";
break;
3676 case TOK_DOTPM: operator_id=
".*";
break;
3677 case TOK_ARROWPM: operator_id=
"->*";
break;
3678 case TOK_ARROW: operator_id=
"->";
break;
3687 name=
irept(t==TOK_NEW?ID_cpp_new:ID_cpp_delete);
3692 name=
irept(t==TOK_NEW?ID_cpp_new_array:ID_cpp_delete_array);
3719 assert(!operator_id.
empty());
3721 name=
irept(operator_id);
3735 typet cv1, cv2, type_name, ptr;
3750 if(!
rName(type_name))
3777 std::cout << std::string(__indent,
' ') <<
"Parser::rPtrToMember 0\n";
3780 typet ptm(ID_frontend_pointer);
3781 irept &name = ptm.
add(ID_to_member);
3791 bool loop_cond =
true;
3811 components.push_back(
irept(ID_template_args));
3812 components.back().
add(ID_arguments).
swap(args);
3819 case TOK_IDENTIFIER:
3826 if(t!=TOK_SCOPE && t!=
'<')
3833 components.push_back(
irept(
"::"));
3840 ptr_to_mem.
swap(ptm);
3843 std::cout << std::string(__indent,
' ') <<
"Parser::rPtrToMember 1\n";
3874 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 0\n";
3885 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 1\n";
3897 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 2\n";
3906 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 3\n";
3921 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4\n";
3933 exp.
id(ID_ambiguous);
3935 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4.1\n";
3947 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 4.2\n";
3954 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 5\n";
3972 std::cout << std::string(__indent,
' ') <<
"Parser::rTemplateArgs 6\n";
3976 template_args.
get_sub().back().swap(exp);
3988 case TOK_SHIFTRIGHT:
4069 else if(t==TOK_ELLIPSIS)
4081 list.
get_sub().back().swap(declaration);
4085 else if(t==TOK_ELLIPSIS)
4090 else if(t!=
')' && t!=TOK_ELLIPSIS)
4119 header=
typet(ID_register);
4137 declaration.
declarators().push_back(arg_declarator);
4167 expr.
id(ID_initializer_list);
4176 if(t==TOK_MSC_IF_EXISTS ||
4177 t==TOK_MSC_IF_NOT_EXISTS)
4287 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 1\n";
4304 spec.
set(ID_C_class,
true);
4321 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 2\n";
4333 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 3\n";
4356 std::cout << std::string(__indent,
' ') <<
"Parser::rEnumSpec 4\n";
4428 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 1\n";
4432 if(t!=TOK_CLASS && t!=TOK_STRUCT &&
4433 t!=TOK_UNION && t!=TOK_INTERFACE)
4437 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 2\n";
4442 spec=
typet(ID_struct);
4443 spec.
set(ID_C_class,
true);
4445 else if(t==TOK_INTERFACE)
4447 spec=
typet(ID_struct);
4448 spec.
set(ID_C_interface,
true);
4450 else if(t==TOK_STRUCT)
4451 spec=
typet(ID_struct);
4452 else if(t==TOK_UNION)
4453 spec=
typet(ID_union);
4460 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 3\n";
4467 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 4\n";
4491 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 5\n";
4511 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 6\n";
4523 std::cout << std::string(__indent,
' ') <<
"Parser::rClassSpec 7\n";
4547 irept base(ID_base);
4552 base.
set(ID_virtual,
true);
4556 if(t==TOK_PUBLIC || t==TOK_PROTECTED || t==TOK_PRIVATE)
4561 base.
set(ID_protection, ID_public);
4565 base.
set(ID_protection, ID_protected);
4569 base.
set(ID_protection, ID_private);
4582 base.
set(ID_virtual,
true);
4596 bases.
get_sub().back().swap(base);
4614 std::cout << std::string(__indent,
' ') <<
"Parser::rClassBody 0\n";
4639 std::cout << std::string(__indent,
' ') <<
"Parser::rClassBody "
4640 << member.
pretty() <<
'\n';
4644 std::move(
static_cast<exprt &
>(
static_cast<irept &
>(member))));
4676 std::cout << std::string(__indent,
' ') <<
"Parser::rClassMember 0 " << t
4680 if(t==TOK_PUBLIC || t==TOK_PROTECTED || t==TOK_PRIVATE)
4685 member.
id(
"cpp-public");
4689 member.
id(
"cpp-protected");
4693 member.
id(
"cpp-private");
4709 else if(t==TOK_TYPEDEF)
4711 else if(t==TOK_TEMPLATE)
4713 else if(t==TOK_USING &&
4717 else if(t==TOK_USING)
4719 else if(t==TOK_STATIC_ASSERT)
4748 name_decl.
name() = name;
4765 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 0\n";
4772 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 1\n";
4788 exp=
exprt(ID_comma);
4794 std::cout << std::string(__indent,
' ') <<
"Parser::rCommaExpression 2\n";
4810 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 0\n";
4817 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 1\n";
4823 t==TOK_MULTASSIGN || t==TOK_DIVASSIGN || t==TOK_MODASSIGN ||
4824 t==TOK_PLUSASSIGN || t==TOK_MINUSASSIGN || t==TOK_SHLASSIGN ||
4825 t==TOK_SHRASSIGN || t==TOK_ANDASSIGN ||
4826 t==TOK_XORASSIGN || t==TOK_ORASSIGN)
4831 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 2\n";
4839 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 3\n";
4845 exp=
exprt(ID_side_effect);
4848 exp.
set(ID_statement, ID_assign);
4849 else if(t==TOK_PLUSASSIGN)
4850 exp.
set(ID_statement, ID_assign_plus);
4851 else if(t==TOK_MINUSASSIGN)
4852 exp.
set(ID_statement, ID_assign_minus);
4853 else if(t==TOK_MULTASSIGN)
4854 exp.
set(ID_statement, ID_assign_mult);
4855 else if(t==TOK_DIVASSIGN)
4856 exp.
set(ID_statement, ID_assign_div);
4857 else if(t==TOK_MODASSIGN)
4858 exp.
set(ID_statement, ID_assign_mod);
4859 else if(t==TOK_SHLASSIGN)
4860 exp.
set(ID_statement, ID_assign_shl);
4861 else if(t==TOK_SHRASSIGN)
4862 exp.
set(ID_statement, ID_assign_shr);
4863 else if(t==TOK_ANDASSIGN)
4864 exp.
set(ID_statement, ID_assign_bitand);
4865 else if(t==TOK_XORASSIGN)
4866 exp.
set(ID_statement, ID_assign_bitxor);
4867 else if(t==TOK_ORASSIGN)
4868 exp.
set(ID_statement, ID_assign_bitor);
4875 std::cout << std::string(__indent,
' ') <<
"Parser::rExpression 4\n";
4889 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 0\n";
4896 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 1\n";
4902 exprt then, otherwise;
4909 std::cout << std::string(__indent,
' ') <<
"Parser::rConditionalExpr 2\n";
4922 if_exprt(std::move(cond), std::move(then), std::move(otherwise),
typet());
4938 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalOrExpr 0\n";
4945 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalOrExpr 1\n";
4977 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalAndExpr 1\n";
4984 std::cout << std::string(__indent,
' ') <<
"Parser::rLogicalAndExpr 1\n";
5016 std::cout << std::string(__indent,
' ') <<
"Parser::rInclusiveOrExpr 0\n";
5023 std::cout << std::string(__indent,
' ') <<
"Parser::rInclusiveOrExpr 1\n";
5038 exp=
exprt(ID_bitor);
5055 std::cout << std::string(__indent,
' ') <<
"Parser::rExclusiveOrExpr 0\n";
5062 std::cout << std::string(__indent,
' ') <<
"Parser::rExclusiveOrExpr 1\n";
5071 if(!
rAndExpr(right, template_args))
5077 exp=
exprt(ID_bitxor);
5094 std::cout << std::string(__indent,
' ') <<
"Parser::rAndExpr 0\n";
5101 std::cout << std::string(__indent,
' ') <<
"Parser::rAndExpr 1\n";
5116 exp=
exprt(ID_bitand);
5133 std::cout << std::string(__indent,
' ') <<
"Parser::rEqualityExpr 0\n";
5140 std::cout << std::string(__indent,
' ') <<
"Parser::rEqualityExpr 1\n";
5156 exp=
exprt(tk.
kind==TOK_EQ?ID_equal:ID_notequal);
5173 std::cout << std::string(__indent,
' ') <<
"Parser::rRelationalExpr 0\n";
5180 std::cout << std::string(__indent,
' ') <<
"Parser::rRelationalExpr 1\n";
5186 (t==TOK_LE || t==TOK_GE || t==
'<' || (t==
'>' && !template_args)))
5202 case TOK_LE:
id=ID_le;
break;
5203 case TOK_GE:
id=ID_ge;
break;
5204 case '<':
id=ID_lt;
break;
5205 case '>':
id=ID_gt;
break;
5225 std::cout << std::string(__indent,
' ') <<
"Parser::rShiftExpr 0\n";
5232 std::cout << std::string(__indent,
' ') <<
"Parser::rShiftExpr 1\n";
5248 exp=
exprt((tk.
kind==TOK_SHIFTRIGHT)?ID_shr:ID_shl);
5265 std::cout << std::string(__indent,
' ') <<
"Parser::rAdditiveExpr 0\n";
5272 std::cout << std::string(__indent,
' ') <<
"Parser::rAdditiveExpr 1\n";
5291 case '+':
id=ID_plus;
break;
5292 case '-':
id=ID_minus;
break;
5312 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 0\n";
5319 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 1\n";
5323 while(t=
lex.
LookAhead(0), (t==
'*' || t==
'/' || t==
'%'))
5338 case '*':
id=ID_mult;
break;
5339 case '/':
id=ID_div;
break;
5340 case '%':
id=ID_mod;
break;
5349 std::cout << std::string(__indent,
' ') <<
"Parser::rMultiplyExpr 2\n";
5365 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 0\n";
5372 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 1\n";
5388 exp =
exprt(ID_pointer_to_member);
5394 std::cout << std::string(__indent,
' ') <<
"Parser::rPmExpr 2\n";
5409 std::cout << std::string(__indent,
' ') <<
"Parser::rCastExpr 0\n";
5425 std::cout << std::string(__indent,
' ') <<
"Parser::rCastExpr 1\n";
5446 exp=
exprt(
"explicit-typecast");
5469 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 0\n";
5478 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 1\n";
5498 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeName 2\n";
5513 std::cout << std::string(__indent,
' ')
5514 <<
"Parser::rTypeNameOrFunctionType 0\n";
5522 std::cout << std::string(__indent,
' ')
5523 <<
"Parser::rTypeNameOrFunctionType 1\n";
5535 std::cout << std::string(__indent,
' ')
5536 <<
"Parser::rTypeNameOrFunctionType 2\n";
5544 std::cout << std::string(__indent,
' ')
5545 <<
"Parser::rTypeNameOrFunctionType 3\n";
5550 tname.
swap(return_type);
5559 std::cout << std::string(__indent,
' ')
5560 <<
"Parser::rTypeNameOrFunctionType 4\n";
5587 type.set(ID_identifier, op.data.get(ID_C_base_name));
5598 type.set(ID_identifier, op.data.get(ID_C_base_name));
5608 std::cout << std::string(__indent,
' ')
5609 <<
"Parser::rTypeNameOrFunctionType 5\n";
5615 else if(t==TOK_ELLIPSIS)
5619 type.make_ellipsis();
5628 parameter.
swap(parameter_declaration);
5629 type.parameters().push_back(parameter);
5637 else if(t==TOK_ELLIPSIS)
5643 type.make_ellipsis();
5651 std::cout << std::string(__indent,
' ')
5652 <<
"Parser::rTypeNameOrFunctionType 6\n";
5663 std::cout << std::string(__indent,
' ')
5664 <<
"Parser::rTypeNameOrFunctionType 7\n";
5674 std::cout << std::string(__indent,
' ')
5675 <<
"Parser::rTypeNameOrFunctionType 8\n";
5697 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 0\n";
5700 if(t==
'*' || t==
'&' || t==
'+' ||
5701 t==
'-' || t==
'!' || t==
'~' ||
5702 t==TOK_INCR || t==TOK_DECR)
5708 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 1\n";
5716 std::cout << std::string(__indent,
' ') <<
"Parser::rUnaryExpr 2\n";
5722 exp=
exprt(ID_dereference);
5726 exp=
exprt(ID_address_of);
5730 exp=
exprt(ID_unary_plus);
5734 exp=
exprt(ID_unary_minus);
5742 exp=
exprt(ID_bitnot);
5746 exp=
exprt(ID_side_effect);
5747 exp.
set(ID_statement, ID_preincrement);
5751 exp=
exprt(ID_side_effect);
5752 exp.
set(ID_statement, ID_predecrement);
5764 else if(t==TOK_SIZEOF)
5766 else if(t==TOK_ALIGNOF)
5768 else if(t==TOK_THROW)
5770 else if(t==TOK_NOEXCEPT)
5772 else if(t==TOK_REAL || t==TOK_IMAG)
5783 exp=
exprt(t==TOK_REAL?ID_complex_real:ID_complex_imag);
5804 std::cout << std::string(__indent,
' ') <<
"Parser::rThrowExpr 0\n";
5815 if(t==
':' || t==
';')
5843 std::cout << std::string(__indent,
' ') <<
"Parser::rTypeidExpr 0\n";
5865 exp =
exprt(ID_typeid);
5884 exp =
exprt(ID_typeid);
5909 std::cout << std::string(__indent,
' ') <<
"Parser::rSizeofExpr 0\n";
5927 exp=
exprt(ID_sizeof);
5928 exp.
add(ID_type_arg).
swap(tname);
5949 exp=
exprt(ID_sizeof);
5950 exp.
add(ID_type_arg).
swap(tname);
5964 exp=
exprt(ID_sizeof);
5993 exp=
exprt(ID_alignof);
5994 exp.
add(ID_type_arg).
swap(tname);
6009 std::cout << std::string(__indent,
' ') <<
"Parser::rNoexceptExpr 0\n";
6027 exp=
exprt(ID_noexcept);
6045 return t==TOK_NEW || t==TOK_DELETE;
6060 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 0\n";
6071 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 1\n";
6077 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 2\n";
6091 exp=
exprt(ID_side_effect);
6092 exp.
set(ID_statement, ID_cpp_delete_array);
6096 exp=
exprt(ID_side_effect);
6097 exp.
set(ID_statement, ID_cpp_delete);
6112 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 3\n";
6115 exp=
exprt(ID_side_effect);
6116 exp.
set(ID_statement, ID_cpp_new);
6119 exprt arguments, initializer;
6125 std::cout << std::string(__indent,
' ') <<
"Parser::rAllocateExpr 4\n";
6128 exp.
add(ID_initializer).
swap(initializer);
6260 decl.
swap(array_type);
6331 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 0\n";
6338 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 1\n";
6355 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 2\n";
6365 exp=
exprt(ID_index);
6373 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 3\n";
6384 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 4\n";
6394 fc.arguments().push_back(*it);
6427 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 5\n";
6434 std::cout << std::string(__indent,
' ') <<
"Parser::rPostfixExpr 6\n";
6442 exp=
exprt(ID_member);
6444 exp=
exprt(ID_ptrmember);
6450 exp.
add(ID_component_cpp_name).
swap(e);
6486 expr=
exprt(ID_msc_uuidof);
6487 expr.
add(ID_type_arg).
swap(tname);
6504 expr=
exprt(ID_msc_uuidof);
6521 if(tk1.
kind!=TOK_MSC_IF_EXISTS &&
6522 tk1.
kind!=TOK_MSC_IF_NOT_EXISTS)
6550 tk1.
kind==TOK_MSC_IF_EXISTS?ID_msc_if_exists:
6551 ID_msc_if_not_exists);
6566 if(tk1.
kind != TOK_MSC_IF_EXISTS && tk1.
kind != TOK_MSC_IF_NOT_EXISTS)
6590 block.
add(std::move(*statement));
6599 tk1.
kind == TOK_MSC_IF_EXISTS ? ID_msc_if_exists : ID_msc_if_not_exists);
6605 return std::move(code);
6624 typet tname1, tname2;
6628 case TOK_UNARY_TYPE_PREDICATE:
6635 expr.
add(ID_type_arg).
swap(tname1);
6638 case TOK_BINARY_TYPE_PREDICATE:
6649 expr.
add(
"type_arg1").
swap(tname1);
6650 expr.
add(
"type_arg2").
swap(tname2);
6683 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 0 "
6696 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 1\n";
6705 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 2\n";
6711 exp=
exprt(
"cpp-this");
6714 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 3\n";
6723 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 4\n";
6732 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 5\n";
6742 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 6\n";
6748 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 7\n";
6756 exp =
exprt(ID_side_effect);
6757 exp.
set(ID_statement, ID_statement_expression);
6775 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 8\n";
6785 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 9\n";
6791 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 10\n";
6798 case TOK_UNARY_TYPE_PREDICATE:
6799 case TOK_BINARY_TYPE_PREDICATE:
6801 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 11\n";
6805 case TOK_MSC_UUIDOF:
6807 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 12\n";
6813 case TOK_MSC_IF_EXISTS:
6814 case TOK_MSC_IF_NOT_EXISTS:
6816 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 13\n";
6822 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 14\n";
6831 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 15\n";
6844 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 16\n";
6854 exp=
exprt(
"explicit-constructor-call");
6870 exp=
exprt(
"explicit-constructor-call");
6894 std::cout << std::string(__indent,
' ') <<
"Parser::rPrimaryExpr 17\n";
6915 std::cout << std::string(__indent,
' ') <<
"Parser::rVarName 0\n";
6928 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 0\n";
6938 name.
set(ID_typename,
true);
6948 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 1\n";
6956 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 1.1 "
6966 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 2\n";
6974 case TOK_IDENTIFIER:
6976 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 3\n";
6989 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 4\n";
6999 components.push_back(
irept(ID_template_args));
7000 components.back().add(ID_arguments).swap(args);
7009 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 5\n";
7013 components.push_back(
irept(
"::"));
7019 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 6\n";
7027 components.push_back(
irept(
"~"));
7033 std::cout << std::string(__indent,
' ') <<
"Parser::rVarNameCore 7\n";
7038 components.push_back(
irept(ID_operator));
7046 components.push_back(op);
7061 if(t==TOK_IDENTIFIER || t==
'~' || t==TOK_OPERATOR || t==TOK_TEMPLATE)
7080 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 0\n";
7089 if(u==
'\0' || u==
';' || u==
'}')
7091 else if((u==
'>' || u==TOK_SHIFTRIGHT) &&
7102 std::cout << std::string(__indent,
' ')
7103 <<
"Parser::maybeTemplateArgs 1\n";
7109 std::cout << std::string(__indent,
' ')
7110 <<
"Parser::maybeTemplateArgs 2\n";
7125 std::cout << std::string(__indent,
' ')
7126 <<
"Parser::maybeTemplateArgs 3\n";
7133 else if(v==
'\0' || v==
';' || v==
'}')
7137 else if(u==
'\0' || u==
';' || u==
'}')
7139 else if(u==TOK_SHIFTRIGHT && n>=2)
7143 std::cout << std::string(__indent,
' ')
7144 <<
"Parser::maybeTemplateArgs 4\n";
7149 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 5\n";
7155 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 6\n";
7158 return t==TOK_SCOPE || t==
'(';
7163 std::cout << std::string(__indent,
' ') <<
"Parser::maybeTemplateArgs 7\n";
7194 declarator.
value()=body;
7204 declarator.
value() = std::move(*body);
7227 std::cout << std::string(__indent,
' ') <<
"Parser::rCompoundStatement 1\n";
7234 std::cout << std::string(__indent,
' ') <<
"Parser::rCompoundStatement 2\n";
7243 statement.
add(std::move(*statement2));
7251 return std::move(statement);
7258 return std::move(statement);
7289 std::cout << std::string(__indent,
' ') <<
"Parser::rStatement 0 "
7330 codet statement(k == TOK_BREAK ? ID_break : ID_continue);
7336 return std::move(statement);
7341 std::cout << std::string(__indent,
' ') <<
"Parser::rStatement RETURN 0\n";
7352 std::cout << std::string(__indent,
' ')
7353 <<
"Parser::rStatement RETURN 1\n";
7360 std::cout << std::string(__indent,
' ')
7361 <<
"Parser::rStatement RETURN 2\n";
7368 std::cout << std::string(__indent,
' ')
7369 <<
"Parser::rStatement RETURN 3\n";
7376 return std::move(statement);
7391 return std::move(statement);
7417 std::move(case_expr), std::move(range_end), std::move(*statement2));
7419 return std::move(code);
7432 std::move(case_expr), std::move(*statement2));
7434 return std::move(statement);
7453 return std::move(statement);
7465 case TOK_MSC_IF_EXISTS:
7466 case TOK_MSC_IF_NOT_EXISTS:
7469 case TOK_IDENTIFIER:
7481 return std::move(label);
7500 return std::move(statement);
7511 case TOK_STATIC_ASSERT:
7518 codet statement(ID_static_assert);
7520 statement.
operands().swap(cpp_static_assert.operands());
7522 return std::move(statement);
7552 if(!then.has_value())
7562 std::move(exp), std::move(*then), std::move(*otherwise));
7564 return std::move(statement);
7573 return std::move(statement);
7600 code_switcht statement(std::move(exp), std::move(*body));
7602 return std::move(statement);
7631 code_whilet statement(std::move(exp), std::move(*body));
7633 return std::move(statement);
7651 if(!body.has_value())
7672 return std::move(statement);
7692 if(!exp1.has_value())
7722 std::move(*exp1), std::move(exp2), std::move(exp3), std::move(*body));
7724 return std::move(statement);
7746 if(!try_body.has_value())
7769 codet ellipsis(ID_ellipsis);
7771 catch_op = std::move(ellipsis);
7783 if(declaration.
declarators().front().name().is_nil())
7790 catch_op = std::move(code_decl);
7809 return std::move(statement);
7824 if(!body1.has_value())
7829 codet statement(ID_msc_try_except);
7849 std::move(*body1), std::move(exp), std::move(*body2));
7850 return std::move(statement);
7857 codet statement(ID_msc_try_finally);
7865 return std::move(statement);
7884 codet statement(ID_msc_leave);
7887 return std::move(statement);
7896 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 1\n";
7911 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 3\n";
7922 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 3\n";
7928 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 4\n";
7949 std::cout << std::string(__indent,
' ')
7950 <<
"Parser::rGCCAsmStatement 5\n";
7958 std::cout << std::string(__indent,
' ')
7959 <<
"Parser::rGCCAsmStatement 6\n";
7974 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 7\n";
7983 std::cout << std::string(__indent,
' ') <<
"Parser::rGCCAsmStatement 8\n";
7986 return std::move(statement);
7995 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 1\n";
8009 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 2\n";
8017 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 3\n";
8030 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 4\n";
8036 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 5\n";
8040 return std::move(statement);
8046 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 6\n";
8051 std::cout << std::string(__indent,
' ') <<
"Parser::rMSCAsmStatement 7\n";
8054 return std::move(statement);
8071 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 0\n";
8077 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 1\n";
8083 return std::move(statement);
8088 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 2\n";
8096 std::cout << std::string(__indent,
' ') <<
"rDe " << statement->pretty()
8108 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 3\n";
8115 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 4\n";
8119 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 5 "
8127 std::cout << std::string(__indent,
' ') <<
"Parser::rExprStatement 6\n";
8132 return std::move(expr_statement);
8147 statement=
codet(ID_decl);
8179 typet cv_q, integral;
8184 std::cout << std::string(__indent,
' ')
8185 <<
"Parser::rDeclarationStatement 1\n";
8207 std::cout << std::string(__indent,
' ')
8208 <<
"Parser::rDeclarationStatement 2\n";
8218 std::cout << std::string(__indent,
' ')
8219 <<
"Parser::rDeclarationStatement 3 " << t <<
'\n';
8223 ((t==TOK_IDENTIFIER &&
lex.
LookAhead(1)==
'=') || t==
'*'))
8226 std::cout << std::string(__indent,
' ')
8227 <<
"Parser::rDeclarationStatement 4\n";
8267 return std::move(statement);
8280 return std::move(statement);
8296 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 1\n";
8299 if(!
rName(type_name))
8303 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 2\n";
8310 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 3\n";
8316 declaration.
type().
swap(type_name);
8323 std::cout << std::string(__indent,
' ') <<
"Parser::rOtherDeclStatement 4\n";
8332 return std::move(statement);
8347 if(t==token || t==
'\0')