Lines Matching defs:di

682 d_make_empty (struct d_info *di)
686 if (di->next_comp >= di->num_comps)
688 p = &di->comps[di->next_comp];
689 ++di->next_comp;
696 d_make_comp (struct d_info *di, enum demangle_component_type type,
775 p = d_make_empty (di);
788 d_make_name (struct d_info *di, const char *s, int len)
792 p = d_make_empty (di);
801 d_make_builtin_type (struct d_info *di,
808 p = d_make_empty (di);
820 d_make_operator (struct d_info *di, const struct demangle_operator_info *op)
824 p = d_make_empty (di);
836 d_make_extended_operator (struct d_info *di, int args,
841 p = d_make_empty (di);
850 d_make_ctor (struct d_info *di, enum gnu_v3_ctor_kinds kind,
855 p = d_make_empty (di);
864 d_make_dtor (struct d_info *di, enum gnu_v3_dtor_kinds kind,
869 p = d_make_empty (di);
878 d_make_template_param (struct d_info *di, long i)
882 p = d_make_empty (di);
894 d_make_sub (struct d_info *di, const char *name, int len)
898 p = d_make_empty (di);
914 cplus_demangle_mangled_name (struct d_info *di, int top_level)
916 if (d_next_char (di) != '_')
918 if (d_next_char (di) != 'Z')
920 return d_encoding (di, top_level);
982 d_encoding (struct d_info *di, int top_level)
984 char peek = d_peek_char (di);
987 return d_special_name (di);
992 dc = d_name (di);
994 if (dc != NULL && top_level && (di->options & DMGL_PARAMS) == 0)
1023 peek = d_peek_char (di);
1026 return d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME, dc,
1027 d_bare_function_type (di, has_return_type (dc)));
1044 d_name (struct d_info *di)
1046 char peek = d_peek_char (di);
1052 return d_nested_name (di);
1055 return d_local_name (di);
1061 if (d_peek_next_char (di) != 't')
1063 dc = d_substitution (di, 0);
1068 d_advance (di, 2);
1069 dc = d_make_comp (di, DEMANGLE_COMPONENT_QUAL_NAME,
1070 d_make_name (di, "std", 3),
1071 d_unqualified_name (di));
1072 di->expansion += 3;
1076 if (d_peek_char (di) != 'I')
1090 if (! d_add_substitution (di, dc))
1093 dc = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, dc,
1094 d_template_args (di));
1101 dc = d_unqualified_name (di);
1102 if (d_peek_char (di) == 'I')
1107 if (! d_add_substitution (di, dc))
1109 dc = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, dc,
1110 d_template_args (di));
1121 d_nested_name (struct d_info *di)
1126 if (d_next_char (di) != 'N')
1129 pret = d_cv_qualifiers (di, &ret, 1);
1133 *pret = d_prefix (di);
1137 if (d_next_char (di) != 'E')
1155 d_prefix (struct d_info *di)
1165 peek = d_peek_char (di);
1178 dc = d_unqualified_name (di);
1180 dc = d_substitution (di, 1);
1186 dc = d_template_args (di);
1189 dc = d_template_param (di);
1198 ret = d_make_comp (di, comb_type, ret, dc);
1200 if (peek != 'S' && d_peek_char (di) != 'E')
1202 if (! d_add_substitution (di, ret))
1214 d_unqualified_name (struct d_info *di)
1218 peek = d_peek_char (di);
1220 return d_source_name (di);
1225 ret = d_operator_name (di);
1227 di->expansion += sizeof "operator" + ret->u.s_operator.op->len - 2;
1231 return d_ctor_dtor_name (di);
1239 d_source_name (struct d_info *di)
1244 len = d_number (di);
1247 ret = d_identifier (di, len);
1248 di->last_name = ret;
1255 d_number (struct d_info *di)
1262 peek = d_peek_char (di);
1266 d_advance (di, 1);
1267 peek = d_peek_char (di);
1280 d_advance (di, 1);
1281 peek = d_peek_char (di);
1288 d_identifier (struct d_info *di, int len)
1292 name = d_str (di);
1294 if (di->send - name < len)
1297 d_advance (di, len);
1302 if ((di->options & DMGL_JAVA) != 0
1303 && d_peek_char (di) == '$')
1304 d_advance (di, 1);
1319 di->expansion -= len - sizeof "(anonymous namespace)";
1320 return d_make_name (di, "(anonymous namespace)",
1325 return d_make_name (di, name, len);
1391 d_operator_name (struct d_info *di)
1396 c1 = d_next_char (di);
1397 c2 = d_next_char (di);
1399 return d_make_extended_operator (di, c2 - '0', d_source_name (di));
1401 return d_make_comp (di, DEMANGLE_COMPONENT_CAST,
1402 cplus_demangle_type (di), NULL);
1422 return d_make_operator (di, p);
1450 d_special_name (struct d_info *di)
1454 di->expansion += 20;
1455 c = d_next_char (di);
1458 switch (d_next_char (di))
1461 di->expansion -= 5;
1462 return d_make_comp (di, DEMANGLE_COMPONENT_VTABLE,
1463 cplus_demangle_type (di), NULL);
1465 di->expansion -= 10;
1466 return d_make_comp (di, DEMANGLE_COMPONENT_VTT,
1467 cplus_demangle_type (di), NULL);
1469 return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO,
1470 cplus_demangle_type (di), NULL);
1472 return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO_NAME,
1473 cplus_demangle_type (di), NULL);
1476 if (! d_call_offset (di, 'h'))
1478 return d_make_comp (di, DEMANGLE_COMPONENT_THUNK,
1479 d_encoding (di, 0), NULL);
1482 if (! d_call_offset (di, 'v'))
1484 return d_make_comp (di, DEMANGLE_COMPONENT_VIRTUAL_THUNK,
1485 d_encoding (di, 0), NULL);
1488 if (! d_call_offset (di, '\0'))
1490 if (! d_call_offset (di, '\0'))
1492 return d_make_comp (di, DEMANGLE_COMPONENT_COVARIANT_THUNK,
1493 d_encoding (di, 0), NULL);
1501 derived_type = cplus_demangle_type (di);
1502 offset = d_number (di);
1505 if (d_next_char (di) != '_')
1507 base_type = cplus_demangle_type (di);
1510 di->expansion += 5;
1511 return d_make_comp (di, DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE,
1516 return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO_FN,
1517 cplus_demangle_type (di), NULL);
1519 return d_make_comp (di, DEMANGLE_COMPONENT_JAVA_CLASS,
1520 cplus_demangle_type (di), NULL);
1528 switch (d_next_char (di))
1531 return d_make_comp (di, DEMANGLE_COMPONENT_GUARD, d_name (di), NULL);
1534 return d_make_comp (di, DEMANGLE_COMPONENT_REFTEMP, d_name (di),
1538 return d_make_comp (di, DEMANGLE_COMPONENT_HIDDEN_ALIAS,
1539 d_encoding (di, 0), NULL);
1563 d_call_offset (struct d_info *di, int c)
1566 c = d_next_char (di);
1569 d_number (di);
1572 d_number (di);
1573 if (d_next_char (di) != '_')
1575 d_number (di);
1580 if (d_next_char (di) != '_')
1595 d_ctor_dtor_name (struct d_info *di)
1597 if (di->last_name != NULL)
1599 if (di->last_name->type == DEMANGLE_COMPONENT_NAME)
1600 di->expansion += di->last_name->u.s_name.len;
1601 else if (di->last_name->type == DEMANGLE_COMPONENT_SUB_STD)
1602 di->expansion += di->last_name->u.s_string.len;
1604 switch (d_next_char (di))
1610 switch (d_next_char (di))
1624 return d_make_ctor (di, kind, di->last_name);
1631 switch (d_next_char (di))
1645 return d_make_dtor (di, kind, di->last_name);
1708 cplus_demangle_type (struct d_info *di)
1729 peek = d_peek_char (di);
1734 pret = d_cv_qualifiers (di, &ret, 0);
1737 *pret = cplus_demangle_type (di);
1738 if (! d_add_substitution (di, ret))
1751 ret = d_make_builtin_type (di,
1753 di->expansion += ret->u.s_builtin.type->len;
1755 d_advance (di, 1);
1759 d_advance (di, 1);
1760 ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE,
1761 d_source_name (di), NULL);
1765 ret = d_function_type (di);
1772 ret = d_class_enum_type (di);
1776 ret = d_array_type (di);
1780 ret = d_pointer_to_member_type (di);
1784 ret = d_template_param (di);
1785 if (d_peek_char (di) == 'I')
1790 if (! d_add_substitution (di, ret))
1792 ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
1793 d_template_args (di));
1803 peek_next = d_peek_next_char (di);
1808 ret = d_substitution (di, 0);
1811 if (d_peek_char (di) == 'I')
1812 ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
1813 d_template_args (di));
1819 ret = d_class_enum_type (di);
1831 d_advance (di, 1);
1832 ret = d_make_comp (di, DEMANGLE_COMPONENT_POINTER,
1833 cplus_demangle_type (di), NULL);
1837 d_advance (di, 1);
1838 ret = d_make_comp (di, DEMANGLE_COMPONENT_REFERENCE,
1839 cplus_demangle_type (di), NULL);
1843 d_advance (di, 1);
1844 ret = d_make_comp (di, DEMANGLE_COMPONENT_COMPLEX,
1845 cplus_demangle_type (di), NULL);
1849 d_advance (di, 1);
1850 ret = d_make_comp (di, DEMANGLE_COMPONENT_IMAGINARY,
1851 cplus_demangle_type (di), NULL);
1855 d_advance (di, 1);
1856 ret = d_source_name (di);
1857 ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,
1858 cplus_demangle_type (di), ret);
1867 if (! d_add_substitution (di, ret))
1877 d_cv_qualifiers (struct d_info *di,
1882 peek = d_peek_char (di);
1887 d_advance (di, 1);
1893 di->expansion += sizeof "restrict";
1900 di->expansion += sizeof "volatile";
1907 di->expansion += sizeof "const";
1910 *pret = d_make_comp (di, t, NULL, NULL);
1915 peek = d_peek_char (di);
1924 d_function_type (struct d_info *di)
1928 if (d_next_char (di) != 'F')
1930 if (d_peek_char (di) == 'Y')
1934 d_advance (di, 1);
1936 ret = d_bare_function_type (di, 1);
1937 if (d_next_char (di) != 'E')
1945 d_bare_function_type (struct d_info *di, int has_return_type)
1954 peek = d_peek_char (di);
1957 d_advance (di, 1);
1968 peek = d_peek_char (di);
1971 type = cplus_demangle_type (di);
1981 *ptl = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, type, NULL);
1999 di->expansion -= d_left (tl)->u.s_builtin.type->len;
2003 return d_make_comp (di, DEMANGLE_COMPONENT_FUNCTION_TYPE, return_type, tl);
2009 d_class_enum_type (struct d_info *di)
2011 return d_name (di);
2019 d_array_type (struct d_info *di)
2024 if (d_next_char (di) != 'A')
2027 peek = d_peek_char (di);
2034 s = d_str (di);
2037 d_advance (di, 1);
2038 peek = d_peek_char (di);
2041 dim = d_make_name (di, s, d_str (di) - s);
2047 dim = d_expression (di);
2052 if (d_next_char (di) != '_')
2055 return d_make_comp (di, DEMANGLE_COMPONENT_ARRAY_TYPE, dim,
2056 cplus_demangle_type (di));
2062 d_pointer_to_member_type (struct d_info *di)
2068 if (d_next_char (di) != 'M')
2071 cl = cplus_demangle_type (di);
2086 pmem = d_cv_qualifiers (di, &mem, 1);
2089 *pmem = cplus_demangle_type (di);
2091 return d_make_comp (di, DEMANGLE_COMPONENT_PTRMEM_TYPE, cl, mem);
2099 d_template_param (struct d_info *di)
2103 if (d_next_char (di) != 'T')
2106 if (d_peek_char (di) == '_')
2110 param = d_number (di);
2116 if (d_next_char (di) != '_')
2119 ++di->did_subs;
2121 return d_make_template_param (di, param);
2127 d_template_args (struct d_info *di)
2136 hold_last_name = di->last_name;
2138 if (d_next_char (di) != 'I')
2147 a = d_template_arg (di);
2151 *pal = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, a, NULL);
2156 if (d_peek_char (di) == 'E')
2158 d_advance (di, 1);
2163 di->last_name = hold_last_name;
2174 d_template_arg (struct d_info *di)
2178 switch (d_peek_char (di))
2181 d_advance (di, 1);
2182 ret = d_expression (di);
2183 if (d_next_char (di) != 'E')
2188 return d_expr_primary (di);
2191 return cplus_demangle_type (di);
2206 d_expression (struct d_info *di)
2210 peek = d_peek_char (di);
2212 return d_expr_primary (di);
2214 return d_template_param (di);
2215 else if (peek == 's' && d_peek_next_char (di) == 'r')
2220 d_advance (di, 2);
2221 type = cplus_demangle_type (di);
2222 name = d_unqualified_name (di);
2223 if (d_peek_char (di) != 'I')
2224 return d_make_comp (di, DEMANGLE_COMPONENT_QUAL_NAME, type, name);
2226 return d_make_comp (di, DEMANGLE_COMPONENT_QUAL_NAME, type,
2227 d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name,
2228 d_template_args (di)));
2235 op = d_operator_name (di);
2240 di->expansion += op->u.s_operator.op->len - 2;
2244 return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
2245 cplus_demangle_type (di));
2265 return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
2266 d_expression (di));
2271 left = d_expression (di);
2272 return d_make_comp (di, DEMANGLE_COMPONENT_BINARY, op,
2273 d_make_comp (di,
2276 d_expression (di)));
2283 first = d_expression (di);
2284 second = d_expression (di);
2285 return d_make_comp (di, DEMANGLE_COMPONENT_TRINARY, op,
2286 d_make_comp (di,
2289 d_make_comp (di,
2292 d_expression (di))));
2306 d_expr_primary (struct d_info *di)
2310 if (d_next_char (di) != 'L')
2312 if (d_peek_char (di) == '_')
2313 ret = cplus_demangle_mangled_name (di, 0);
2320 type = cplus_demangle_type (di);
2328 di->expansion -= type->u.s_builtin.type->len;
2342 if (d_peek_char (di) == 'n')
2345 d_advance (di, 1);
2347 s = d_str (di);
2348 while (d_peek_char (di) != 'E')
2350 if (d_peek_char (di) == '\0')
2352 d_advance (di, 1);
2354 ret = d_make_comp (di, t, type, d_make_name (di, s, d_str (di) - s));
2356 if (d_next_char (di) != 'E')
2366 d_local_name (struct d_info *di)
2370 if (d_next_char (di) != 'Z')
2373 function = d_encoding (di, 0);
2375 if (d_next_char (di) != 'E')
2378 if (d_peek_char (di) == 's')
2380 d_advance (di, 1);
2381 if (! d_discriminator (di))
2383 return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function,
2384 d_make_name (di, "string literal",
2391 name = d_name (di);
2392 if (! d_discriminator (di))
2394 return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function, name);
2404 d_discriminator (struct d_info *di)
2408 if (d_peek_char (di) != '_')
2410 d_advance (di, 1);
2411 discrim = d_number (di);
2420 d_add_substitution (struct d_info *di, struct demangle_component *dc)
2424 if (di->next_sub >= di->num_subs)
2426 di->subs[di->next_sub] = dc;
2427 ++di->next_sub;
2476 d_substitution (struct d_info *di, int prefix)
2480 if (d_next_char (di) != 'S')
2483 c = d_next_char (di);
2499 c = d_next_char (di);
2506 if (id >= di->next_sub)
2509 ++di->did_subs;
2511 return di->subs[id];
2519 verbose = (di->options & DMGL_VERBOSE) != 0;
2524 peek = d_peek_char (di);
2539 di->last_name = d_make_sub (di, p->set_last_name,
2551 di->expansion += len;
2552 return d_make_sub (di, s, len);
3746 struct d_info *di)
3748 di->s = mangled;
3749 di->send = mangled + len;
3750 di->options = options;
3752 di->n = mangled;
3757 di->num_comps = 2 * len;
3758 di->next_comp = 0;
3762 di->num_subs = len;
3763 di->next_sub = 0;
3764 di->did_subs = 0;
3766 di->last_name = NULL;
3768 di->expansion = 0;
3783 struct d_info di;
3822 cplus_demangle_init_info (mangled, options, len, &di);
3826 __extension__ struct demangle_component comps[di.num_comps];
3827 __extension__ struct demangle_component *subs[di.num_subs];
3829 di.comps = &comps[0];
3830 di.subs = &subs[0];
3832 di.comps = ((struct demangle_component *)
3833 malloc (di.num_comps * sizeof (struct demangle_component)));
3834 di.subs = ((struct demangle_component **)
3835 malloc (di.num_subs * sizeof (struct demangle_component *)));
3836 if (di.comps == NULL || di.subs == NULL)
3838 if (di.comps != NULL)
3839 free (di.comps);
3840 if (di.subs != NULL)
3841 free (di.subs);
3848 dc = cplus_demangle_mangled_name (&di, 1);
3850 dc = cplus_demangle_type (&di);
3856 if (((options & DMGL_PARAMS) != 0) && d_peek_char (&di) != '\0')
3868 estimate = len + di.expansion + 10 * di.did_subs;
3876 free (di.comps);
3877 free (di.subs);
4070 struct d_info di;
4077 cplus_demangle_init_info (mangled, DMGL_GNU_V3, strlen (mangled), &di);
4081 __extension__ struct demangle_component comps[di.num_comps];
4082 __extension__ struct demangle_component *subs[di.num_subs];
4084 di.comps = &comps[0];
4085 di.subs = &subs[0];
4087 di.comps = ((struct demangle_component *)
4088 malloc (di.num_comps * sizeof (struct demangle_component)));
4089 di.subs = ((struct demangle_component **)
4090 malloc (di.num_subs * sizeof (struct demangle_component *)));
4091 if (di.comps == NULL || di.subs == NULL)
4093 if (di.comps != NULL)
4094 free (di.comps);
4095 if (di.subs != NULL)
4096 free (di.subs);
4101 dc = cplus_demangle_mangled_name (&di, 1);
4139 free (di.subs);
4140 free (di.comps);