8sa1-gcc/gcc/cp/ptree.c
Mark Mitchell f181d4aea0 cp-tree.def (CPLUS_BINDING): Update documentation.
* cp-tree.def (CPLUS_BINDING): Update documentation.
	* cp-tree.h (LOCAL_BINDING_P): New macro.
	(lang_identifier): Rename local_value to bindings.
	(tree_binding): Make `scope' of type `void*', not `tree'.
	(BINDING_SCOPE): Update documentation.
	(IDENTIFIER_LOCAL_VALUE): Remove.
	(IDENTIFIER_CLASS_VALUE): Document.
	(IDENTIFIER_BINDING): New macro.
	(IDENTIFIER_VALUE): Likewise.
	(TIME_IDENTIFIER_TIME): Likewise.
	(TIME_IDENTIFIER_FILEINFO): Likewise.
	(IMPLICIT_TYPENAME_P): Likewise.
	(set_identifier_local_value): Remove.
	(push_local_binding): New function.
	(push_class_binding): Likewise.
	* class.c (pushclass): Update comments; use push_class_binding.
	* decl.c (set_identifier_local_value_with_scope): Remove.
	(set_identifier_local_value): Likewise.
	(push_binding): New function.
	(pop_binding): Likewise.
	(binding_level): Update documentation.  Remove shadowed.
	(BINDING_LEVEL): New macro.
	(free_binding_nodes): New variable.
	(poplevel): Adjust for new name-lookup scheme.  Don't mess up
	BLOCK_VARs when doing for-scope extension.  Remove effectively
	dead code.
	(pushlevel_class): Tweak formatting.
	(poplevel_class): Adjust for new name-lookup scheme.
	(print_binding_level): Likewise.
	(store_bindings): Likewise.
	(pushdecl): Likewise.
	(pushdecl_class_level): Likewise.
	(push_class_level_binding): Likewise.
	(push_overloaded_decl): Update comments.  Adjust for new
	name-lookup scheme.
	(lookup_name_real): Likewise.
	(lookup_name_current_level): Likewise.
	(cp_finish_decl): Likewise.
	(require_complete_types_for_parms): Likewise.  Remove misleading
	#if 0'd code.
	(grok_parms): Likewise.  Don't call
	require_complete_types_for_parms here.
	(grok_ctor_properties): Don't treat templates as copy
	constructors.
	(grop_op_properties): Or as assignment operators.
	(start_function): Document.  Adjust for new name-lookup scheme.
	(finish_function): Likewise.
	* decl2.c (do_local_using_decl): Use push_local_binding.
	* lex.c (begin_definition_of_inclass_inline): New function, split
	out from ...
	(do_pending_inlines): Here, and ...
	(process_next_inline): Here.
	(get_time_identifier): Use TIME_IDENTIFIER_* macros.
	(init_filename_times): Likewise.
	(extract_interface_info): Likewise.
	(ste_typedecl_interface_info): Likewise.
	(check_newline): Likewise.
	(dump_time_statistics): Likewise.
	(handle_cp_pragma): Likewise.
	(do_identifier): Adjust for new name-lookup scheme.
	* parse.y (function_try_block): Return ctor_initializer_opt value.
	(fndef): Use it.
	(fn.defpen): Pass appropriate values to start_function.
	(pending_inline): Use functor_try_block value, and pass
	appropriate values to finish_function.
	* pt.c (is_member_template): Update documentation; remove handling
	of FUNCTION_DECLs.  As per name, this function should deal only in
	TEMPLATE_DECLs.
	(decl_template_parm_p): Change name of olddecl parameter to decl.
	(check_template_shadow): Adjust for new name-lookup scheme.
	(lookup_template_class): Likewise.
	(tsubst_decl): Tweak so as not to confuse member templates with
	copy constructors and assignment operators.
	(unify): Handle UNION_TYPEs.
	* ptree.c (print_lang_identifier): Adjust for new name-lookup scheme.
	(lang_print_xnode): Adjust for new name-lookup scheme.
	* typeck.c (mark_addressable): Likewise.
	(c_expand_return): Likewise.

From-SVN: r24296
1998-12-13 14:46:07 +00:00

193 lines
5.9 KiB
C

