Commit 6b5fbb55 by Mike Stump

86th Cygnus<->FSF quick merge

From-SVN: r11710
parent 5ae5999c
Fri Apr 12 09:08:27 1996 Bob Manson <manson@charmed.cygnus.com>
* search.c (expand_upcast_fixups): Mark the new fixup as
DECL_ARTIFICIAL.
Thu Apr 11 03:57:09 1996 Jason Merrill <jason@yorick.cygnus.com>
* init.c (build_new): Use a TARGET_EXPR for alloc_expr.
* class.c (set_rtti_entry): Fix for thunks.
* decl2.c (import_export_decl): Still emit typeinfo fns for
cv-variants of builtin types.
* rtti.c (expand_class_desc): Set up base_info_type_node here.
(init_rtti_processing): Instead of here.
Wed Apr 10 14:17:13 1996 Jason Merrill <jason@yorick.cygnus.com>
* rtti.c (init_rtti_processing): Do init regardless of -frtti.
(build_typeid): Only complain about taking dynamic typeid without
-frtti.
* decl2.c: flag_rtti defaults to 1.
* rtti.c (get_tinfo_var): The general class case is now smaller.
(init_rtti_processing): Pack the latter three fields of base_info
into 32 bits.
Wed Apr 10 13:50:14 1996 Mike Stump <mrs@cygnus.com>
* init.c (expand_member_init): Don't dump if name is NULL_TREE.
Wed Apr 10 12:56:02 1996 Mike Stump <mrs@cygnus.com>
* search.c (make_memoized_table_entry): Undefer the pop, if necessary.
(push_memoized_context): Split out code to undefer pop_type_level to
(clear_memoized_cache): here.
(pop_memoized_context): We can only handle one layer of deferral of
pop_type_level so clear the cache, if there was a previous level.
Tue Apr 9 23:06:09 1996 Jason Merrill <jason@yorick.cygnus.com>
* rtti.c (init_rtti_processing): Build up base_info_type_node.
(expand_class_desc): Use one pointer to an array of base_info
structs, passed using a CONSTRUCTOR.
Tue Apr 9 14:20:57 1996 Mike Stump <mrs@cygnus.com>
* class.c (build_vbase_path): Remove block extern for
flag_assume_nonnull_objects here.
(build_vfn_ref): Split out functionality into build_vtbl_ref.
(build_vtbl_ref): New routine.
(build_vtable): Set up rtti info here.
(add_virtual_function): Note in CLASSTYPE_RTTI the best
place where we can get the rtti pointers from to avoid having to
search around for a place.
(finish_base_struct): Ditto.
(finish_struct_1): Ditto. Never create totally new vtables with totally
new vtable pointers for rtti. Disable code to layout vtable pointers
better until we want to break binary compatibility.
* rtti.c (build_headof_sub): New routine to convert down to a
sub-object that has an rtti pointer in the vtable.
(build_headof): Use it. Also, use build_vtbl_ref now to be more
maintainable.
(build_dynamic_cast): Make sure we have saved it, if we need to.
* search.c (dfs_init_vbase_pointers): Disable code that deals with
a more efficient vtable layout, enable later.
* call.c (flag_assume_nonnull_objects): Moved declaration to
* cp-tree.h: here. Declare build_vtbl_ref.
* pt.c (instantiate_class_template): Use NULL_TREE instead of 0 in
function calls that want a tree.
Tue Apr 9 12:10:26 1996 Jason Merrill <jason@yorick.cygnus.com>
* rtti.c (build_dynamic_cast): Handle downcasting to X* given
other X subobjects in the most derived type. Ack.
* rtti.c (build_dynamic_cast): No need to strip cv-quals here,
get_typeid will do it for us.
(get_typeid_1): Break out call-building for expand_*_desc to use.
(get_typeid): Call it.
(expand_*_desc): Ditto.
* decl.c (init_decl_processing): Don't set TYPE_BUILT_IN on char *
and void *.
(init_decl_processing): Lose builtin_type_tdescs lossage.
* decl2.c (finish_vtable_vardecl): Remove obsolete code.
Mon Apr 8 17:23:23 1996 Bob Manson <manson@charmed.cygnus.com>
* pt.c (tsubst): When calling set_nested_typename, use
TYPE_NESTED_NAME (current_class_type) instead of
current_class_name.
* decl.c (pushdecl): Ditto.
(pushdecl_class_level): Ditto.
(grokdeclarator): Use NULL_TREE instead of 0 in the call to
set_nested_typename.
Sun Apr 7 10:44:31 1996 Jason Merrill <jason@yorick.cygnus.com>
* rtti.c (synthesize_tinfo_fn): Handle arrays.
* cp-tree.h (DECL_REALLY_EXTERN): New macro.
Sat Apr 6 13:56:27 1996 Jason Merrill <jason@yorick.cygnus.com>
* rtti.c (throw_bad_cast): Use entry point __throw_bad_cast.
(init_rtti_processing): Lose bad_cast_type.
(build_dynamic_cast): Use throw_bad_cast.
* rtti.c (synthesize_tinfo_fn): Handle enums and pmfs.
* decl2.c (finish_file): Don't synthesize artificial functions
that are external and not inline.
* rtti.c (get_tinfo_fn): If at_eof, call import_export_decl.
* decl2.c (finish_file): Handle having new inlines added to
saved_inlines by synthesis.
* rtti.c (get_bad_cast_node): Don't require <typeinfo>.
Fri Apr 5 17:02:09 1996 Jason Merrill <jason@yorick.cygnus.com>
RTTI rewrite to initialize nodes as needed, not require that
users #include <typeinfo>, complete functionality and reduce wasted
space.
* rtti.c (init_rtti_processing): New fn.
(build_typeid): The vtable entry is now a function.
(get_tinfo_var): New fn.
(get_tinfo_fn): Ditto.
(get_typeid): Use it.
(build_dynamic_cast): Declare and use entry point __dynamic_cast.
(build_*_desc): Rename to expand_*_desc and rewrite to use entry
points __rtti_*.
(add_uninstantiated_desc, get_def_to_follow, build_t_desc): Lose.
(synthesize_tinfo_fn): New fn.
* method.c (build_t_desc_overload): Lose.
(build_overload_with_type): More generic.
* decl.c (init_decl_processing): Call init_rtti_processing.
* class.c (set_rtti_entry): Use get_tinfo_fn.
* decl2.c (mark_vtable_entries): Mark the rtti function.
(finish_prevtable_vardecl): Don't build_t_desc.
(import_export_decl): Handle tinfo functions.
(finish_file): Ditto.
* typeck.c (inline_conversion): New fn.
(build_function_call_real): Use it.
* cp-tree.h: Add decls.
* method.c (hack_identifier): Also convert component_refs from
references.
* lex.c (cons_up_default_function): Use the type, not the name, in
declspecs.
* decl2.c (import_export_vtable): Fix weak vtables.
Fri Apr 5 13:30:17 1996 Bob Manson <manson@charmed.cygnus.com>
* search.c (get_base_distance_recursive): Fix access checks for
protected bases.
Fri Apr 5 11:02:06 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* call.c (unary_complex_lvalue): Delete unneeded decl, it's in
cp-tree.h.
(convert_harshness): Add prototypes wrapped by PROTO.
* decl2.c (grok_function_init): Likewise.
(do_toplevel_using_decl): Change to void return type.
* class.c (build_vtable_entry): Remove decl of make_thunk.
(merge_overrides): Fix order of arg definitions.
(finish_vtbls): Likewise.
(fixup_vtable_deltas): Likewise.
(modify_all_direct_vtables): Likewise.
(modify_all_indirect_vtables): Likewise.
* search.c (get_base_distance_recursive): Likewise.
(get_abstract_virtuals_1): Likewise.
(fixup_virtual_upcast_offsets): Likewise.
(lookup_fnfields_1): Add prototypes wrapped by PROTO.
* init.c (perform_member_init): Fix order of arg definitions.
(expand_aggr_init_1): Add prototypes wrapped by PROTO.
* cp-tree.h (make_thunk): Add decl.
(overload_template_name, push_template_decl): Add decls.
(do_toplevel_using_decl): Change to void return type.
(vec_binfo_member): Add decl.
Thu Apr 4 13:33:10 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* typeck.c (mark_addressable, convert_for_assignment,
......
......@@ -38,15 +38,11 @@ Boston, MA 02111-1307, USA. */
extern void sorry ();
extern int inhibit_warnings;
extern int flag_assume_nonnull_objects;
extern tree ctor_label, dtor_label;
/* From typeck.c: */
extern tree unary_complex_lvalue ();
/* Compute the ease with which a conversion can be performed
between an expected and the given type. */
static struct harshness_code convert_harshness ();
static struct harshness_code convert_harshness PROTO((register tree, register tree, tree));
#define EVIL_RETURN(ARG) ((ARG).code = EVIL_CODE, (ARG))
#define STD_RETURN(ARG) ((ARG).code = STD_CODE, (ARG))
......
......@@ -1403,6 +1403,9 @@ extern int flag_new_for_scope;
#define DECL_NOT_REALLY_EXTERN(NODE) \
(DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
#define DECL_REALLY_EXTERN(NODE) \
(DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
#define DECL_PUBLIC(NODE) \
(TREE_CODE (NODE) == FUNCTION_DECL \
? ! DECL_C_STATIC (NODE) : TREE_PUBLIC (NODE))
......@@ -1947,6 +1950,7 @@ extern char *dont_allow_type_definitions;
extern tree build_vbase_pointer PROTO((tree, tree));
extern tree build_vbase_path PROTO((enum tree_code, tree, tree, tree, int));
extern tree build_vtable_entry PROTO((tree, tree));
extern tree build_vtbl_ref PROTO((tree, tree));
extern tree build_vfn_ref PROTO((tree *, tree, tree));
extern void add_method PROTO((tree, tree *, tree));
extern tree get_vfield_offset PROTO((tree));
......@@ -2074,6 +2078,8 @@ extern void pop_cp_function_context PROTO((tree));
extern void grok_op_properties PROTO((tree, int, int));
/* in decl2.c */
extern int flag_assume_nonnull_objects;
extern int lang_decode_option PROTO((char *));
extern tree grok_method_quals PROTO((tree, tree, tree));
extern void grokclassfn PROTO((tree, tree, tree, enum overload_flags, tree));
......@@ -2112,7 +2118,7 @@ extern tree reparse_decl_as_expr PROTO((tree, tree));
extern tree finish_decl_parsing PROTO((tree));
extern tree lookup_name_nonclass PROTO((tree));
extern tree check_cp_case_value PROTO((tree));
extern tree do_toplevel_using_decl PROTO((tree));
extern void do_toplevel_using_decl PROTO((tree));
extern tree do_class_using_decl PROTO((tree));
extern tree current_namespace_id PROTO((tree));
extern tree get_namespace_id PROTO((void));
......@@ -2152,10 +2158,7 @@ extern void init_repo PROTO((char*));
extern void finish_repo PROTO((void));
/* in rtti.c */
extern tree build_classof PROTO((tree));
extern tree build_t_desc PROTO((tree, int));
extern tree build_i_desc PROTO((tree));
extern tree build_m_desc PROTO((tree));
extern tree get_tinfo_fn PROTO((tree));
extern tree build_typeid PROTO((tree));
extern tree get_typeid PROTO((tree));
extern tree build_dynamic_cast PROTO((tree, tree));
......@@ -2269,7 +2272,7 @@ extern tree build_static_name PROTO((tree, tree));
extern tree cplus_exception_name PROTO((tree));
extern tree build_decl_overload PROTO((tree, tree, int));
extern tree build_typename_overload PROTO((tree));
extern tree build_t_desc_overload PROTO((tree));
extern tree build_overload_with_type PROTO((tree, tree));
extern void declare_overloaded PROTO((tree));
#ifdef NO_AUTO_OVERLOAD
extern int is_overloaded PROTO((tree));
......@@ -2277,6 +2280,7 @@ extern int is_overloaded PROTO((tree));
extern tree build_opfncall PROTO((enum tree_code, int, tree, tree, tree));
extern tree hack_identifier PROTO((tree, tree));
extern tree build_component_type_expr PROTO((tree, tree, tree, int));
extern tree make_thunk PROTO((tree, int));
extern void synthesize_method PROTO((tree));
/* in pt.c */
......@@ -2288,10 +2292,12 @@ extern void begin_template_parm_list PROTO((void));
extern tree process_template_parm PROTO((tree, tree));
extern tree end_template_parm_list PROTO((tree));
extern void end_template_decl PROTO((void));
extern void push_template_decl PROTO((tree));
extern tree lookup_template_class PROTO((tree, tree, tree));
extern int uses_template_parms PROTO((tree));
extern tree instantiate_class_template PROTO((tree));
extern tree instantiate_template PROTO((tree, tree *));
extern void overload_template_name PROTO((tree));
extern int type_unification PROTO((tree, tree *, tree, tree, int *, int));
struct tinst_level *tinst_for_decl PROTO((void));
extern void mark_decl_instantiated PROTO((tree, int));
......@@ -2402,6 +2408,7 @@ extern tree build_unsave_expr PROTO((tree));
extern tree unsave_expr PROTO((tree));
extern int cp_expand_decl_cleanup PROTO((tree, tree));
extern tree get_type_decl PROTO((tree));
extern tree vec_binfo_member PROTO((tree, tree));
extern tree hack_decl_function_context PROTO((tree));
/* in typeck.c */
......@@ -2428,6 +2435,7 @@ extern tree expr_sizeof PROTO((tree));
extern tree c_sizeof PROTO((tree));
extern tree c_sizeof_nowarn PROTO((tree));
extern tree c_alignof PROTO((tree));
extern tree inline_conversion PROTO((tree));
extern tree decay_conversion PROTO((tree));
extern tree default_conversion PROTO((tree));
extern tree build_object_ref PROTO((tree, tree, tree));
......
......@@ -3164,7 +3164,7 @@ pushdecl (x)
Any artificial decls that need DECL_NESTED_TYPENAME will have it
set in pushtag. */
if (! DECL_NESTED_TYPENAME (x) && ! DECL_ARTIFICIAL (x))
set_nested_typename (x, current_class_name, DECL_NAME (x), type);
set_nested_typename (x, current_class_type != NULL_TREE ? TYPE_NESTED_NAME (current_class_type) : current_class_name, DECL_NAME (x), type);
if (type != error_mark_node
&& TYPE_NAME (type)
......@@ -3491,7 +3491,7 @@ pushdecl_class_level (x)
Any artificial decls that need DECL_NESTED_TYPENAME will have it
set in pushtag. */
if (! DECL_NESTED_TYPENAME (x) && ! DECL_ARTIFICIAL (x))
set_nested_typename (x, current_class_name, name, TREE_TYPE (x));
set_nested_typename (x, current_class_type != NULL_TREE ? TYPE_NESTED_NAME (current_class_type) : current_class_name, name, TREE_TYPE (x));
}
}
return x;
......@@ -4655,32 +4655,6 @@ record_builtin_type (rid_index, name, type)
set_identifier_type_value (rname, NULL_TREE);
}
}
if (flag_rtti)
{
if (builtin_type_tdescs_len+5 >= builtin_type_tdescs_max)
{
builtin_type_tdescs_max *= 2;
builtin_type_tdescs_arr
= (tree *)xrealloc (builtin_type_tdescs_arr,
builtin_type_tdescs_max * sizeof (tree));
}
builtin_type_tdescs_arr[builtin_type_tdescs_len++] = type;
if (TREE_CODE (type) != POINTER_TYPE)
{
builtin_type_tdescs_arr[builtin_type_tdescs_len++]
= build_pointer_type (type);
builtin_type_tdescs_arr[builtin_type_tdescs_len++]
= build_pointer_type (build_type_variant (type, 1, 0));
}
if (TREE_CODE (type) != VOID_TYPE)
{
builtin_type_tdescs_arr[builtin_type_tdescs_len++]
= build_reference_type (type);
builtin_type_tdescs_arr[builtin_type_tdescs_len++]
= build_reference_type (build_type_variant (type, 1, 0));
}
}
}
/* Push overloaded decl, in global scope, with one argument so it
......@@ -4695,7 +4669,8 @@ push_overloaded_decl_1 (x)
#ifdef __GNUC__
__inline
#endif
tree auto_function (name, type, code)
tree
auto_function (name, type, code)
tree name, type;
enum built_in_function code;
{
......@@ -4772,11 +4747,6 @@ init_decl_processing ()
#endif
gcc_obstack_init (&decl_obstack);
if (flag_rtti)
{
builtin_type_tdescs_max = 100;
builtin_type_tdescs_arr = (tree *)xmalloc (100 * sizeof (tree));
}
/* Must lay these out before anything else gets laid out. */
error_mark_node = make_node (ERROR_MARK);
......@@ -4944,7 +4914,9 @@ init_decl_processing ()
string_type_node = build_pointer_type (char_type_node);
const_string_type_node =
build_pointer_type (build_type_variant (char_type_node, 1, 0));
#if 0
record_builtin_type (RID_MAX, NULL_PTR, string_type_node);
#endif
/* Make a type to be the domain of a few array types
whose domains don't really matter.
......@@ -4972,7 +4944,9 @@ init_decl_processing ()
ptr_type_node = build_pointer_type (void_type_node);
const_ptr_type_node =
build_pointer_type (build_type_variant (void_type_node, 1, 0));
#if 0
record_builtin_type (RID_MAX, NULL_PTR, ptr_type_node);
#endif
endlink = void_list_node;
int_endlink = tree_cons (NULL_TREE, integer_type_node, endlink);
double_endlink = tree_cons (NULL_TREE, double_type_node, endlink);
......@@ -5471,17 +5445,6 @@ init_decl_processing ()
finish_builtin_type (__m_desc_type_node, "__m_desc", fields, 7,
integer_type_node);
}
if (flag_rtti)
{
int i = builtin_type_tdescs_len;
while (i > 0)
{
tree tdesc = build_t_desc (builtin_type_tdescs_arr[--i], 0);
TREE_ASM_WRITTEN (tdesc) = 1;
TREE_PUBLIC (TREE_OPERAND (tdesc, 0)) = 1;
}
}
#endif /*flag_rtti*/
/* Now, C++. */
......@@ -5517,6 +5480,7 @@ init_decl_processing ()
init_class_processing ();
init_init_processing ();
init_search_processing ();
init_rtti_processing ();
if (flag_handle_exceptions)
init_exception_processing ();
......@@ -9029,7 +8993,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
tree d = TYPE_NAME (type), c = DECL_CONTEXT (d);
if (!c)
set_nested_typename (d, 0, declarator, type);
set_nested_typename (d, NULL_TREE, declarator, type);
else if (TREE_CODE (c) == FUNCTION_DECL)
set_nested_typename (d, DECL_ASSEMBLER_NAME (c),
declarator, type);
......
......@@ -39,7 +39,7 @@ Boston, MA 02111-1307, USA. */
extern tree get_file_function_name ();
extern tree cleanups_this_call;
static void grok_function_init ();
static void grok_function_init PROTO((tree, tree));
void import_export_decl ();
extern int current_class_depth;
......@@ -318,7 +318,7 @@ int flag_int_enum_equivalence;
/* Controls whether compiler generates 'type descriptor' that give
run-time type information. */
int flag_rtti;
int flag_rtti = 1;
/* Nonzero if we wish to output cross-referencing information
for the GNU class browser. */
......@@ -2430,6 +2430,14 @@ mark_vtable_entries (decl)
{
tree entries = CONSTRUCTOR_ELTS (DECL_INITIAL (decl));
if (flag_rtti)
{
tree fnaddr = (flag_vtable_thunks ? TREE_VALUE (TREE_CHAIN (entries))
: FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (entries)));
tree fn = TREE_OPERAND (fnaddr, 0);
TREE_ADDRESSABLE (fn) = 1;
mark_used (fn);
}
skip_rtti_stuff (&entries);
for (; entries; entries = TREE_CHAIN (entries))
......@@ -2500,7 +2508,10 @@ import_export_vtable (decl, type, final)
cp_error ("all virtual functions redeclared inline");
#endif
if (flag_weak)
DECL_WEAK (decl) = 1;
{
TREE_PUBLIC (decl) = 1;
DECL_WEAK (decl) = 1;
}
else
TREE_PUBLIC (decl) = 0;
DECL_EXTERNAL (decl) = 0;
......@@ -2557,21 +2568,6 @@ finish_prevtable_vardecl (prev, vars)
}
import_export_vtable (vars, ctype, 1);
/* We cannot use TREE_USED here, as it may be set by the expanding of a
ctor that is used to build a global object. The long term plan is to
make the TD entries statically initialized and move this to
finish_vtable_vardecl time. */
if (flag_rtti && write_virtuals >= 0
&& ! DECL_EXTERNAL (vars) && (TREE_PUBLIC (vars) || 1 || TREE_USED (vars)))
{
/* Kick out the type descriptor before we dump out global
initializers, as they are initialized at run time and
we have to find them when we scan for things that need initialized
at the top level. */
build_t_desc (ctype, 1);
}
return 1;
}
......@@ -2583,15 +2579,6 @@ finish_vtable_vardecl (prev, vars)
&& ! DECL_EXTERNAL (vars) && (TREE_PUBLIC (vars) || TREE_USED (vars))
&& ! TREE_ASM_WRITTEN (vars))
{
#if 0
/* The long term plan it to make the TD entries statically initialized,
have the entries built and emitted here. When that happens, this
can be enabled, and the other call to build_t_desc removed. */
/* Kick out the type descriptor before writing out the vtable. */
if (flag_rtti)
build_t_desc (DECL_CONTEXT (vars), 1);
#endif
/* Write it out. */
mark_vtable_entries (vars);
if (TREE_TYPE (DECL_INITIAL (vars)) == 0)
......@@ -2763,6 +2750,23 @@ import_export_decl (decl)
else
TREE_PUBLIC (decl) = 0;
}
/* tinfo function */
else if (DECL_ARTIFICIAL (decl) && DECL_MUTABLE_P (decl))
{
tree ctype = TREE_TYPE (DECL_NAME (decl));
if (IS_AGGR_TYPE (ctype) && CLASSTYPE_INTERFACE_KNOWN (ctype))
{
DECL_NOT_REALLY_EXTERN (decl)
= ! (CLASSTYPE_INTERFACE_ONLY (ctype)
|| (DECL_THIS_INLINE (decl) && ! flag_implement_inlines));
}
else if (TYPE_BUILT_IN (ctype) && ctype == TYPE_MAIN_VARIANT (ctype))
DECL_NOT_REALLY_EXTERN (decl) = 0;
else if (flag_weak)
DECL_WEAK (decl) = 1;
else
TREE_PUBLIC (decl) = 0;
}
else if (DECL_C_STATIC (decl))
TREE_PUBLIC (decl) = 0;
else if (flag_weak)
......@@ -3095,10 +3099,6 @@ finish_file ()
{
tree decl = TREE_VALUE (fnname);
import_export_decl (decl);
if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl)
&& TREE_PUBLIC (decl) && ! DECL_WEAK (decl)
&& DECL_NOT_REALLY_EXTERN (decl))
synthesize_method (decl);
}
/* Now write out inline functions which had their addresses taken and
......@@ -3126,14 +3126,21 @@ finish_file ()
tree decl = TREE_VALUE (*p);
if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl)
&& TREE_USED (decl))
&& TREE_USED (decl)
&& (! DECL_REALLY_EXTERN (decl) || DECL_INLINE (decl)))
{
synthesize_method (decl);
if (DECL_MUTABLE_P (decl))
synthesize_tinfo_fn (decl);
else
synthesize_method (decl);
reconsider = 1;
}
if (TREE_ASM_WRITTEN (decl)
|| (DECL_SAVED_INSNS (decl) == 0 && ! DECL_ARTIFICIAL (decl)))
if (decl != TREE_VALUE (*p))
;
else if (TREE_ASM_WRITTEN (decl)
|| (DECL_SAVED_INSNS (decl) == 0
&& ! DECL_ARTIFICIAL (decl)))
*p = TREE_CHAIN (*p);
else
p = &TREE_CHAIN (*p);
......@@ -3619,7 +3626,7 @@ do_namespace_alias (alias, namespace)
sorry ("namespace alias");
}
tree
void
do_toplevel_using_decl (decl)
tree decl;
{
......
......@@ -51,7 +51,7 @@ static void expand_aggr_vbase_init ();
void expand_member_init ();
void expand_aggr_init ();
static void expand_aggr_init_1 ();
static void expand_aggr_init_1 PROTO((tree, tree, tree, tree, int, int));
static void expand_virtual_init PROTO((tree, tree));
tree expand_vec_init ();
......@@ -152,8 +152,9 @@ expand_direct_vtbls_init (real_binfo, binfo, init_self, can_elide, addr)
/* Subroutine of emit_base_init. */
static void
perform_member_init (member, name, init, explicit, protect_list)
tree member, name, init, *protect_list;
tree member, name, init;
int explicit;
tree *protect_list;
{
tree decl;
tree type = TREE_TYPE (member);
......@@ -941,7 +942,7 @@ expand_member_init (exp, name, init)
type = TYPE_MAIN_VARIANT (TREE_TYPE (exp));
if (TREE_CODE (name) == TYPE_DECL)
if (name && TREE_CODE (name) == TYPE_DECL)
{
basetype = TREE_TYPE (name);
name = DECL_NAME (name);
......@@ -2827,8 +2828,9 @@ build_new (placement, decl, init, use_global_new)
not expanded as part of the RTL_EXPR for the initialization,
so we can't just use save_expr here. */
alloc_temp = get_temp_name (TREE_TYPE (rval), 0);
alloc_expr = build (MODIFY_EXPR, TREE_TYPE (rval), alloc_temp, rval);
alloc_temp = build (VAR_DECL, TREE_TYPE (rval));
layout_decl (alloc_temp, 0);
alloc_expr = build (TARGET_EXPR, TREE_TYPE (rval), alloc_temp, rval, 0);
TREE_SIDE_EFFECTS (alloc_expr) = 1;
rval = alloc_temp;
}
......
......@@ -1650,7 +1650,7 @@ cons_up_default_function (type, full_name, kind)
/* Fall through... */
case 6:
retref = 1;
declspecs = build_decl_list (NULL_TREE, full_name);
declspecs = build_decl_list (NULL_TREE, type);
name = ansi_opname [(int) MODIFY_EXPR];
......
......@@ -1073,49 +1073,14 @@ build_typename_overload (type)
return id;
}
#ifndef NO_DOLLAR_IN_LABEL
#define T_DESC_FORMAT "TD$"
#define I_DESC_FORMAT "ID$"
#define M_DESC_FORMAT "MD$"
#else
#if !defined(NO_DOT_IN_LABEL)
#define T_DESC_FORMAT "TD."
#define I_DESC_FORMAT "ID."
#define M_DESC_FORMAT "MD."
#else
#define T_DESC_FORMAT "__t_desc_"
#define I_DESC_FORMAT "__i_desc_"
#define M_DESC_FORMAT "__m_desc_"
#endif
#endif
/* Build an overload name for the type expression TYPE. */
tree
build_t_desc_overload (type)
tree type;
build_overload_with_type (name, type)
tree name, type;
{
OB_INIT ();
OB_PUTS (T_DESC_FORMAT);
OB_PUTID (name);
nofold = 1;
#if 0
/* Use a different format if the type isn't defined yet. */
if (TYPE_SIZE (type) == NULL_TREE)
{
char *p;
int changed;
for (p = tname; *p; p++)
if (isupper (*p))
{
changed = 1;
*p = tolower (*p);
}
/* If there's no change, we have an inappropriate T_DESC_FORMAT. */
my_friendly_assert (changed != 0, 249);
}
#endif
build_overload_name (type, 0, 1);
return get_identifier (obstack_base (&scratch_obstack));
}
......@@ -1580,10 +1545,9 @@ hack_identifier (value, name)
this field was initialized by a base initializer,
we can emit an error message. */
TREE_USED (value) = 1;
return build_component_ref (C_C_D, name, 0, 1);
value = build_component_ref (C_C_D, name, 0, 1);
}
if (really_overloaded_fn (value))
else if (really_overloaded_fn (value))
{
#if 0
tree t = get_first_fn (value);
......@@ -1668,12 +1632,7 @@ hack_identifier (value, name)
}
if (TREE_CODE (type) == REFERENCE_TYPE && ! current_template_parms)
{
my_friendly_assert (TREE_CODE (value) == VAR_DECL
|| TREE_CODE (value) == PARM_DECL
|| TREE_CODE (value) == RESULT_DECL, 252);
return convert_from_reference (value);
}
value = convert_from_reference (value);
return value;
}
......
......@@ -1185,7 +1185,7 @@ instantiate_class_template (type)
require_complete_type (tmp);
/* XXX handle attributes */
type = finish_struct_1 (type, 0, 0);
type = finish_struct_1 (type, NULL_TREE, 0);
}
else
{
......@@ -1578,7 +1578,7 @@ tsubst (t, args, nargs, in_decl)
tree r = copy_node (t);
TREE_TYPE (r) = type;
DECL_CONTEXT (r) = current_class_type;
set_nested_typename (r, current_class_name, DECL_NAME (r), type);
set_nested_typename (r, current_class_type != NULL_TREE ? TYPE_NESTED_NAME (current_class_type) : current_class_name, DECL_NAME (r), type);
TREE_CHAIN (r) = NULL_TREE;
return r;
}
......
......@@ -74,7 +74,7 @@ pop_stack_level (stack)
static struct search_level *search_stack;
static tree lookup_field_1 ();
static int lookup_fnfields_1 ();
static int lookup_fnfields_1 PROTO((tree, tree));
static void dfs_walk ();
static int markedp ();
static void dfs_unmark ();
......@@ -246,6 +246,18 @@ my_new_memoized_entry (chain)
return p;
}
/* Clears the deferred pop from pop_memoized_context, if any. */
static void
clear_memoized_cache ()
{
if (prev_type_stack)
{
type_stack = pop_type_level (prev_type_stack);
prev_type_memoized = 0;
prev_type_stack = 0;
}
}
/* Make an entry in the memoized table for type TYPE
that the entry for NAME is FIELD. */
......@@ -257,6 +269,10 @@ make_memoized_table_entry (type, name, function_p)
int index = MEMOIZED_HASH_FN (name);
tree entry, *prev_entry;
/* Since we allocate from the type_obstack, we must pop any deferred
levels. */
clear_memoized_cache ();
memoized_adds[function_p] += 1;
if (CLASSTYPE_MTABLE_ENTRY (type) == 0)
{
......@@ -334,9 +350,7 @@ push_memoized_context (type, use_old)
return;
}
/* Otherwise, need to pop old stack here. */
type_stack = pop_type_level (prev_type_stack);
prev_type_memoized = 0;
prev_type_stack = 0;
clear_memoized_cache ();
}
type_stack = push_type_level ((struct stack_level *)type_stack,
......@@ -364,6 +378,9 @@ pop_memoized_context (use_old)
while (len--)
tem[len*2+1] = (tree)CLASSTYPE_MTABLE_ENTRY (tem[len*2]);
/* If there was a deferred pop, we need to pop it now. */
clear_memoized_cache ();
prev_type_stack = type_stack;
prev_type_memoized = type_stack->type;
}
......@@ -494,14 +511,23 @@ get_binfo (parent, binfo, protect)
static int
get_base_distance_recursive (binfo, depth, is_private, rval,
rval_private_ptr, new_binfo_ptr, parent, path_ptr,
protect, via_virtual_ptr, via_virtual)
tree binfo, *new_binfo_ptr, parent, *path_ptr;
int *rval_private_ptr, depth, is_private, rval, protect, *via_virtual_ptr,
via_virtual;
protect, via_virtual_ptr, via_virtual,
current_scope_in_chain)
tree binfo;
int depth, is_private, rval;
int *rval_private_ptr;
tree *new_binfo_ptr, parent, *path_ptr;
int protect, *via_virtual_ptr, via_virtual;
int current_scope_in_chain;
{
tree binfos;
int i, n_baselinks;
if (protect
&& !current_scope_in_chain
&& is_friend (BINFO_TYPE (binfo), current_scope ()))
current_scope_in_chain = 1;
if (BINFO_TYPE (binfo) == parent || binfo == parent)
{
if (rval == -1)
......@@ -556,6 +582,8 @@ get_base_distance_recursive (binfo, depth, is_private, rval,
= (protect
&& (is_private
|| (!TREE_VIA_PUBLIC (base_binfo)
&& !(TREE_VIA_PROTECTED (base_binfo)
&& current_scope_in_chain)
&& !is_friend (BINFO_TYPE (binfo), current_scope ()))));
int this_virtual = via_virtual || TREE_VIA_VIRTUAL (base_binfo);
int was;
......@@ -572,7 +600,8 @@ get_base_distance_recursive (binfo, depth, is_private, rval,
rval, rval_private_ptr,
new_binfo_ptr, parent, path_ptr,
protect, via_virtual_ptr,
this_virtual);
this_virtual,
current_scope_in_chain);
/* watch for updates; only update if path is good. */
if (path_ptr && WATCH_VALUES (rval, *via_virtual_ptr) != was)
BINFO_INHERITANCE_CHAIN (base_binfo) = binfo;
......@@ -652,7 +681,8 @@ get_base_distance (parent, binfo, protect, path_ptr)
rval = get_base_distance_recursive (binfo, 0, 0, -1,
&rval_private, &new_binfo, parent,
path_ptr, watch_access, &via_virtual, 0);
path_ptr, watch_access, &via_virtual, 0,
0);
dfs_walk (binfo, dfs_unmark, markedp);
......@@ -2106,8 +2136,9 @@ get_matching_virtual (binfo, fndecl, dtorp)
expand_direct_vtbls_init for the style of search we do. */
static tree
get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals)
tree binfo, abstract_virtuals;
tree binfo;
int do_self;
tree abstract_virtuals;
{
tree binfos = BINFO_BASETYPES (binfo);
int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
......@@ -2559,12 +2590,12 @@ dfs_init_vbase_pointers (binfo)
CLEAR_BINFO_VTABLE_PATH_MARKED (binfo);
/* If there is a rtti, it is the first field, though perhaps from
the base class. Otherwise, the first fields are virtual base class
pointer fields. */
if (CLASSTYPE_RTTI (type) && VFIELD_NAME_P (DECL_NAME (fields)))
/* Get past vtable for the object. */
#if 0
/* See finish_struct_1 for when we can enable this. */
/* If we have a vtable pointer first, skip it. */
if (VFIELD_NAME_P (DECL_NAME (fields)))
fields = TREE_CHAIN (fields);
#endif
if (fields == NULL_TREE
|| DECL_NAME (fields) == NULL_TREE
......@@ -2736,6 +2767,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
DECL_ALIGN (nvtbl) = MAX (TYPE_ALIGN (double_type_node),
DECL_ALIGN (nvtbl));
TREE_READONLY (nvtbl) = 0;
DECL_ARTIFICIAL (nvtbl) = 1;
nvtbl = pushdecl (nvtbl);
init = NULL_TREE;
cp_finish_decl (nvtbl, init, NULL_TREE, 0, LOOKUP_ONLYCONVERTING);
......@@ -2796,8 +2828,9 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
expand_direct_vtbls_init. */
static void
fixup_virtual_upcast_offsets (real_binfo, binfo, init_self, can_elide, addr, orig_addr, type, vbase, vbase_offsets)
tree real_binfo, binfo, addr, orig_addr, type, vbase, *vbase_offsets;
tree real_binfo, binfo;
int init_self, can_elide;
tree addr, orig_addr, type, vbase, *vbase_offsets;
{
tree real_binfos = BINFO_BASETYPES (real_binfo);
tree binfos = BINFO_BASETYPES (binfo);
......
......@@ -1572,6 +1572,22 @@ default_conversion (exp)
return exp;
}
/* Take the address of an inline function without setting TREE_ADDRESSABLE
or TREE_USED. */
tree
inline_conversion (exp)
tree exp;
{
if (TREE_CODE (exp) == FUNCTION_DECL)
{
tree type = build_type_variant
(TREE_TYPE (exp), TREE_READONLY (exp), TREE_THIS_VOLATILE (exp));
exp = build1 (ADDR_EXPR, build_pointer_type (type), exp);
}
return exp;
}
tree
build_object_ref (datum, basetype, field)
......@@ -2489,11 +2505,6 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
{
aref = save_expr (aref);
/* Save the intermediate result in a SAVE_EXPR so we don't have to
compute each component of the virtual function pointer twice. */
if (TREE_CODE (aref) == INDIRECT_REF)
TREE_OPERAND (aref, 0) = save_expr (TREE_OPERAND (aref, 0));
delta = build_binary_op (PLUS_EXPR,
build_conditional_expr (e1, build_component_ref (aref, delta_identifier, 0, 0), integer_zero_node),
delta, 1);
......@@ -2575,10 +2586,7 @@ build_function_call_real (function, params, require_complete, flags)
&& current_function_decl)
synthesize_method (function);
fntype = build_type_variant (TREE_TYPE (function),
TREE_READONLY (function),
TREE_THIS_VOLATILE (function));
function = build1 (ADDR_EXPR, build_pointer_type (fntype), function);
function = inline_conversion (function);
}
else
function = default_conversion (function);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment