static struct demangle_component *d_type (struct d_info *);
#define cplus_demangle_print d_print
-static char *d_print (int, const struct demangle_component *, int, size_t *);
+static char *d_print (int, struct demangle_component *, int, size_t *);
#define cplus_demangle_print_callback d_print_callback
-static int d_print_callback (int, const struct demangle_component *,
+static int d_print_callback (int, struct demangle_component *,
demangle_callbackref, void *);
#define cplus_demangle_init_info d_init_info
in which they appeared in the mangled string. */
struct d_print_mod *next;
/* The modifier. */
- const struct demangle_component *mod;
+ struct demangle_component *mod;
/* Whether this modifier was printed. */
int printed;
/* The list of templates which applies to this modifier. */
static inline char d_last_char (struct d_print_info *);
static void
-d_print_comp (struct d_print_info *, int, const struct demangle_component *);
+d_print_comp (struct d_print_info *, int, struct demangle_component *);
static void
d_print_java_identifier (struct d_print_info *, const char *, int);
d_print_mod_list (struct d_print_info *, int, struct d_print_mod *, int);
static void
-d_print_mod (struct d_print_info *, int, const struct demangle_component *);
+d_print_mod (struct d_print_info *, int, struct demangle_component *);
static void
d_print_function_type (struct d_print_info *, int,
- const struct demangle_component *,
+ struct demangle_component *,
struct d_print_mod *);
static void
d_print_array_type (struct d_print_info *, int,
- const struct demangle_component *,
+ struct demangle_component *,
struct d_print_mod *);
static void
-d_print_expr_op (struct d_print_info *, int, const struct demangle_component *);
+d_print_expr_op (struct d_print_info *, int, struct demangle_component *);
static void d_print_cast (struct d_print_info *, int,
- const struct demangle_component *);
+ struct demangle_component *);
static void d_print_conversion (struct d_print_info *, int,
- const struct demangle_component *);
+ struct demangle_component *);
static int d_demangle_callback (const char *, int,
demangle_callbackref, void *);
if (di->next_comp >= di->num_comps)
return NULL;
p = &di->comps[di->next_comp];
+ p->d_printing = 0;
++di->next_comp;
return p;
}
CP_STATIC_IF_GLIBCPP_V3
int
cplus_demangle_print_callback (int options,
- const struct demangle_component *dc,
+ struct demangle_component *dc,
demangle_callbackref callback, void *opaque)
{
struct d_print_info dpi;
CP_STATIC_IF_GLIBCPP_V3
char *
-cplus_demangle_print (int options, const struct demangle_component *dc,
+cplus_demangle_print (int options, struct demangle_component *dc,
int estimate, size_t *palc)
{
struct d_growable_string dgs;
static void
d_print_subexpr (struct d_print_info *dpi, int options,
- const struct demangle_component *dc)
+ struct demangle_component *dc)
{
int simple = 0;
if (dc->type == DEMANGLE_COMPONENT_NAME
static int
d_maybe_print_fold_expression (struct d_print_info *dpi, int options,
- const struct demangle_component *dc)
+ struct demangle_component *dc)
{
- const struct demangle_component *ops, *operator_, *op1, *op2;
+ struct demangle_component *ops, *operator_, *op1, *op2;
int save_idx;
const char *fold_code = d_left (dc)->u.s_operator.op->code;
static void
d_print_comp_inner (struct d_print_info *dpi, int options,
- const struct demangle_component *dc)
+ struct demangle_component *dc)
{
/* Magic variable to let reference smashing skip over the next modifier
without needing to modify *dc. */
- const struct demangle_component *mod_inner = NULL;
+ struct demangle_component *mod_inner = NULL;
/* Variable used to store the current templates while a previously
captured scope is used. */
case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
{
/* Handle reference smashing: & + && = &. */
- const struct demangle_component *sub = d_left (dc);
+ struct demangle_component *sub = d_left (dc);
if (!dpi->is_lambda_arg
&& sub->type == DEMANGLE_COMPONENT_TEMPLATE_PARAM)
{
static void
d_print_comp (struct d_print_info *dpi, int options,
- const struct demangle_component *dc)
+ struct demangle_component *dc)
{
struct d_component_stack self;
+ if (dc == NULL || dc->d_printing > 1)
+ {
+ d_print_error (dpi);
+ return;
+ }
+ else
+ dc->d_printing++;
self.dc = dc;
self.parent = dpi->component_stack;
d_print_comp_inner (dpi, options, dc);
dpi->component_stack = self.parent;
+ dc->d_printing--;
}
/* Print a Java dentifier. For Java we try to handle encoded extended
static void
d_print_mod (struct d_print_info *dpi, int options,
- const struct demangle_component *mod)
+ struct demangle_component *mod)
{
switch (mod->type)
{
static void
d_print_function_type (struct d_print_info *dpi, int options,
- const struct demangle_component *dc,
+ struct demangle_component *dc,
struct d_print_mod *mods)
{
int need_paren;
static void
d_print_array_type (struct d_print_info *dpi, int options,
- const struct demangle_component *dc,
+ struct demangle_component *dc,
struct d_print_mod *mods)
{
int need_space;
static void
d_print_expr_op (struct d_print_info *dpi, int options,
- const struct demangle_component *dc)
+ struct demangle_component *dc)
{
if (dc->type == DEMANGLE_COMPONENT_OPERATOR)
d_append_buffer (dpi, dc->u.s_operator.op->name,
static void
d_print_cast (struct d_print_info *dpi, int options,
- const struct demangle_component *dc)
+ struct demangle_component *dc)
{
d_print_comp (dpi, options, d_left (dc));
}
static void
d_print_conversion (struct d_print_info *dpi, int options,
- const struct demangle_component *dc)
+ struct demangle_component *dc)
{
struct d_print_template dpt;