/* Code to maintain a C++ template repository.
- Copyright (C) 1995, 96-97, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
Contributed by Jason Merrill (jason@cygnus.com)
This file is part of GNU CC.
static char *old_args, *old_dir, *old_main;
extern int flag_use_repository;
-extern struct obstack temporary_obstack;
+static struct obstack temporary_obstack;
extern struct obstack permanent_obstack;
#define IDENTIFIER_REPO_USED(NODE) (TREE_LANG_FLAG_3 (NODE))
repo_get_id (t)
tree t;
{
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
+ if (TYPE_P (t))
{
+ tree vtable;
+
/* If we're not done setting up the class, we may not have set up
the vtable, so going ahead would give the wrong answer.
See g++.pt/instantiate4.C. */
- if (TYPE_SIZE (t) == NULL_TREE || TYPE_BEING_DEFINED (t))
+ if (!COMPLETE_TYPE_P (t) || TYPE_BEING_DEFINED (t))
my_friendly_abort (981113);
- t = TYPE_BINFO_VTABLE (t);
+ vtable = get_vtbl_decl_for_binfo (TYPE_BINFO (t));
+
+ /* If we don't have a primary vtable, try looking for a secondary
+ vtable. */
+ if (vtable == NULL_TREE && !flag_new_abi
+ && TYPE_USES_VIRTUAL_BASECLASSES (t))
+ {
+ tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
+ int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+ for (i = 0; i < n_baselinks; ++i)
+ {
+ tree base_binfo = TREE_VEC_ELT (binfos, i);
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ {
+ vtable = get_vtbl_decl_for_binfo (base_binfo);
+ if (vtable)
+ break;
+ }
+ }
+ }
+
+ t = vtable;
if (t == NULL_TREE)
return t;
}
if (id == NULL_TREE)
return;
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
+ if (TYPE_P (t))
{
if (IDENTIFIER_REPO_CHOSEN (id))
mark_class_instantiated (t, 0);
}
- else if (TREE_CODE_CLASS (TREE_CODE (t)) == 'd')
+ else if (DECL_P (t))
{
if (IDENTIFIER_REPO_CHOSEN (id))
mark_decl_instantiated (t, 0);
/* Member functions of polymorphic classes go with their vtables. */
if (DECL_FUNCTION_MEMBER_P (fn)
- && TYPE_POLYMORPHIC_P (DECL_CLASS_CONTEXT (fn)))
+ && TYPE_POLYMORPHIC_P (DECL_CONTEXT (fn)))
{
- repo_vtable_used (DECL_CLASS_CONTEXT (fn));
+ repo_vtable_used (DECL_CONTEXT (fn));
return;
}
return;
p = file_name_nondirectory (s);
- p = rindex (p, '.');
+ p = strrchr (p, '.');
if (! p)
p = s + strlen (s);
ggc_add_tree_root (&pending_repo, 1);
ggc_add_tree_root (&original_repo, 1);
+ gcc_obstack_init (&temporary_obstack);
open_repo_file (filename);