Commit d2e5ee5c by Mike Stump

90th Cygnus<->FSF quick merge

From-SVN: r13321
parent f442f723
Mon Dec 16 22:43:31 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* cp-tree.h (ptr_reasonably_similar): Add decl.
Thu Dec 12 15:00:35 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* decl.c (grokvardecl): Change SPECBITS parm to be the SPECBITS_IN
pointer. New local SPECBITS with the parm's value.
(grokdeclarator): Pass &specbits down.
* parse.y (expr_no_commas): Make sure $$ is not an error_mark_node
before we try to do C_SET_EXP_ORIGINAL_CODE on it.
* search.c (envelope_add_decl): Check that the CLASSTYPE_CID of
CONTEXT is not 0 before we try to use TYPE_DERIVES_FROM.
* decl.c (cplus_expand_expr_stmt): Only expand the expr if EXP is
not an error_mark_node.
Sat Dec 7 17:20:22 1996 Jason Merrill <jason@yorick.cygnus.com>
* cp-tree.h (TYPE_MAIN_DECL): Use TYPE_STUB_DECL.
* *.c: Use TYPE_MAIN_DECL instead of TYPE_NAME where appropriate.
Fri Dec 6 14:40:09 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): When giving an anonymous struct a name,
replace TYPE_NAME instead of TYPE_IDENTIFIER (so TYPE_STUB_DECL is
not affected).
* typeck2.c (build_m_component_ref): If component is a pointer
to data member, resolve the OFFSET_REF now.
* call.c (convert_like): Don't go into infinite recursion.
* pt.c (coerce_template_parms): Use tsubst_expr for non-type args.
* class.c (finish_struct_1): Set DECL_ARTIFICIAL on the vptr.
* tree.c (layout_basetypes): And on the vbase ptr.
Thu Dec 5 02:11:28 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (BOOL_TYPE_SIZE): Define in terms of POINTER_SIZE or
CHAR_TYPE_SIZE so bool is always the same size as another type.
* decl.c (pushtag): Set DECL_IGNORED_P for DWARF, too.
Tue Dec 3 23:18:37 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (grok_x_components): Remove synthesized methods from
TYPE_METHODS of an anonymous union, complain about member
functions.
* decl.c (shadow_tag): Wipe out memory of synthesized methods in
anonymous unions.
(finish_function): Just clear the DECL_RTL of our arguments.
Fri Nov 29 21:54:17 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (finish_file): Emit DWARF debugging info for static data
members.
* pt.c (tsubst): If t is a stub decl, return the stub decl for type.
Wed Nov 27 14:47:15 1996 Bob Manson <manson@charmed.cygnus.com>
* typeck.c (build_component_ref): Don't die if COMPONENT isn't a
IDENTIFIER_NODE.
Wed Nov 27 16:05:19 1996 Michael Meissner <meissner@tiktok.cygnus.com>
* Make-lang.in (g++-cross$(exeext)): Fix typo.
Wed Nov 27 08:14:00 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
Make the g++ driver now be a standalone program, rather than one
that tries to run the gcc driver after munging up the options.
* Make-lang.in (g++.c, g++spec.o): New rules.
(g++.o): New rule, based on gcc.o with -DLANG_SPECIFIC_DRIVER
added.
(g++$(exeext)): New rule, based on xgcc rule.
(g++-cross$(exeext)): Now just copies g++$(exeext) over.
* g++spec.c: New file.
* g++.c: Removed file.
Tue Nov 26 19:01:09 1996 Mike Stump <mrs@cygnus.com>
* cvt.c (build_up_reference): Arrange for any temporary values
that have been keep in registers until now to be put into memory.
Mon Nov 25 15:16:41 1996 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Make-lang.in (c++.stage[1234]): Depend upon stage[1-4]-start, so
......@@ -12,8 +101,6 @@ Thu Nov 21 16:30:24 1996 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (c_expand_return): Fix logic.
(unary_complex_lvalue): Avoid unused warning on address of INIT_EXPR.
* decl.c (grokfndecl): Also note_debug_info_needed on ctype here.
Wed Nov 20 18:47:31 1996 Bob Manson <manson@charmed.cygnus.com>
* g++.c (main): Make sure arglist has a final NULL entry. Add
......@@ -186,20 +273,10 @@ Mon Nov 11 13:20:34 1996 Bob Manson <manson@charmed.cygnus.com>
Fri Nov 8 17:38:44 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (finish_file): Don't emit debug info.
* decl.c (start_function): Call note_debug_info_needed for context.
(start_decl): Likewise.
(cp_finish_decl): Not here.
(finish_function): Or here.
(pushdecl): Lose obsolete code.
* decl.c (pushdecl): Lose obsolete code.
(grokdeclarator): Still do the long long thing after complaining.
(finish_enum): Don't call rest_of_type_compilation
for DWARF.
* class.c (finish_struct_1): Don't call rest_of_type_compilation
for DWARF.
* search.c (dfs_debug_mark): For DWARF, just call
rest_of_type_compilation.
(note_debug_info_needed): Don't do anything if we're in a template.
* parse.y (named_complex_class_head_sans_basetype): Likewise.
* search.c (note_debug_info_needed): Don't do anything if we're in a
template.
* method.c (synthesize_method): For non-local classes,
push_to_top_level first.
......
......@@ -71,14 +71,32 @@ C++ c++: cc1plus
# Tell GNU make to ignore these if they exist.
.PHONY: C++ c++
g++.c: $(srcdir)/gcc.c
-rm -f $@
ln -s $(srcdir)/gcc.c $@ || cp $(srcdir)/gcc.c $@
g++spec.o: $(srcdir)/cp/g++spec.c
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
# N.B.: This is a copy of the gcc.o rule, with -DLANG_SPECIFIC_DRIVER added.
# It'd be nice if we could find an easier way to do this---rather than have
# to track changes to the toplevel gcc Makefile as well.
# We depend on g++.c last, to make it obvious where it came from.
g++.o: $(CONFIG_H) multilib.h config.status $(lang_specs_files) g++.c
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(DRIVER_DEFINES) \
-DLANG_SPECIFIC_DRIVER \
-c g++.c
# Create the compiler driver for g++.
g++: $(srcdir)/cp/g++.c $(CONFIG_H) choose-temp.o pexecute.o $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o $@ $(srcdir)/cp/g++.c choose-temp.o pexecute.o $(LIBS)
g++$(exeext): g++.o g++spec.o version.o choose-temp.o pexecute.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ g++.o g++spec.o version.o \
choose-temp.o pexecute.o $(EXTRA_GCC_OBJS) $(LIBS)
# Create a version of the g++ driver which calls the cross-compiler.
g++-cross: $(srcdir)/cp/g++.c choose-temp.o pexecute.o $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o $@ \
-DGCC_NAME=\"$(GCC_CROSS_NAME)\" $(srcdir)/cp/g++.c choose-temp.o pexecute.o $(LIBS)
g++-cross$(exeext): g++$(exeext)
-rm -f g++-cross$(exeext)
cp g++$(exeext) g++-cross$(exeext)
cxxmain.o: cplus-dem.c demangle.h
rm -f cxxmain.c
......
......@@ -1281,7 +1281,7 @@ find_scoped_type (type, inner_name, inner_types)
if (TREE_PURPOSE (tags) == inner_name)
{
if (inner_types == NULL_TREE)
return TYPE_NAME (TREE_VALUE (tags));
return TYPE_MAIN_DECL (TREE_VALUE (tags));
return resolve_scope_to_name (TREE_VALUE (tags), inner_types);
}
tags = TREE_CHAIN (tags);
......@@ -1326,7 +1326,7 @@ resolve_scope_to_name (outer_type, inner_stuff)
if (rval != NULL_TREE)
return rval;
type = DECL_CONTEXT (TYPE_NAME (type));
type = DECL_CONTEXT (TYPE_MAIN_DECL (type));
}
}
......@@ -4240,6 +4240,7 @@ build_user_type_conversion_1 (totype, expr, flags)
cand = candidates; /* any one will do */
cand->second_conv = build1 (AMBIG_CONV, totype, expr);
ICS_USER_FLAG (cand->second_conv) = 1;
ICS_BAD_FLAG (cand->second_conv) = 1;
return cand;
}
......@@ -4821,7 +4822,9 @@ static tree
convert_like (convs, expr)
tree convs, expr;
{
if (ICS_BAD_FLAG (convs))
if (ICS_BAD_FLAG (convs)
&& TREE_CODE (convs) != USER_CONV
&& TREE_CODE (convs) != AMBIG_CONV)
{
tree t = convs;
for (; t; t = TREE_OPERAND (t, 0))
......
......@@ -1793,8 +1793,7 @@ finish_struct_bits (t, max_has_virtual)
&& CLASSTYPE_NON_AGGREGATE (t)))
{
tree variants;
if (TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)
DECL_MODE (TYPE_NAME (t)) = BLKmode;
DECL_MODE (TYPE_MAIN_DECL (t)) = BLKmode;
for (variants = t; variants; variants = TYPE_NEXT_VARIANT (variants))
{
TYPE_MODE (variants) = BLKmode;
......@@ -1997,7 +1996,7 @@ finish_struct_methods (t, fn_fields, nonprivate_method)
if (nonprivate_method == 0
&& CLASSTYPE_FRIEND_CLASSES (t) == NULL_TREE
&& DECL_FRIENDLIST (TYPE_NAME (t)) == NULL_TREE)
&& DECL_FRIENDLIST (TYPE_MAIN_DECL (t)) == NULL_TREE)
{
tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
for (i = 0; i < n_baseclasses; i++)
......@@ -2022,7 +2021,7 @@ finish_struct_methods (t, fn_fields, nonprivate_method)
TYPE_HAS_DESTRUCTOR (t) = 0;
else if (TREE_PRIVATE (dtor)
&& CLASSTYPE_FRIEND_CLASSES (t) == NULL_TREE
&& DECL_FRIENDLIST (TYPE_NAME (t)) == NULL_TREE
&& DECL_FRIENDLIST (TYPE_MAIN_DECL (t)) == NULL_TREE
&& warn_ctor_dtor_privacy)
cp_warning ("`%#T' only defines a private destructor and has no friends",
t);
......@@ -3644,7 +3643,7 @@ finish_struct_1 (t, warn_anon)
if (TYPE_HAS_CONSTRUCTOR (t)
&& CLASSTYPE_FRIEND_CLASSES (t) == NULL_TREE
&& DECL_FRIENDLIST (TYPE_NAME (t)) == NULL_TREE)
&& DECL_FRIENDLIST (TYPE_MAIN_DECL (t)) == NULL_TREE)
{
int nonprivate_ctor = 0;
tree ctor;
......@@ -3748,6 +3747,7 @@ finish_struct_1 (t, warn_anon)
DECL_ASSEMBLER_NAME (vfield) = get_identifier (VFIELD_BASE);
CLASSTYPE_VFIELD (t) = vfield;
DECL_VIRTUAL_P (vfield) = 1;
DECL_ARTIFICIAL (vfield) = 1;
DECL_FIELD_CONTEXT (vfield) = t;
DECL_CLASS_CONTEXT (vfield) = t;
DECL_FCONTEXT (vfield) = t;
......@@ -3861,8 +3861,7 @@ finish_struct_1 (t, warn_anon)
value for DECL_OFFSET, so that we can use it as part
of a COMPONENT_REF for multiple inheritance. */
if (TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)
layout_decl (TYPE_NAME (t), 0);
layout_decl (TYPE_MAIN_DECL (t), 0);
/* Now fix up any virtual base class types that we left lying
around. We must get these done before we try to lay out the
......@@ -4174,9 +4173,9 @@ finish_struct_1 (t, warn_anon)
{
/* Be smarter about nested classes here. If a type is nested,
only output it if we would output the enclosing type. */
if (DECL_CONTEXT (TYPE_NAME (t))
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (TYPE_NAME (t)))) == 't')
DECL_IGNORED_P (TYPE_NAME (t)) = TREE_ASM_WRITTEN (TYPE_NAME (t));
if (DECL_CONTEXT (TYPE_MAIN_DECL (t))
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (TYPE_MAIN_DECL (t)))) == 't')
DECL_IGNORED_P (TYPE_MAIN_DECL (t)) = TREE_ASM_WRITTEN (TYPE_MAIN_DECL (t));
}
#endif
......@@ -4199,24 +4198,24 @@ finish_struct_1 (t, warn_anon)
/* Don't output full info about any type
which does not have its implementation defined here. */
if (TYPE_VIRTUAL_P (t) && write_virtuals == 2)
TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t))
TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t))
= (value_member (TYPE_IDENTIFIER (t), pending_vtables) == 0);
else if (CLASSTYPE_INTERFACE_ONLY (t))
TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = 1;
TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
#if 0
/* XXX do something about this. */
else if (CLASSTYPE_INTERFACE_UNKNOWN (t))
/* Only a first approximation! */
TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = 1;
TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
#endif
}
else if (CLASSTYPE_INTERFACE_ONLY (t))
TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = 1;
/* Finish debugging output for this type. */
rest_of_type_compilation (t, toplevel_bindings_p ());
TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
}
/* Finish debugging output for this type. */
rest_of_type_compilation (t, toplevel_bindings_p ());
return t;
}
......@@ -4355,7 +4354,7 @@ finish_struct (t, list_of_fieldlists, attributes, warn_anon)
CLASSTYPE_TAGS (t) = x = nreverse (CLASSTYPE_TAGS (t));
while (x)
{
tree tag = TYPE_NAME (TREE_VALUE (x));
tree tag = TYPE_MAIN_DECL (TREE_VALUE (x));
TREE_NONLOCAL_FLAG (TREE_VALUE (x)) = 0;
x = TREE_CHAIN (x);
......@@ -4747,7 +4746,7 @@ push_nested_class (type, modify)
|| TREE_CODE (type) == TEMPLATE_TYPE_PARM)
return;
context = DECL_CONTEXT (TYPE_NAME (type));
context = DECL_CONTEXT (TYPE_MAIN_DECL (type));
if (context && TREE_CODE (context) == RECORD_TYPE)
push_nested_class (context, 2);
......@@ -4760,7 +4759,7 @@ void
pop_nested_class (modify)
int modify;
{
tree context = DECL_CONTEXT (TYPE_NAME (current_class_type));
tree context = DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type));
popclass (modify);
if (context && TREE_CODE (context) == RECORD_TYPE)
......
......@@ -312,7 +312,7 @@ enum languages { lang_c, lang_cplusplus };
#define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
/* The _DECL for this _TYPE. */
#define TYPE_MAIN_DECL(NODE) (TYPE_NAME (NODE))
#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
#define IS_AGGR_TYPE(t) (TYPE_LANG_FLAG_5 (t))
#define IS_AGGR_TYPE_CODE(t) (t == RECORD_TYPE || t == UNION_TYPE)
......@@ -2470,6 +2470,7 @@ extern tree convert_for_initialization PROTO((tree, tree, tree, int, char *, tr
extern void c_expand_asm_operands PROTO((tree, tree, tree, tree, int, char *, int));
extern void c_expand_return PROTO((tree));
extern tree c_expand_start_case PROTO((tree));
extern int ptr_reasonably_similar PROTO((tree, tree));
extern tree build_component_ref PROTO((tree, tree, tree, int));
extern tree build_ptrmemfunc PROTO((tree, tree, int));
......
......@@ -340,8 +340,9 @@ convert_to_pointer_force (type, expr)
if (distance == -2)
{
ambig:
cp_error ("type `%T' is ambiguous baseclass of `%s'", TREE_TYPE (type),
TYPE_NAME_STRING (TREE_TYPE (intype)));
cp_error ("type `%T' is ambiguous baseclass of `%s'",
TREE_TYPE (type),
TYPE_NAME_STRING (TREE_TYPE (intype)));
return error_mark_node;
}
if (distance == -1)
......@@ -608,6 +609,10 @@ build_up_reference (type, arg, flags, checkconst)
arg = build (TARGET_EXPR, argtype, slot, arg, NULL_TREE, NULL_TREE);
}
/* If we had a way to wrap this up, and say, if we ever needed it's
address, transform all occurrences of the register, into a memory
reference we could win better. */
mark_addressable (arg);
rval = build1 (ADDR_EXPR, type, arg);
done:
......
......@@ -778,7 +778,10 @@ grok_x_components (specs, components)
if (TREE_CODE (t) == UNION_TYPE
&& ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
{
/* See also shadow_tag. */
struct pending_inline **p;
tree *q;
x = build_lang_field_decl (FIELD_DECL, NULL_TREE, t);
/* Wipe out memory of synthesized methods */
......@@ -790,6 +793,17 @@ grok_x_components (specs, components)
TYPE_HAS_ASSIGNMENT (t) = 0;
TYPE_HAS_CONST_ASSIGN_REF (t) = 0;
q = &TYPE_METHODS (t);
while (*q)
{
if (DECL_ARTIFICIAL (*q))
*q = TREE_CHAIN (*q);
else
q = &TREE_CHAIN (*q);
}
if (TYPE_METHODS (t))
error ("an anonymous union cannot have function members");
p = &pending_inlines;
for (; *p; *p = (*p)->next)
if (DECL_CONTEXT ((*p)->fndecl) != t)
......@@ -2163,6 +2177,7 @@ finish_builtin_type (type, name, fields, len, align_type)
#else
TYPE_NAME (type) = build_decl (TYPE_DECL, get_identifier (name), type);
#endif
TYPE_STUB_DECL (type) = TYPE_NAME (type);
layout_decl (TYPE_NAME (type), 0);
}
......@@ -2989,13 +3004,20 @@ finish_file ()
{
tree decl = TREE_VALUE (pending_statics);
if (TREE_USED (decl) == 1
|| TREE_READONLY (decl) == 0
|| DECL_INITIAL (decl) == 0)
{
DECL_DEFER_OUTPUT (decl) = 0;
rest_of_decl_compilation (decl, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), 1, 1);
}
/* Output DWARF debug information. */
#ifdef DWARF_DEBUGGING_INFO
if (write_symbols == DWARF_DEBUG)
dwarfout_file_scope_decl (decl, 1);
#endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG)
dwarf2out_decl (decl);
#endif
DECL_DEFER_OUTPUT (decl) = 0;
rest_of_decl_compilation
(decl, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), 1, 1);
pending_statics = TREE_CHAIN (pending_statics);
}
......
......@@ -1486,7 +1486,7 @@ cp_file_of (t)
if (TREE_CODE (t) == PARM_DECL)
return DECL_SOURCE_FILE (DECL_CONTEXT (t));
else if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
return DECL_SOURCE_FILE (TYPE_NAME (t));
return DECL_SOURCE_FILE (TYPE_MAIN_DECL (t));
else
return DECL_SOURCE_FILE (t);
}
......@@ -1502,7 +1502,7 @@ cp_line_of (t)
t = TREE_TYPE (t);
if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
line = DECL_SOURCE_LINE (TYPE_NAME (t));
line = DECL_SOURCE_LINE (TYPE_MAIN_DECL (t));
else
line = DECL_SOURCE_LINE (t);
......
......@@ -2227,7 +2227,7 @@ is_friend (type, supplicant)
if (declp)
/* It's a function decl. */
{
tree list = DECL_FRIENDLIST (TYPE_NAME (type));
tree list = DECL_FRIENDLIST (TYPE_MAIN_DECL (type));
tree name = DECL_NAME (supplicant);
tree ctype;
......@@ -2259,7 +2259,7 @@ is_friend (type, supplicant)
if (type == supplicant)
return 1;
list = CLASSTYPE_FRIEND_CLASSES (TREE_TYPE (TYPE_NAME (type)));
list = CLASSTYPE_FRIEND_CLASSES (TREE_TYPE (TYPE_MAIN_DECL (type)));
for (; list ; list = TREE_CHAIN (list))
if (supplicant == TREE_VALUE (list))
return 1;
......@@ -2275,7 +2275,7 @@ is_friend (type, supplicant)
if (IS_AGGR_TYPE (supplicant))
context = NULL_TREE;
else
context = DECL_CONTEXT (TYPE_NAME (supplicant));
context = DECL_CONTEXT (TYPE_MAIN_DECL (supplicant));
}
else if (DECL_FUNCTION_MEMBER_P (supplicant))
context = DECL_CLASS_CONTEXT (supplicant);
......@@ -2296,7 +2296,7 @@ static void
add_friend (type, decl)
tree type, decl;
{
tree typedecl = TYPE_NAME (type);
tree typedecl = TYPE_MAIN_DECL (type);
tree list = DECL_FRIENDLIST (typedecl);
tree name = DECL_NAME (decl);
......@@ -2346,7 +2346,7 @@ static void
add_friends (type, name, friend_type)
tree type, name, friend_type;
{
tree typedecl = TYPE_NAME (type);
tree typedecl = TYPE_MAIN_DECL (type);
tree list = DECL_FRIENDLIST (typedecl);
while (list)
......@@ -2409,7 +2409,7 @@ make_friend_class (type, friend_type)
if (IS_SIGNATURE (friend_type))
{
error ("signature type `%s' declared `friend'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (friend_type))));
IDENTIFIER_POINTER (TYPE_IDENTIFIER (friend_type)));
return;
}
if (type == friend_type)
......@@ -2561,7 +2561,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
warning ("implicitly declaring `%s' as struct",
IDENTIFIER_POINTER (declarator));
decl = xref_tag (record_type_node, declarator, NULL_TREE, 1);
decl = TYPE_NAME (decl);
decl = TYPE_MAIN_DECL (decl);
}
/* Allow abbreviated declarations of overloaded functions,
......@@ -2735,7 +2735,7 @@ build_new (placement, decl, init, use_global_new)
{
/* An aggregate type. */
type = IDENTIFIER_TYPE_VALUE (decl);
decl = TYPE_NAME (type);
decl = TYPE_MAIN_DECL (type);
}
else
{
......@@ -2755,7 +2755,7 @@ build_new (placement, decl, init, use_global_new)
{
type = decl;
true_type = type;
decl = TYPE_NAME (type);
decl = TYPE_MAIN_DECL (type);
}
if (processing_template_decl)
......
......@@ -1112,7 +1112,7 @@ set_vardecl_interface_info (prev, vars)
if (CLASSTYPE_INTERFACE_KNOWN (type))
{
if (CLASSTYPE_INTERFACE_ONLY (type))
set_typedecl_interface_info (prev, TYPE_NAME (type));
set_typedecl_interface_info (prev, TYPE_MAIN_DECL (type));
else
CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 1;
DECL_EXTERNAL (vars) = CLASSTYPE_INTERFACE_ONLY (type);
......@@ -2721,8 +2721,8 @@ identifier_typedecl_value (node)
do (IDENTIFIER_GLOBAL_VALUE (node));
#undef do
/* Will this one ever happen? */
if (TYPE_NAME (type))
return TYPE_NAME (type);
if (TYPE_MAIN_DECL (type))
return TYPE_MAIN_DECL (type);
/* We used to do an internal error of 62 here, but instead we will
handle the return of a null appropriately in the callers. */
......@@ -3366,7 +3366,7 @@ real_yylex ()
))
{
pedwarn ("floating point number exceeds range of `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
IDENTIFIER_POINTER (TYPE_IDENTIFIER (type)));
}
/* Note: garbage_chars is -1 if first char is *not* garbage. */
while (isalnum (c))
......
......@@ -324,7 +324,7 @@ build_overload_nested_name (decl)
{
tree context = DECL_CONTEXT (decl);
if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')
context = TYPE_MAIN_DECL (context);
context = TYPE_NAME (context);
build_overload_nested_name (context);
}
......@@ -903,10 +903,10 @@ build_overload_name (parmtypes, begin, end)
if (i > 9)
OB_PUTC ('_');
numeric_output_need_bar = 0;
build_overload_nested_name (TYPE_MAIN_DECL (parmtype));
build_overload_nested_name (TYPE_NAME (parmtype));
}
else
build_overload_identifier (TYPE_MAIN_DECL (parmtype));
build_overload_identifier (TYPE_NAME (parmtype));
break;
}
......@@ -1075,7 +1075,7 @@ build_typename_overload (type)
id = get_identifier (obstack_base (&scratch_obstack));
IDENTIFIER_OPNAME_P (id) = 1;
#if 0
IDENTIFIER_GLOBAL_VALUE (id) = TYPE_NAME (type);
IDENTIFIER_GLOBAL_VALUE (id) = TYPE_MAIN_DECL (type);
#endif
TREE_TYPE (id) = type;
return id;
......
......@@ -1208,7 +1208,8 @@ expr_no_commas:
{ $$ = build_x_conditional_expr ($$, $3, $5); }
| expr_no_commas '=' expr_no_commas
{ $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
if ($$ != error_mark_node)
C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
| expr_no_commas ASSIGN expr_no_commas
{ $$ = build_x_modify_expr ($$, $2, $3); }
| THROW
......@@ -2233,10 +2234,7 @@ named_complex_class_head_sans_basetype:
{
current_aggr = $1;
if (TREE_CODE ($3) == TYPE_DECL)
{
$$ = $3;
note_debug_info_needed (DECL_CONTEXT ($$));
}
$$ = $3;
else
{
cp_error ("`%T' does not have a nested type named `%D'",
......
......@@ -149,7 +149,8 @@ process_template_parm (list, next)
tree t = make_lang_type (TEMPLATE_TYPE_PARM);
CLASSTYPE_GOT_SEMICOLON (t) = 1;
decl = build_decl (TYPE_DECL, TREE_VALUE (parm), t);
TYPE_MAIN_DECL (t) = decl;
TYPE_NAME (t) = decl;
TYPE_STUB_DECL (t) = decl;
parm = decl;
TEMPLATE_TYPE_SET_INFO (t, idx, processing_template_decl);
}
......@@ -372,9 +373,13 @@ coerce_template_parms (parms, arglist, in_decl)
else
arg = TREE_VALUE (arg);
}
else
else if (TREE_CODE (TREE_VALUE (TREE_VEC_ELT (parms, i)))
== TYPE_DECL)
arg = tsubst (TREE_PURPOSE (TREE_VEC_ELT (parms, i)),
&TREE_VEC_ELT (vec, 0), i, in_decl);
else
arg = tsubst_expr (TREE_PURPOSE (TREE_VEC_ELT (parms, i)),
&TREE_VEC_ELT (vec, 0), i, in_decl);
TREE_VEC_ELT (vec, i) = arg;
}
......@@ -1679,6 +1684,9 @@ tsubst (t, args, nargs, in_decl)
}
case TYPE_DECL:
if (t == TYPE_NAME (TREE_TYPE (t)))
return TYPE_NAME (type);
{
tree r = copy_node (t);
TREE_TYPE (r) = type;
......
......@@ -2542,17 +2542,6 @@ dfs_debug_mark (binfo)
if (methods == 0)
return;
/* We can't do the TYPE_DECL_SUPPRESS_DEBUG thing with DWARF, which
does not support name references between translation units. Well, we
could, but that would mean putting global labels in the debug output
before each exported type and each of its functions and static data
members. */
if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)
{
rest_of_type_compilation (t, global_bindings_p ());
return;
}
/* If interface info is known, either we've already emitted the debug
info or we don't need to. */
if (CLASSTYPE_INTERFACE_KNOWN (t)
......@@ -3138,6 +3127,14 @@ note_debug_info_needed (type)
if (current_template_parms)
return;
/* We can't do the TYPE_DECL_SUPPRESS_DEBUG thing with DWARF, which
does not support name references between translation units. Well, we
could, but that would mean putting global labels in the debug output
before each exported type and each of its functions and static data
members. */
if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)
return;
dfs_walk (TYPE_BINFO (type), dfs_debug_mark, dfs_debug_unmarkedp);
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
{
......@@ -3195,7 +3192,12 @@ envelope_add_decl (type, decl, values)
else
dont_add = 1;
}
else if (context && TYPE_DERIVES_FROM (context, type))
/* If we don't check CLASSTYPE_CID on CONTEXT right now, we'll end
up subtracting from the address of MI_MATRIX, putting us off
in la la land. */
else if (context
&& CLASSTYPE_CID (context)
&& TYPE_DERIVES_FROM (context, type))
{
/* Don't add in *values to list */
*values = NULL_TREE;
......@@ -3213,7 +3215,12 @@ envelope_add_decl (type, decl, values)
? DECL_CLASS_CONTEXT (value)
: DECL_CONTEXT (value);
if (context && TYPE_DERIVES_FROM (context, type))
/* If we don't check CLASSTYPE_CID on CONTEXT right now, we'll end
up subtracting from the address of MI_MATRIX, putting us off
in la la land. */
if (context
&& CLASSTYPE_CID (context)
&& TYPE_DERIVES_FROM (context, type))
{
/* remove *tmp from list */
*tmp = TREE_CHAIN (*tmp);
......
......@@ -817,6 +817,7 @@ layout_basetypes (rec, binfos)
them too. */
DECL_ASSEMBLER_NAME (decl) = get_identifier (VTABLE_BASE);
DECL_VIRTUAL_P (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
DECL_FIELD_CONTEXT (decl) = rec;
DECL_CLASS_CONTEXT (decl) = rec;
DECL_FCONTEXT (decl) = basetype;
......
......@@ -1805,10 +1805,13 @@ build_component_ref (datum, component, basetype_path, protect)
}
else
{
tree name = component;
if (TREE_CODE (component) == VAR_DECL)
name = DECL_NAME (component);
if (basetype_path == NULL_TREE)
basetype_path = TYPE_BINFO (basetype);
field = lookup_field (basetype_path, component,
protect && ! VFIELD_NAME_P (component), 0);
field = lookup_field (basetype_path, name,
protect && !VFIELD_NAME_P (name), 0);
if (field == error_mark_node)
return error_mark_node;
......@@ -1817,7 +1820,7 @@ build_component_ref (datum, component, basetype_path, protect)
/* Not found as a data field, look for it as a method. If found,
then if this is the only possible one, return it, else
report ambiguity error. */
tree fndecls = lookup_fnfields (basetype_path, component, 1);
tree fndecls = lookup_fnfields (basetype_path, name, 1);
if (fndecls == error_mark_node)
return error_mark_node;
if (fndecls)
......@@ -1867,7 +1870,7 @@ build_component_ref (datum, component, basetype_path, protect)
}
}
cp_error ("`%#T' has no member named `%D'", basetype, component);
cp_error ("`%#T' has no member named `%D'", basetype, name);
return error_mark_node;
}
else if (TREE_TYPE (field) == error_mark_node)
......
......@@ -1377,7 +1377,10 @@ build_m_component_ref (datum, component)
else if (binfo == error_mark_node)
return error_mark_node;
return build (OFFSET_REF, rettype, datum, component);
component = build (OFFSET_REF, rettype, datum, component);
if (TREE_CODE (type) == OFFSET_TYPE)
component = resolve_offset_ref (component);
return component;
}
/* Return a tree node for the expression TYPENAME '(' PARMS ')'. */
......
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