cp-tree.h (cp_tree_index): Add CPTI_BASE_CTOR_IDENTIFIER...

* cp-tree.h (cp_tree_index): Add CPTI_BASE_CTOR_IDENTIFIER,
	CPTI_BASE_DTOR_IDENTIFIER, and CPTI_DELETING_DTOR_IDENTIFIER.
	(base_ctor_identifier): New macro.
	(base_dtor_identifier): Likewise.
	(deleting_dtor_identifier): Likewise.
	* decl.c: Don't include obstack.h.
	(obstack_chunk_alloc): Don't define.
	(obstack_chunk_free): Likewise.
	(struct predefined_identifier): New type.
	(initialize_predefined_identifiers): New function.
	(init_decl_processing): Use it.
	(debug_temp_inits): Remove.
	(start_method): Don't call preserve_data.
	(hack_incomplete_structures): Update comment.
	* init.c (init_init_processing): Don't initialize
	nelts_identifier.
	(build_offset_rf): Remove dead code.
	(build_delete): Use CLASSTYPE_N_BASECLASSES.
	* search.c (init_search_processing): Don't initialize
	vptr_identifier.

From-SVN: r33031
This commit is contained in:
Mark Mitchell 2000-04-09 00:27:16 +00:00 committed by Mark Mitchell
parent 729a708984
commit d43829f9ee
5 changed files with 88 additions and 45 deletions

View File

@ -1,3 +1,26 @@
2000-04-08 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (cp_tree_index): Add CPTI_BASE_CTOR_IDENTIFIER,
CPTI_BASE_DTOR_IDENTIFIER, and CPTI_DELETING_DTOR_IDENTIFIER.
(base_ctor_identifier): New macro.
(base_dtor_identifier): Likewise.
(deleting_dtor_identifier): Likewise.
* decl.c: Don't include obstack.h.
(obstack_chunk_alloc): Don't define.
(obstack_chunk_free): Likewise.
(struct predefined_identifier): New type.
(initialize_predefined_identifiers): New function.
(init_decl_processing): Use it.
(debug_temp_inits): Remove.
(start_method): Don't call preserve_data.
(hack_incomplete_structures): Update comment.
* init.c (init_init_processing): Don't initialize
nelts_identifier.
(build_offset_rf): Remove dead code.
(build_delete): Use CLASSTYPE_N_BASECLASSES.
* search.c (init_search_processing): Don't initialize
vptr_identifier.
2000-04-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* typeck.c (build_binary_op): Call `tree_expr_nonnegative_p' to elide

View File

@ -560,9 +560,12 @@ enum cp_tree_index
CPTI_ACCESS_PRIVATE_VIRTUAL,
CPTI_CTOR_IDENTIFIER,
CPTI_BASE_CTOR_IDENTIFIER,
CPTI_DTOR_IDENTIFIER,
CPTI_BASE_DTOR_IDENTIFIER,
CPTI_DELETING_DTOR_IDENTIFIER,
CPTI_DELTA2_IDENTIFIER,
CPTI_DELTA_IDENTIFIER,
CPTI_DTOR_IDENTIFIER,
CPTI_IN_CHARGE_IDENTIFIER,
CPTI_INDEX_IDENTIFIER,
CPTI_NELTS_IDENTIFIER,
@ -652,10 +655,21 @@ extern tree cp_global_trees[CPTI_MAX];
/* We cache these tree nodes so as to call get_identifier less
frequently. */
/* The name of a constructor that constructors virtual base classes. */
#define ctor_identifier cp_global_trees[CPTI_CTOR_IDENTIFIER]
/* The name of a constructor that does not construct virtual base classes. */
#define base_ctor_identifier cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER]
/* The name of a destructor that destroys virtual base classes. */
#define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER]
/* The name of a destructor that does not destroy virtual base
classes. */
#define base_dtor_identifier cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER]
/* The name of a destructor that destroys virtual base classes, and
then deletes the entire object. */
#define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
#define delta2_identifier cp_global_trees[CPTI_DELTA2_IDENTIFIER]
#define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER]
#define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER]
#define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
#define index_identifier cp_global_trees[CPTI_INDEX_IDENTIFIER]
#define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER]

View File

@ -37,7 +37,6 @@ Boston, MA 02111-1307, USA. */
#include "decl.h"
#include "lex.h"
#include <signal.h>
#include "obstack.h"
#include "defaults.h"
#include "output.h"
#include "except.h"
@ -46,11 +45,6 @@ Boston, MA 02111-1307, USA. */
#include "defaults.h"
#include "ggc.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
extern struct obstack permanent_obstack;
extern int current_class_depth;
extern tree static_ctors, static_dtors;
@ -183,6 +177,7 @@ static tree get_dso_handle_node PARAMS ((void));
static tree start_cleanup_fn PARAMS ((void));
static void end_cleanup_fn PARAMS ((void));
static tree cp_make_fname_decl PARAMS ((tree, const char *, int));
static void initialize_predefined_identifiers PARAMS ((void));
#if defined (DEBUG_CP_BINDING_LEVELS)
static void indent PARAMS ((void));
@ -6041,6 +6036,50 @@ record_unknown_type (type, name)
TYPE_MODE (type) = TYPE_MODE (void_type_node);
}
/* An string for which we should create an IDENTIFIER_NODE at
startup. */
typedef struct predefined_identifier
{
/* The name of the identifier. */
const char *name;
/* The place where the IDENTIFIER_NODE should be stored. */
tree *node;
} predefined_identifier;
/* Create all the predefined identifiers. */
static void
initialize_predefined_identifiers ()
{
struct predefined_identifier *pid;
/* A table of identifiers to create at startup. */
static predefined_identifier predefined_identifiers[] = {
{ "C++", &lang_name_cplusplus },
{ "C", &lang_name_c },
{ "Java", &lang_name_java },
{ CTOR_NAME, &ctor_identifier },
{ "__base_ctor", &base_ctor_identifier },
{ DTOR_NAME, &dtor_identifier },
{ "__base_dtor", &base_dtor_identifier },
{ "__deleting_dtor", &deleting_dtor_identifier },
{ VTABLE_DELTA2_NAME, &delta2_identifier },
{ VTABLE_DELTA_NAME, &delta_identifier },
{ IN_CHARGE_NAME, &in_charge_identifier },
{ VTABLE_INDEX_NAME, &index_identifier },
{ "nelts", &nelts_identifier },
{ THIS_NAME, &this_identifier },
{ VTABLE_PFN_NAME, &pfn_identifier },
{ "__pfn_or_delta2", &pfn_or_delta2_identifier },
{ "_vptr", &vptr_identifier },
{ NULL, NULL }
};
for (pid = predefined_identifiers; pid->name; ++pid)
*pid->node = get_identifier (pid->name);
}
/* Create the predefined scalar types of C,
and some nodes representing standard constants (0, 1, (void *)0).
Initialize the global binding level.
@ -6058,10 +6097,8 @@ init_decl_processing ()
if (flag_new_abi && !flag_vtable_thunks)
fatal ("the new ABI requires vtable thunks");
/* Have to make these distinct before we try using them. */
lang_name_cplusplus = get_identifier ("C++");
lang_name_c = get_identifier ("C");
lang_name_java = get_identifier ("Java");
/* Create all the identifiers we need. */
initialize_predefined_identifiers ();
/* Let the back-end now how to save and restore language-specific
per-function globals. */
@ -6133,16 +6170,6 @@ init_decl_processing ()
NAMESPACE_LEVEL (global_namespace) = global_binding_level;
declare_namespace_level ();
this_identifier = get_identifier (THIS_NAME);
in_charge_identifier = get_identifier (IN_CHARGE_NAME);
ctor_identifier = get_identifier (CTOR_NAME);
dtor_identifier = get_identifier (DTOR_NAME);
pfn_identifier = get_identifier (VTABLE_PFN_NAME);
index_identifier = get_identifier (VTABLE_INDEX_NAME);
delta_identifier = get_identifier (VTABLE_DELTA_NAME);
delta2_identifier = get_identifier (VTABLE_DELTA2_NAME);
pfn_or_delta2_identifier = get_identifier ("__pfn_or_delta2");
/* Define `int' and `char' first so that dbx will output them first. */
record_builtin_type (RID_INT, NULL_PTR, integer_type_node);
record_builtin_type (RID_CHAR, "char", char_type_node);
@ -6895,10 +6922,6 @@ groktypename (typename)
do go through here. Structure field declarations are done by
grokfield and not through here. */
/* Set this to zero to debug not using the temporary obstack
to parse initializers. */
int debug_temp_inits = 1;
tree
start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
tree declarator, declspecs;
@ -14308,12 +14331,6 @@ start_method (declspecs, declarator, attrlist)
if (processing_template_decl && !DECL_TEMPLATE_SPECIALIZATION (fndecl))
fndecl = push_template_decl (fndecl);
/* We read in the parameters on the maybepermanent_obstack,
but we won't be getting back to them until after we
may have clobbered them. So the call to preserve_data
will keep them safe. */
preserve_data ();
if (! DECL_FRIEND_P (fndecl))
{
if (TREE_CHAIN (fndecl))
@ -14477,10 +14494,7 @@ hack_incomplete_structures (type)
}
/* If DECL is of a type which needs a cleanup, build that cleanup here.
See build_delete for information about AUTO_DELETE.
Don't build these on the momentary obstack; they must live
the life of the binding contour. */
See build_delete for information about AUTO_DELETE. */
static tree
maybe_build_cleanup_1 (decl, auto_delete)

