static void unpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) { DECL_MODE (expr) = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE); DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_ABSTRACT (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_PRESERVE_P (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_DEBUG_EXPR_IS_FROM (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_EXTERNAL (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_GIMPLE_REG_P (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_ALIGN (expr) = (unsigned) bp_unpack_var_len_unsigned (bp); if (TREE_CODE (expr) == LABEL_DECL) { DECL_ERROR_ISSUED (expr) = (unsigned) bp_unpack_value (bp, 1); EH_LANDING_PAD_NR (expr) = (int) bp_unpack_var_len_unsigned (bp); /* Always assume an initial value of -1 for LABEL_DECL_UID to force gimple_set_bb to recreate label_to_block_map. */ LABEL_DECL_UID (expr) = -1; } if (TREE_CODE (expr) == FIELD_DECL) { DECL_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_NONADDRESSABLE_P (expr) = (unsigned) bp_unpack_value (bp, 1); expr->decl_common.off_align = bp_unpack_value (bp, 8); } if (TREE_CODE (expr) == VAR_DECL) DECL_NONLOCAL_FRAME (expr) = (unsigned) bp_unpack_value (bp, 1); if (TREE_CODE (expr) == RESULT_DECL || TREE_CODE (expr) == PARM_DECL || TREE_CODE (expr) == VAR_DECL) { DECL_BY_REFERENCE (expr) = (unsigned) bp_unpack_value (bp, 1); if (TREE_CODE (expr) == VAR_DECL || TREE_CODE (expr) == PARM_DECL) DECL_HAS_VALUE_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1); } }
static void pack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr) { bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, DECL_MODE (expr)); bp_pack_value (bp, DECL_NONLOCAL (expr), 1); bp_pack_value (bp, DECL_VIRTUAL_P (expr), 1); bp_pack_value (bp, DECL_IGNORED_P (expr), 1); bp_pack_value (bp, DECL_ABSTRACT (expr), 1); bp_pack_value (bp, DECL_ARTIFICIAL (expr), 1); bp_pack_value (bp, DECL_USER_ALIGN (expr), 1); bp_pack_value (bp, DECL_PRESERVE_P (expr), 1); bp_pack_value (bp, DECL_DEBUG_EXPR_IS_FROM (expr), 1); bp_pack_value (bp, DECL_EXTERNAL (expr), 1); bp_pack_value (bp, DECL_GIMPLE_REG_P (expr), 1); bp_pack_var_len_unsigned (bp, DECL_ALIGN (expr)); if (TREE_CODE (expr) == LABEL_DECL) { /* Note that we do not write LABEL_DECL_UID. The reader will always assume an initial value of -1 so that the label_to_block_map is recreated by gimple_set_bb. */ bp_pack_value (bp, DECL_ERROR_ISSUED (expr), 1); bp_pack_var_len_unsigned (bp, EH_LANDING_PAD_NR (expr)); } if (TREE_CODE (expr) == FIELD_DECL) { bp_pack_value (bp, DECL_PACKED (expr), 1); bp_pack_value (bp, DECL_NONADDRESSABLE_P (expr), 1); bp_pack_value (bp, expr->decl_common.off_align, 8); } if (TREE_CODE (expr) == RESULT_DECL || TREE_CODE (expr) == PARM_DECL || TREE_CODE (expr) == VAR_DECL) { bp_pack_value (bp, DECL_BY_REFERENCE (expr), 1); if (TREE_CODE (expr) == VAR_DECL || TREE_CODE (expr) == PARM_DECL) bp_pack_value (bp, DECL_HAS_VALUE_EXPR_P (expr), 1); bp_pack_value (bp, DECL_RESTRICTED_P (expr), 1); } }
/* Default tree printer. Handles declarations only. */ extern "C" bool default_tree_printer(pretty_printer * pp, text_info *text, const char *spec, int precision, bool wide, bool set_locus, bool hash) { tree t; /* FUTURE: %+x should set the locus. */ if(precision != 0 || wide || hash) return false; switch(*spec) { case 'D': t = va_arg(*text->args_ptr, tree); if(DECL_DEBUG_EXPR_IS_FROM(t) && DECL_DEBUG_EXPR(t)) t = DECL_DEBUG_EXPR(t); break; case 'F': case 'T': t = va_arg(*text->args_ptr, tree); break; default: return false; } if(set_locus && text->locus) *text->locus = DECL_SOURCE_LOCATION(t); if(DECL_P(t)) { const char *n = DECL_NAME(t) ? lang_hooks.decl_printable_name(t, 2) : "<anonymous>"; pp_string(pp, n); } else dump_generic_node(pp, t, 0, 0, 0); return true; }
/* Called during diagnostic message formatting process to print a source-level entity onto BUFFER. The meaning of the format specifiers is as follows: %D: a general decl, %E: an identifier or expression, %F: a function declaration, %T: a type. These format specifiers form a subset of the format specifiers set used by the C++ front-end. Please notice when called, the `%' part was already skipped by the diagnostic machinery. */ static bool c_tree_printer (pretty_printer *pp, text_info *text, const char *spec, int precision, bool wide, bool set_locus, bool hash) { tree t = va_arg (*text->args_ptr, tree); tree name; c_pretty_printer *cpp = (c_pretty_printer *) pp; pp->padding = pp_none; if (precision != 0 || wide || hash) return false; if (set_locus && text->locus) *text->locus = DECL_SOURCE_LOCATION (t); switch (*spec) { case 'D': if (DECL_DEBUG_EXPR_IS_FROM (t) && DECL_DEBUG_EXPR (t)) { t = DECL_DEBUG_EXPR (t); if (!DECL_P (t)) { pp_c_expression (cpp, t); return true; } } /* FALLTHRU */ case 'F': if (DECL_NAME (t)) { pp_identifier (cpp, lang_hooks.decl_printable_name (t, 2)); return true; } break; case 'T': gcc_assert (TYPE_P (t)); name = TYPE_NAME (t); if (name && TREE_CODE (name) == TYPE_DECL) { if (DECL_NAME (name)) pp_identifier (cpp, lang_hooks.decl_printable_name (name, 2)); else pp_type_id (cpp, t); return true; } else { pp_type_id (cpp, t); return true; } break; case 'E': if (TREE_CODE (t) == IDENTIFIER_NODE) pp_identifier (cpp, IDENTIFIER_POINTER (t)); else pp_expression (cpp, t); return true; default: return false; } pp_string (cpp, _("({anonymous})")); return true; }