Home | History | Annotate | Download | only in libiberty

Lines Matching refs:di

954 d_make_empty (struct d_info *di)
958 if (di->next_comp >= di->num_comps)
960 p = &di->comps[di->next_comp];
963 ++di->next_comp;
970 d_make_comp (struct d_info *di, enum demangle_component_type type,
1078 p = d_make_empty (di);
1091 d_make_demangle_mangled_name (struct d_info *di, const char *s)
1093 if (d_peek_char (di) != '_' || d_peek_next_char (di) != 'Z')
1094 return d_make_name (di, s, strlen (s));
1095 d_advance (di, 2);
1096 return d_encoding (di, 0);
1102 d_make_name (struct d_info *di, const char *s, int len)
1106 p = d_make_empty (di);
1115 d_make_builtin_type (struct d_info *di,
1122 p = d_make_empty (di);
1134 d_make_extended_builtin_type (struct d_info *di,
1142 p = d_make_empty (di);
1156 d_make_operator (struct d_info *di, const struct demangle_operator_info *op)
1160 p = d_make_empty (di);
1172 d_make_extended_operator (struct d_info *di, int args,
1177 p = d_make_empty (di);
1184 d_make_default_arg (struct d_info *di, int num,
1187 struct demangle_component *p = d_make_empty (di);
1200 d_make_ctor (struct d_info *di, enum gnu_v3_ctor_kinds kind,
1205 p = d_make_empty (di);
1214 d_make_dtor (struct d_info *di, enum gnu_v3_dtor_kinds kind,
1219 p = d_make_empty (di);
1228 d_make_template_param (struct d_info *di, int i)
1232 p = d_make_empty (di);
1244 d_make_function_param (struct d_info *di, int i)
1248 p = d_make_empty (di);
1260 d_make_sub (struct d_info *di, const char *name, int len)
1264 p = d_make_empty (di);
1280 cplus_demangle_mangled_name (struct d_info *di, int top_level)
1284 if (! d_check_char (di, '_')
1290 if (! d_check_char (di, 'Z'))
1292 p = d_encoding (di, top_level);
1296 if (top_level && (di->options & DMGL_PARAMS) != 0)
1297 while (d_peek_char (di) == '.'
1298 && (IS_LOWER (d_peek_next_char (di))
1299 || d_peek_next_char (di) == '_'
1300 || IS_DIGIT (d_peek_next_char (di))))
1301 p = d_clone_suffix (di, p);
1358 d_maybe_constraints (struct d_info *di, struct demangle_component *dc)
1360 if (d_peek_char (di) == 'Q')
1362 d_advance (di, 1);
1363 struct demangle_component *expr = d_expression (di);
1366 dc = d_make_comp (di, DEMANGLE_COMPONENT_CONSTRAINTS, dc, expr);
1381 d_encoding (struct d_info *di, int top_level)
1383 char peek = d_peek_char (di);
1387 dc = d_special_name (di);
1390 dc = d_name (di, 0);
1394 else if (top_level && (di->options & DMGL_PARAMS) == 0)
1418 peek = d_peek_char (di);
1423 ftype = d_bare_function_type (di, has_return_type (dc));
1435 ftype = d_maybe_constraints (di, ftype);
1437 dc = d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME,
1449 d_abi_tags (struct d_info *di, struct demangle_component *dc)
1455 hold_last_name = di->last_name;
1457 while (peek = d_peek_char (di),
1461 d_advance (di, 1);
1462 tag = d_source_name (di);
1463 dc = d_make_comp (di, DEMANGLE_COMPONENT_TAGGED_NAME, dc, tag);
1466 di->last_name = hold_last_name;
1484 d_name (struct d_info *di, int substable)
1486 char peek = d_peek_char (di);
1494 dc = d_nested_name (di);
1498 dc = d_local_name (di);
1502 dc = d_unqualified_name (di, NULL, NULL);
1507 if (d_peek_next_char (di) == 't')
1509 d_advance (di, 2);
1510 dc = d_make_name (di, "std", 3);
1511 di->expansion += 3;
1514 if (d_peek_char (di) == 'S')
1516 module = d_substitution (di, 0);
1535 dc = d_unqualified_name (di, dc, module);
1536 if (d_peek_char (di) == 'I')
1541 if (!subst && !d_add_substitution (di, dc))
1543 dc = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, dc,
1544 d_template_args (di));
1549 if (substable && !subst && !d_add_substitution (di, dc))
1561 d_nested_name (struct d_info *di)
1567 if (! d_check_char (di, 'N'))
1570 if (d_peek_char (di) == 'H')
1572 d_advance (di, 1);
1573 di->expansion += sizeof "this";
1575 rqual = d_make_comp (di, DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION,
1580 pret = d_cv_qualifiers (di, &ret, 1);
1586 rqual = d_ref_qualifier (di, NULL);
1589 *pret = d_prefix (di, 1);
1599 if (! d_check_char (di, 'E'))
1620 d_prefix (struct d_info *di, int substable)
1626 char peek = d_peek_char (di);
1633 && (d_peek_next_char (di) == 'T'
1634 || d_peek_next_char (di) == 't'))
1639 ret = cplus_demangle_type (di);
1645 struct demangle_component *dc = d_template_args (di);
1648 ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret, dc);
1654 ret = d_template_param (di);
1660 d_advance (di, 1);
1668 module = d_substitution (di, 1);
1680 ret = d_unqualified_name (di, ret, module);
1686 di) == 'E')
1689 if (substable && !d_add_substitution (di, ret))
1697 d_maybe_module_name (struct d_info *di, struct demangle_component **name)
1699 while (d_peek_char (di) == 'W')
1701 d_advance (di, 1);
1703 if (d_peek_char (di) == 'P')
1706 d_advance (di, 1);
1709 *name = d_make_comp (di, code, *name, d_source_name (di));
1712 if (!d_add_substitution (di, *name))
1728 d_unqualified_name (struct d_info *di, struct demangle_component *scope,
1735 if (!d_maybe_module_name (di, &module))
1738 peek = d_peek_char (di);
1742 d_advance (di, 1);
1743 peek = d_peek_char (di);
1746 ret = d_source_name (di);
1749 int was_expr = di->is_expression;
1750 if (peek == 'o' && d_peek_next_char (di) == 'n')
1752 d_advance (di, 2);
1754 di->is_expression = 0;
1756 ret = d_operator_name (di);
1757 di->is_expression = was_expr;
1760 di->expansion += sizeof "operator" + ret->u.s_operator.op->len - 2;
1762 ret = d_make_comp (di, DEMANGLE_COMPONENT_UNARY, ret,
1763 d_source_name (di));
1766 else if (peek == 'D' && d_peek_next_char (di) == 'C')
1769 d_advance (di, 2);
1774 d_make_comp (di, DEMANGLE_COMPONENT_STRUCTURED_BINDING,
1775 d_source_name (di), NULL);
1782 while (prev && d_peek_char (di) != 'E');
1784 d_advance (di, 1);
1789 ret = d_ctor_dtor_name (di);
1792 d_advance (di, 1);
1794 ret = d_source_name (di);
1797 if (! d_discriminator (di))
1802 switch (d_peek_next_char (di))
1805 ret = d_unnamed_enum (di);
1808 ret = d_lambda (di);
1811 ret = d_unnamed_type (di);
1821 ret = d_make_comp (di, DEMANGLE_COMPONENT_MODULE_ENTITY, ret, module);
1822 if (d_peek_char (di) == 'B')
1823 ret = d_abi_tags (di, ret);
1825 ret = d_make_comp (di, DEMANGLE_COMPONENT_FRIEND, ret, NULL);
1827 ret = d_make_comp (di, DEMANGLE_COMPONENT_QUAL_NAME, scope, ret);
1835 d_source_name (struct d_info *di)
1840 len = d_number (di);
1843 ret = d_identifier (di, len);
1844 di->last_name = ret;
1851 d_number (struct d_info *di)
1858 peek = d_peek_char (di);
1862 d_advance (di, 1);
1863 peek = d_peek_char (di);
1878 d_advance (di, 1);
1879 peek = d_peek_char (di);
1886 d_number_component (struct d_info *di)
1888 struct demangle_component *ret = d_make_empty (di);
1892 ret->u.s_number.number = d_number (di);
1900 d_identifier (struct d_info *di, int len)
1904 name = d_str (di);
1906 if (di->send - name < len)
1909 d_advance (di, len);
1914 if ((di->options & DMGL_JAVA) != 0
1915 && d_peek_char (di) == '$')
1916 d_advance (di, 1);
1931 di->expansion -= len - sizeof "(anonymous namespace)";
1932 return d_make_name (di, "(anonymous namespace)",
1937 return d_make_name (di, name, len);
1968 { "di", NL ("="), 2 }, /* .name = expr */
2028 d_operator_name (struct d_info *di)
2033 c1 = d_next_char (di);
2034 c2 = d_next_char (di);
2036 return d_make_extended_operator (di, c2 - '0', d_source_name (di));
2040 int was_conversion = di->is_conversion;
2043 di->is_conversion = ! di->is_expression;
2044 type = cplus_demangle_type (di);
2045 if (di->is_conversion)
2046 res = d_make_comp (di, DEMANGLE_COMPONENT_CONVERSION, type, NULL);
2048 res = d_make_comp (di, DEMANGLE_COMPONENT_CAST, type, NULL);
2049 di->is_conversion = was_conversion;
2071 return d_make_operator (di, p);
2084 d_make_character (struct d_info *di, int c)
2087 p = d_make_empty (di);
2097 d_java_resource (struct d_info *di)
2105 len = d_number (di);
2110 if (d_next_char (di) != '_')
2114 str = d_str (di);
2141 next = d_make_character (di, c);
2142 d_advance (di, i);
2143 str = d_str (di);
2155 next = d_make_name (di, str, i);
2156 d_advance (di, i);
2157 str = d_str (di);
2168 p = d_make_comp (di, DEMANGLE_COMPONENT_COMPOUND_NAME, p, next);
2174 p = d_make_comp (di, DEMANGLE_COMPONENT_JAVA_RESOURCE, p, NULL);
2199 d_special_name (struct d_info *di)
2201 di->expansion += 20;
2202 if (d_check_char (di, 'T'))
2204 switch (d_next_char (di))
2207 di->expansion -= 5;
2208 return d_make_comp (di, DEMANGLE_COMPONENT_VTABLE,
2209 cplus_demangle_type (di), NULL);
2211 di->expansion -= 10;
2212 return d_make_comp (di, DEMANGLE_COMPONENT_VTT,
2213 cplus_demangle_type (di), NULL);
2215 return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO,
2216 cplus_demangle_type (di), NULL);
2218 return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO_NAME,
2219 cplus_demangle_type (di), NULL);
2222 if (! d_call_offset (di, 'h'))
2224 return d_make_comp (di, DEMANGLE_COMPONENT_THUNK,
2225 d_encoding (di, 0), NULL);
2228 if (! d_call_offset (di, 'v'))
2230 return d_make_comp (di, DEMANGLE_COMPONENT_VIRTUAL_THUNK,
2231 d_encoding (di, 0), NULL);
2234 if (! d_call_offset (di, '\0'))
2236 if (! d_call_offset (di, '\0'))
2238 return d_make_comp (di, DEMANGLE_COMPONENT_COVARIANT_THUNK,
2239 d_encoding (di, 0), NULL);
2247 derived_type = cplus_demangle_type (di);
2248 offset = d_number (di);
2251 if (! d_check_char (di, '_'))
2253 base_type = cplus_demangle_type (di);
2256 di->expansion += 5;
2257 return d_make_comp (di, DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE,
2262 return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO_FN,
2263 cplus_demangle_type (di), NULL);
2265 return d_make_comp (di, DEMANGLE_COMPONENT_JAVA_CLASS,
2266 cplus_demangle_type (di), NULL);
2269 return d_make_comp (di, DEMANGLE_COMPONENT_TLS_INIT,
2270 d_name (di, 0), NULL);
2273 return d_make_comp (di, DEMANGLE_COMPONENT_TLS_WRAPPER,
2274 d_name (di, 0), NULL);
2277 return d_make_comp (di, DEMANGLE_COMPONENT_TPARM_OBJ,
2278 d_template_arg (di), NULL);
2284 else if (d_check_char (di, 'G'))
2286 switch (d_next_char (di))
2289 return d_make_comp (di, DEMANGLE_COMPONENT_GUARD,
2290 d_name (di, 0), NULL);
2294 struct demangle_component *name = d_name (di, 0);
2295 return d_make_comp (di, DEMANGLE_COMPONENT_REFTEMP, name,
2296 d_number_component (di));
2300 return d_make_comp (di, DEMANGLE_COMPONENT_HIDDEN_ALIAS,
2301 d_encoding (di, 0), NULL);
2306 if (!d_maybe_module_name (di, &module) || !module)
2308 return d_make_comp (di, DEMANGLE_COMPONENT_MODULE_INIT,
2312 switch (d_next_char (di))
2315 return d_make_comp (di, DEMANGLE_COMPONENT_NONTRANSACTION_CLONE,
2316 d_encoding (di, 0), NULL);
2324 return d_make_comp (di, DEMANGLE_COMPONENT_TRANSACTION_CLONE,
2325 d_encoding (di, 0), NULL);
2329 return d_java_resource (di);
2353 d_call_offset (struct d_info *di, int c)
2356 c = d_next_char (di);
2359 d_number (di);
2362 d_number (di);
2363 if (! d_check_char (di, '_'))
2365 d_number (di);
2370 if (! d_check_char (di, '_'))
2385 d_ctor_dtor_name (struct d_info *di)
2387 if (di->last_name != NULL)
2389 if (di->last_name->type == DEMANGLE_COMPONENT_NAME)
2390 di->expansion += di->last_name->u.s_name.len;
2391 else if (di->last_name->type == DEMANGLE_COMPONENT_SUB_STD)
2392 di->expansion += di->last_name->u.s_string.len;
2394 switch (d_peek_char (di))
2401 if (d_peek_next_char (di) == 'I')
2404 d_advance (di, 1);
2407 switch (d_peek_next_char (di))
2428 d_advance (di, 2);
2431 cplus_demangle_type (di);
2433 return d_make_ctor (di, kind, di->last_name);
2440 switch (d_peek_next_char (di))
2461 d_advance (di, 2);
2462 return d_make_dtor (di, kind, di->last_name);
2474 next_is_type_qual (struct d_info *di)
2476 char peek = d_peek_char (di);
2481 peek = d_peek_next_char (di);
2555 cplus_demangle_type (struct d_info *di)
2576 if (next_is_type_qual (di))
2580 pret = d_cv_qualifiers (di, &ret, 0);
2583 if (d_peek_char (di) == 'F')
2588 *pret = d_function_type (di);
2591 *pret = cplus_demangle_type (di);
2604 if (! d_add_substitution (di, ret))
2611 peek = d_peek_char (di);
2618 ret = d_make_builtin_type (di,
2620 di->expansion += ret->u.s_builtin.type->len;
2622 d_advance (di, 1);
2626 d_advance (di, 1);
2627 ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE,
2628 d_source_name (di), NULL);
2632 ret = d_function_type (di);
2636 ret = d_array_type (di);
2640 ret = d_pointer_to_member_type (di);
2644 ret = d_template_param (di);
2645 if (d_peek_char (di) == 'I')
2678 if (! di->is_conversion)
2680 if (! d_add_substitution (di, ret))
2682 ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
2683 d_template_args (di));
2690 d_checkpoint (di, &checkpoint);
2691 args = d_template_args (di);
2692 if (d_peek_char (di) == 'I')
2694 if (! d_add_substitution (di, ret))
2696 ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
2700 d_backtrack (di, &checkpoint);
2706 d_advance (di, 1);
2707 ret = d_make_comp (di, DEMANGLE_COMPONENT_RVALUE_REFERENCE,
2708 cplus_demangle_type (di), NULL);
2712 d_advance (di, 1);
2713 ret = d_make_comp (di, DEMANGLE_COMPONENT_POINTER,
2714 cplus_demangle_type (di), NULL);
2718 d_advance (di, 1);
2719 ret = d_make_comp (di, DEMANGLE_COMPONENT_REFERENCE,
2720 cplus_demangle_type (di), NULL);
2724 d_advance (di, 1);
2725 ret = d_make_comp (di, DEMANGLE_COMPONENT_COMPLEX,
2726 cplus_demangle_type (di), NULL);
2730 d_advance (di, 1);
2731 ret = d_make_comp (di, DEMANGLE_COMPONENT_IMAGINARY,
2732 cplus_demangle_type (di), NULL);
2736 peek = d_peek_next_char (di);
2739 d_advance (di, 1);
2740 ret = d_source_name (di);
2741 if (d_peek_char (di) == 'I')
2742 ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
2743 d_template_args (di));
2744 ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,
2745 cplus_demangle_type (di), ret);
2749 ret = d_unqualified_name (di, NULL, NULL);
2754 d_advance (di, 1);
2755 peek = d_next_char (di);
2761 ret = d_make_comp (di, DEMANGLE_COMPONENT_DECLTYPE,
2762 d_expression (di), NULL);
2763 if (ret && d_next_char (di) != 'E')
2770 ret = d_make_comp (di, DEMANGLE_COMPONENT_PACK_EXPANSION,
2771 cplus_demangle_type (di), NULL);
2777 ret = d_make_name (di, "auto", 4);
2781 ret = d_make_name (di, "decltype(auto)", 14);
2786 ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[26]);
2787 di->expansion += ret->u.s_builtin.type->len;
2791 ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[27]);
2792 di->expansion += ret->u.s_builtin.type->len;
2796 ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[28]);
2797 di->expansion += ret->u.s_builtin.type->len;
2801 ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[29]);
2802 di->expansion += ret->u.s_builtin.type->len;
2806 ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[30]);
2807 di->expansion += ret->u.s_builtin.type->len;
2811 ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[31]);
2812 di->expansion += ret->u.s_builtin.type->len;
2816 ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[32]);
2817 di->expansion += ret->u.s_builtin.type->len;
2825 int arg = d_number (di);
2828 if (d_peek_char (di) == 'b')
2832 d_advance (di, 1);
2833 ret = d_make_builtin_type (di,
2835 di->expansion += ret->u.s_builtin.type->len;
2838 if (d_peek_char (di) == 'x')
2840 if (!suffix && d_peek_char (di) != '_')
2843 = d_make_extended_builtin_type (di,
2846 d_advance (di, 1);
2848 di->expansion += ret->u.s_extended_builtin.type->len
2854 ret = d_vector_type (di);
2860 ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[33]);
2861 di->expansion += ret->u.s_builtin.type->len;
2870 return d_class_enum_type (di, 1);
2875 if (! d_add_substitution (di, ret))
2885 d_cv_qualifiers (struct d_info *di,
2892 peek = d_peek_char (di);
2893 while (next_is_type_qual (di))
2898 d_advance (di, 1);
2904 di->expansion += sizeof "restrict";
2911 di->expansion += sizeof "volatile";
2918 di->expansion += sizeof "const";
2922 peek = d_next_char (di);
2926 di->expansion += sizeof "transaction_safe";
2932 di->expansion += sizeof "noexcept";
2935 right = d_expression (di);
2938 if (! d_check_char (di, 'E'))
2945 di->expansion += sizeof "throw";
2946 right = d_parmlist (di);
2949 if (! d_check_char (di, 'E'))
2956 *pret = d_make_comp (di, t, NULL, right);
2961 peek = d_peek_char (di);
2993 d_ref_qualifier (struct d_info *di, struct demangle_component *sub)
2998 peek = d_peek_char (di);
3005 di->expansion += sizeof "&";
3010 di->expansion += sizeof "&&";
3012 d_advance (di, 1);
3014 ret = d_make_comp (di, t, ret, NULL);
3023 d_function_type (struct d_info *di)
3027 if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0)
3029 if (di->recursion_level > DEMANGLE_RECURSION_LIMIT)
3034 di->recursion_level ++;
3037 if (d_check_char (di, 'F'))
3039 if (d_peek_char (di) == 'Y')
3043 d_advance (di, 1);
3045 ret = d_bare_function_type (di, 1);
3046 ret = d_ref_qualifier (di, ret);
3048 if (! d_check_char (di, 'E'))
3052 if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0)
3053 di->recursion_level --;
3060 d_parmlist (struct d_info *di)
3071 char peek = d_peek_char (di);
3075 && d_peek_next_char (di) == 'E')
3078 type = cplus_demangle_type (di);
3081 *ptl = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, type, NULL);
3098 di->expansion -= d_left (tl)->u.s_builtin.type->len;
3108 d_bare_function_type (struct d_info *di, int has_return_type)
3116 peek = d_peek_char (di);
3119 d_advance (di, 1);
3125 return_type = cplus_demangle_type (di);
3132 tl = d_parmlist (di);
3136 return d_make_comp (di, DEMANGLE_COMPONENT_FUNCTION_TYPE,
3143 d_class_enum_type (struct d_info *di, int substable)
3145 return d_name (di, substable);
3153 d_array_type (struct d_info *di)
3158 if (! d_check_char (di, 'A'))
3161 peek = d_peek_char (di);
3168 s = d_str (di);
3171 d_advance (di, 1);
3172 peek = d_peek_char (di);
3175 dim = d_make_name (di, s, d_str (di) - s);
3181 dim = d_expression (di);
3186 if (! d_check_char (di, '_'))
3189 return d_make_comp (di, DEMANGLE_COMPONENT_ARRAY_TYPE, dim,
3190 cplus_demangle_type (di));
3197 d_vector_type (struct d_info *di)
3202 peek = d_peek_char (di);
3205 d_advance (di, 1);
3206 dim = d_expression (di);
3209 dim = d_number_component (di);
3214 if (! d_check_char (di, '_'))
3217 return d_make_comp (di, DEMANGLE_COMPONENT_VECTOR_TYPE, dim,
3218 cplus_demangle_type (di));
3224 d_pointer_to_member_type (struct d_info *di)
3229 if (! d_check_char (di, 'M'))
3232 cl = cplus_demangle_type (di);
3251 mem = cplus_demangle_type (di);
3255 return d_make_comp (di, DEMANGLE_COMPONENT_PTRMEM_TYPE, cl, mem);
3261 d_compact_number (struct d_info *di)
3264 if (d_peek_char (di) == '_')
3266 else if (d_peek_char (di) == 'n')
3269 num = d_number (di) + 1;
3271 if (num < 0 || ! d_check_char (di, '_'))
3281 d_template_param (struct d_info *di)
3285 if (! d_check_char (di, 'T'))
3288 param = d_compact_number (di);
3292 return d_make_template_param (di, param);
3298 d_template_args (struct d_info *di)
3300 if (d_peek_char (di) != 'I'
3301 && d_peek_char (di) != 'J')
3303 d_advance (di, 1);
3305 return d_template_args_1 (di);
3311 d_template_args_1 (struct d_info *di)
3320 hold_last_name = di->last_name;
3322 if (d_peek_char (di) == 'E')
3325 d_advance (di, 1);
3326 return d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, NULL, NULL);
3335 a = d_template_arg (di);
3339 *pal = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, a, NULL);
3344 char peek = d_peek_char (di);
3349 al = d_maybe_constraints (di, al);
3351 if (d_peek_char (di) != 'E')
3353 d_advance (di, 1);
3355 di->last_name = hold_last_name;
3366 d_template_arg (struct d_info *di)
3370 switch (d_peek_char (di))
3373 d_advance (di, 1);
3374 ret = d_expression (di);
3375 if (! d_check_char (di, 'E'))
3380 return d_expr_primary (di);
3385 return d_template_args (di);
3388 return cplus_demangle_type (di);
3396 d_exprlist (struct d_info *di, char terminator)
3401 if (d_peek_char (di) == terminator)
3403 d_advance (di, 1);
3404 return d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, NULL, NULL);
3409 struct demangle_component *arg = d_expression (di);
3413 *p = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, arg, NULL);
3418 if (d_peek_char (di) == terminator)
3420 d_advance (di, 1);
3450 d_unresolved_name (struct d_info *di)
3457 d_advance (di, 2);
3459 peek = d_peek_char (di);
3460 if (di->unresolved_name_state
3471 di->unresolved_name_state = -1;
3472 type = d_prefix (di, 0);
3473 if (d_peek_char (di) == 'E')
3474 d_advance (di, 1);
3477 type = cplus_demangle_type (di);
3478 name = d_unqualified_name (di, type, NULL);
3479 if (d_peek_char (di) == 'I')
3480 name = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name,
3481 d_template_args (di));
3496 ::= di <field source-name> <braced-expression> # .name = expr
3503 d_expression_1 (struct d_info *di)
3507 peek = d_peek_char (di);
3509 return d_expr_primary (di);
3511 return d_template_param (di);
3512 else if (peek == 's' && d_peek_next_char (di) == 'r')
3513 return d_unresolved_name (di);
3514 else if (peek == 's' && d_peek_next_char (di) == 'p')
3516 d_advance (di, 2);
3517 return d_make_comp (di, DEMANGLE_COMPONENT_PACK_EXPANSION,
3518 d_expression_1 (di), NULL);
3520 else if (peek == 'f' && d_peek_next_char (di) == 'p')
3524 d_advance (di, 2);
3525 if (d_peek_char (di) == 'T')
3528 d_advance (di, 1);
3533 index = d_compact_number (di);
3538 return d_make_function_param (di, index);
3541 || (peek == 'o' && d_peek_next_char (di) == 'n'))
3549 d_advance (di, 2);
3551 name = d_unqualified_name (di, NULL, NULL);
3554 if (d_peek_char (di) == 'I')
3555 return d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name,
3556 d_template_args (di));
3561 && d_peek_next_char (di) == 'l')
3565 d_advance (di, 2);
3567 type = cplus_demangle_type (di);
3568 if (!d_peek_char (di) || !d_peek_next_char (di))
3570 return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST,
3571 type, d_exprlist (di, 'E'));
3577 d_advance (di, 1);
3578 name = d_source_name (di);
3579 args = d_template_args_1 (di);
3580 return d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_EXPR, name, args);
3588 op = d_operator_name (di);
3595 di->expansion += op->u.s_operator.op->len - 2;
3597 return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
3598 cplus_demangle_type (di));
3619 return d_make_comp (di, DEMANGLE_COMPONENT_NULLARY, op, NULL);
3629 suffix = !d_check_char (di, '_');
3632 && d_check_char (di, '_'))
3633 operand = d_exprlist (di, 'E');
3635 operand = d_template_args_1 (di);
3637 operand = d_expression_1 (di);
3641 operand = d_make_comp (di, DEMANGLE_COMPONENT_BINARY_ARGS,
3644 return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op, operand);
3654 left = cplus_demangle_type (di);
3657 left = d_operator_name (di);
3658 else if (!strcmp (code, "di"))
3659 left = d_unqualified_name (di, NULL, NULL);
3661 left = d_expression_1 (di);
3663 right = d_exprlist (di, 'E');
3666 peek = d_peek_char (di);
3668 if ((peek == 'g' && d_peek_next_char (di) == 's')
3669 || (peek == 's' && d_peek_next_char (di) == 'r'))
3670 right = d_expression_1 (di);
3677 right = d_unqualified_name (di, NULL, NULL);
3678 if (d_peek_char (di) == 'I')
3679 right = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE,
3680 right, d_template_args (di));
3684 right = d_expression_1 (di);
3686 return d_make_comp (di, DEMANGLE_COMPONENT_BINARY, op,
3687 d_make_comp (di,
3703 first = d_expression_1 (di);
3704 second = d_expression_1 (di);
3705 third = d_expression_1 (di);
3712 first = d_operator_name (di);
3713 second = d_expression_1 (di);
3714 third = d_expression_1 (di);
3723 first = d_exprlist (di, '_');
3724 second = cplus_demangle_type (di);
3725 if (d_peek_char (di) == 'E')
3727 d_advance (di, 1);
3730 else if (d_peek_char (di) == 'p'
3731 && d_peek_next_char (di) == 'i')
3734 d_advance (di, 2);
3735 third = d_exprlist (di, 'E');
3737 else if (d_peek_char (di) == 'i'
3738 && d_peek_next_char (di) == 'l')
3740 third = d_expression_1 (di);
3746 return d_make_comp (di, DEMANGLE_COMPONENT_TRINARY, op,
3747 d_make_comp (di,
3750 d_make_comp (di,
3761 d_expression (struct d_info *di)
3764 int was_expression = di->is_expression;
3766 di->is_expression = 1;
3767 ret = d_expression_1 (di);
3768 di->is_expression = was_expression;
3778 d_expr_primary (struct d_info *di)
3782 if (! d_check_char (di, 'L'))
3784 if (d_peek_char (di) == '_'
3786 || d_peek_char (di) == 'Z')
3787 ret = cplus_demangle_mangled_name (di, 0);
3794 type = cplus_demangle_type (di);
3802 di->expansion -= type->u.s_builtin.type->len;
3808 if (d_peek_char (di) == 'E')
3810 d_advance (di, 1);
3827 if (d_peek_char (di) == 'n')
3830 d_advance (di, 1);
3832 s = d_str (di);
3833 while (d_peek_char (di) != 'E')
3835 if (d_peek_char (di) == '\0')
3837 d_advance (di, 1);
3839 ret = d_make_comp (di, t, type, d_make_name (di, s, d_str (di) - s));
3841 if (! d_check_char (di, 'E'))
3852 d_local_name (struct d_info *di)
3857 if (! d_check_char (di, 'Z'))
3860 function = d_encoding (di, 0);
3864 if (! d_check_char (di, 'E'))
3867 if (d_peek_char (di) == 's')
3869 d_advance (di, 1);
3870 if (! d_discriminator (di))
3872 name = d_make_name (di, "string literal", sizeof "string literal" - 1);
3878 if (d_peek_char (di) == 'd')
3881 d_advance (di, 1);
3882 num = d_compact_number (di);
3887 name = d_name (di, 0);
3896 if (! d_discriminator (di))
3901 name = d_make_default_arg (di, num, name);
3911 return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function, name);
3924 d_discriminator (struct d_info *di)
3928 if (d_peek_char (di) != '_')
3930 d_advance (di, 1);
3931 if (d_peek_char (di) == '_')
3934 d_advance (di, 1);
3937 discrim = d_number (di);
3942 if (d_peek_char (di) == '_')
3943 d_advance (di, 1);
3957 d_template_parm (struct d_info *di, int *bad)
3959 if (d_peek_char (di) != 'T')
3964 switch (d_peek_next_char (di))
3970 d_advance (di, 2);
3971 op = d_template_parm (di, bad);
3981 d_advance (di, 2);
3987 d_advance (di, 2);
3988 op = cplus_demangle_type (di);
3998 d_advance (di, 2);
3999 op = d_template_head (di, bad);
4001 if (!op || !d_check_char (di, 'E'))
4008 return d_make_comp (di, kind, op, NULL);
4014 d_template_head (struct d_info *di, int *bad)
4019 while ((op = d_template_parm (di, bad)))
4028 res = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE_HEAD, res, NULL);
4036 d_lambda (struct d_info *di)
4038 if (! d_check_char (di, 'U'))
4040 if (! d_check_char (di, 'l'))
4044 struct demangle_component *head = d_template_head (di, &bad);
4048 struct demangle_component *tl = d_parmlist (di);
4057 if (! d_check_char (di, 'E'))
4060 int num = d_compact_number (di);
4064 struct demangle_component *ret = d_make_empty (di);
4078 d_unnamed_type (struct d_info *di)
4083 if (! d_check_char (di, 'U'))
4085 if (! d_check_char (di, 't'))
4088 num = d_compact_number (di);
4092 ret = d_make_empty (di);
4099 if (! d_add_substitution (di, ret))
4108 d_unnamed_enum (struct d_info *di)
4110 if (! d_check_char (di, 'U'))
4112 if (! d_check_char (di, 'e'))
4115 struct demangle_component *underlying = cplus_demangle_type (di);
4116 struct demangle_component *name = d_source_name (di);
4118 struct demangle_component *ret = d_make_empty (di);
4126 if (! d_add_substitution (di, ret))
4136 d_clone_suffix (struct d_info *di, struct demangle_component *encoding)
4138 const char *suffix = d_str (di);
4155 d_advance (di, pend - suffix);
4156 n = d_make_name (di, suffix, pend - suffix);
4157 return d_make_comp (di, DEMANGLE_COMPONENT_CLONE, encoding, n);
4163 d_add_substitution (struct d_info *di, struct demangle_component *dc)
4167 if (di->next_sub >= di->num_subs)
4169 di->subs[di->next_sub] = dc;
4170 ++di->next_sub;
4219 d_substitution (struct d_info *di, int prefix)
4223 if (! d_check_char (di, 'S'))
4226 c = d_next_char (di);
4247 c = d_next_char (di);
4254 if (id >= (unsigned int) di->next_sub)
4257 return di->subs[id];
4265 verbose = (di->options & DMGL_VERBOSE) != 0;
4270 peek = d_peek_char (di);
4286 di->last_name = d_make_sub (di, p->set_last_name,
4298 di->expansion += len;
4299 dc = d_make_sub (di, s, len);
4300 if (d_peek_char (di) == 'B')
4304 dc = d_abi_tags (di, dc);
4305 if (! d_add_substitution (di, dc))
4317 d_checkpoint (struct d_info *di, struct d_info_checkpoint *checkpoint)
4319 checkpoint->n = di->n;
4320 checkpoint->next_comp = di->next_comp;
4321 checkpoint->next_sub = di->next_sub;
4322 checkpoint->expansion = di->expansion;
4326 d_backtrack (struct d_info *di, struct d_info_checkpoint *checkpoint)
4328 di->n = checkpoint->n;
4329 di->next_comp = checkpoint->next_comp;
4330 di->next_sub = checkpoint->next_sub;
4331 di->expansion = checkpoint->expansion;
6810 struct d_info *di)
6812 di->s = mangled;
6813 di->send = mangled + len;
6814 di->options = options;
6816 di->n = mangled;
6821 di->num_comps = 2 * len;
6822 di->next_comp = 0;
6826 di->num_subs = len;
6827 di->next_sub = 0;
6829 di->last_name = NULL;
6831 di->expansion = 0;
6832 di->is_expression = 0;
6833 di->is_conversion = 0;
6834 di->recursion_level = 0;
6854 struct d_info di;
6872 di.unresolved_name_state = 1;
6875 cplus_demangle_init_info (mangled, options, strlen (mangled), &di);
6881 compare the sizes of the di.comps and di.subs arrays against the
6885 && (unsigned long) di.num_comps > DEMANGLE_RECURSION_LIMIT)
6893 __extension__ struct demangle_component comps[di.num_comps];
6894 __extension__ struct demangle_component *subs[di.num_subs];
6896 di.comps = comps;
6897 di.subs = subs;
6899 di.comps = alloca (di.num_comps * sizeof (*di.comps));
6900 di.subs = alloca (di.num_subs * sizeof (*di.subs));
6906 dc = cplus_demangle_type (&di);
6909 dc = cplus_demangle_mangled_name (&di, 1);
6913 d_advance (&di, 11);
6914 dc = d_make_comp (&di,
6918 d_make_demangle_mangled_name (&di, d_str (&di)),
6920 d_advance (&di, strlen (d_str (&di)));
6930 if (((options & DMGL_PARAMS) != 0) && d_peek_char (&di) != '\0')
6934 if (dc == NULL && di.unresolved_name_state == -1)
6936 di.unresolved_name_state = 0;
7170 struct d_info di;
7177 cplus_demangle_init_info (mangled, DMGL_GNU_V3, strlen (mangled), &di);
7181 __extension__ struct demangle_component comps[di.num_comps];
7182 __extension__ struct demangle_component *subs[di.num_subs];
7184 di.comps = comps;
7185 di.subs = subs;
7187 di.comps = alloca (di.num_comps * sizeof (*di.comps));
7188 di.subs = alloca (di.num_subs * sizeof (*di.subs));
7191 dc = cplus_demangle_mangled_name (&di, 1);