View File

@ -66,7 +66,6 @@ void init_init_processing ()
/* Define the structure that holds header information for
arrays allocated via operator new. */
BI_header_type = make_aggr_type (RECORD_TYPE);
nelts_identifier = get_identifier ("nelts");
fields[0] = build_lang_decl (FIELD_DECL, nelts_identifier, sizetype);
/* Use the biggest alignment supported by the target to prevent operator
@ -1595,12 +1594,6 @@ build_offset_ref (type, name)
type, TREE_OPERAND (name, 0));
name = dtor_identifier;
}
#if 0
/* I think this is wrong, but the draft is unclear. --jason 6/15/98 */
else if (name == constructor_name_full (type)
|| name == constructor_name (type))
name = ctor_identifier;
#endif
if (!COMPLETE_TYPE_P (complete_type (type))
&& !TYPE_BEING_DEFINED (type))
@ -3184,7 +3177,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
{
/* We only get here from finish_function for a destructor. */
tree binfos = BINFO_BASETYPES (TYPE_BINFO (type));
int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (type);
tree base_binfo = n_baseclasses > 0 ? TREE_VEC_ELT (binfos, 0) : NULL_TREE;
tree exprstmt = NULL_TREE;
tree parent_auto_delete = auto_delete;

View File

@ -3393,7 +3393,6 @@ void
init_search_processing ()
{
gcc_obstack_init (&search_obstack);
vptr_identifier = get_identifier ("_vptr");
}
void