/* Prints out trees in human readable form.
Copyright (C) 1992, 93-96, 1998 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "tree.h"
#include "cp-tree.h"
void
print_lang_decl (file, node, indent)
FILE *file;
tree node;
int indent;
{
if (!DECL_LANG_SPECIFIC (node))
return;
/* A FIELD_DECL only has the flags structure, which we aren't displaying
anyways. */
if (DECL_MUTABLE_P (node))
{
indent_to (file, indent + 3);
fprintf (file, " mutable ");
}
if (TREE_CODE (node) == FIELD_DECL)
return;
indent_to (file, indent + 3);
if (DECL_MAIN_VARIANT (node))
{
fprintf (file, " decl-main-variant ");
fprintf (file, HOST_PTR_PRINTF, DECL_MAIN_VARIANT (node));
}
if (DECL_PENDING_INLINE_INFO (node))
{
fprintf (file, " pending-inline-info ");
fprintf (file, HOST_PTR_PRINTF, DECL_PENDING_INLINE_INFO (node));
}
if (DECL_TEMPLATE_INFO (node))
{
fprintf (file, " template-info ");
fprintf (file, HOST_PTR_PRINTF, DECL_TEMPLATE_INFO (node));
}
}
void
print_lang_type (file, node, indent)
FILE *file;
register tree node;
int indent;
{
if (TREE_CODE (node) == TEMPLATE_TYPE_PARM
|| TREE_CODE (node) == TEMPLATE_TEMPLATE_PARM)
{
indent_to (file, indent + 3);
fputs ("index ", file);
fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_TYPE_IDX (node));
fputs (" level ", file);
fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_TYPE_LEVEL (node));
fputs (" orig_level ", file);
fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_TYPE_ORIG_LEVEL (node));
return;
}
if (! (TREE_CODE (node) == RECORD_TYPE
|| TREE_CODE (node) == UNION_TYPE))
return;
if (!TYPE_LANG_SPECIFIC (node))
return;
indent_to (file, indent + 3);
if (TYPE_NEEDS_CONSTRUCTING (node))
fputs ( "needs-constructor", file);
if (TYPE_NEEDS_DESTRUCTOR (node))
fputs (" needs-destructor", file);
if (TYPE_HAS_DESTRUCTOR (node))
fputs (" ~X()", file);
if (TYPE_HAS_DEFAULT_CONSTRUCTOR (node))
fputs (" X()", file);
if (TYPE_HAS_CONVERSION (node))
fputs (" has-type-conversion", file);
if (TYPE_HAS_INIT_REF (node))
{
if (TYPE_HAS_CONST_INIT_REF (node))
fputs (" X(constX&)", file);
else
fputs (" X(X&)", file);
}
if (TYPE_GETS_NEW (node) & 1)
fputs (" new", file);
if (TYPE_GETS_NEW (node) & 2)
fputs (" new[]", file);
if (TYPE_GETS_DELETE (node) & 1)
fputs (" delete", file);
if (TYPE_GETS_DELETE (node) & 2)
fputs (" delete[]", file);
if (TYPE_HAS_ASSIGNMENT (node))
fputs (" has=", file);
if (TYPE_HAS_ASSIGN_REF (node))
fputs (" this=(X&)", file);
if (TYPE_OVERLOADS_CALL_EXPR (node))
fputs (" op()", file);
if (TYPE_OVERLOADS_ARRAY_REF (node))
fputs (" op[]", file);
if (TYPE_OVERLOADS_ARROW (node))
fputs (" op->", file);
if (TYPE_USES_MULTIPLE_INHERITANCE (node))
fputs (" uses-multiple-inheritance", file);
if (TREE_CODE (node) == RECORD_TYPE)
{
fprintf (file, " n_parents %d n_ancestors %d",
CLASSTYPE_N_BASECLASSES (node),
CLASSTYPE_N_SUPERCLASSES (node));
fprintf (file, " use_template=%d", CLASSTYPE_USE_TEMPLATE (node));
if (CLASSTYPE_INTERFACE_ONLY (node))
fprintf (file, " interface-only");
if (CLASSTYPE_INTERFACE_UNKNOWN (node))
fprintf (file, " interface-unknown");
print_node (file, "member-functions", CLASSTYPE_METHOD_VEC (node),
indent + 4);
print_node (file, "baselinks",
TYPE_BINFO_BASETYPES (node) ? CLASSTYPE_BASELINK_VEC (node) : NULL_TREE,
indent + 4);
}
}
void
print_lang_identifier (file, node, indent)
FILE *file;
tree node;
int indent;
{
print_node (file, "bindings", IDENTIFIER_NAMESPACE_BINDINGS (node), indent + 4);
print_node (file, "class", IDENTIFIER_CLASS_VALUE (node), indent + 4);
print_node (file, "local bindings", IDENTIFIER_BINDING (node), indent + 4);
print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
print_node (file, "template", IDENTIFIER_TEMPLATE (node), indent + 4);
print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4);
print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4);
}
void
lang_print_xnode (file, node, indent)
FILE *file;
tree node;
int indent;
{
switch (TREE_CODE (node))
{
case CPLUS_BINDING:
fprintf (file, " scope ");
fprintf (file, HOST_PTR_PRINTF, BINDING_SCOPE (node));
print_node (file, "value", BINDING_VALUE (node), indent+4);
print_node (file, "chain", TREE_CHAIN (node), indent+4);
break;
case OVERLOAD:
print_node (file, "function", OVL_FUNCTION (node), indent+4);
print_node (file, "chain", TREE_CHAIN (node), indent+4);
break;
case TEMPLATE_PARM_INDEX:
indent_to (file, indent + 3);
fputs ("index ", file);
fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_PARM_IDX (node));
fputs (" level ", file);
fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_PARM_LEVEL (node));
fputs (" orig_level ", file);
fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_PARM_ORIG_LEVEL (node));
break;
default:
break;
}
}