summaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-25 23:27:18 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-25 23:27:18 +0000
commit0ce25b06293a6daa30df18c6745b28d893325fff (patch)
treedb2ec4264a1fd32d8fe39dfd89a501b714b874ca /gcc/cp/decl2.c
parent1c4f75bff74490d5db34dfbba6856c6cc00c301d (diff)
downloadgcc-0ce25b06293a6daa30df18c6745b28d893325fff.tar.gz
Finish implementation of VTTs.
* cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and CPTI_VTT_PARM_IDENTIFIER. (vtt_parm_identifier): New macro. (vtt_parm_type): Likewise. (BINFO_SUBVTT_INDEX): Likewise. (BINFO_VPTR_INDEX): Likewise. (struct lang_decl): Add vtt_parm. (DECL_VTT_PARM): New macro. (DECL_USE_VTT_PARM): Likewise. (DECL_NEEDS_VTT_PARM_P): Likewise. (get_vtt_name): Declare. (build_artifical_parm): Likewise. (fixup_all_virtual_upcast_offsets): Likewise. (expand_indirect_vtbls_init): Remove. * call.c (build_new_method_call): Pass the vtt to subobject constructors and destructors. * class.c (get_vtt_name): Give it external linkage. (build_clone): Handle the magic VTT parameters for clones. (clone_function_decl): Fix typo in comment. (build_vtt): Keep track of the indices in the VTTs where various entities are stored. (build_vtt_inits): Likewise. (dfs_build_vtt_inits): Likewise. (build_ctor_vtbl_group): Tweak type of construction vtables. (dfs_accumulate_vtbl_inits): Build vtables for all bases, even primary bases, when building construction vtables. * decl.c (duplicate_decls): Handle DECL_VTT_PARM. (initialize_predefined_identifiers): Add vtt_parm_identifier. (init_decl_processing): Initialize vtt_parm_type. (grokfndecl): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Make vtt_parm. * decl2.c (build_artificial_parm): New function. (maybe_retrofit_in_chrg): Use it. Add VTT parameters. (grokclassfn): Use build_artificial_parm. * init.c (initialize_vtbl_ptrs): Call fixup_all_virtual_upcast_offsets directly. (perform_member_init): Use the complete subobject destructor for member cleanups. (build_vtbl_address): New function. (expand_virtual_init): Handle VTTs. * optimize (maybe_clone_body): Likewise. * search.c (fixup_all_virtual_upcast_offsets): Give it external linkage. (expand_indirect_vtbls_init): Remove. * semantics.c (setup_vtbl_ptr): Fix typos in comment. * tree.c (make_binfo): Make them bigger. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34177 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 5b7209827cc..315e3c86e7b 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -924,6 +924,22 @@ grok_x_components (specs)
break;
}
+/* Returns a PARM_DECL for a parameter of the indicated TYPE, with the
+ indicated NAME. */
+
+tree
+build_artificial_parm (name, type)
+ tree name;
+ tree type;
+{
+ tree parm;
+
+ parm = build_decl (PARM_DECL, name, type);
+ SET_DECL_ARTIFICIAL (parm);
+ DECL_ARG_TYPE (parm) = type;
+ return parm;
+}
+
/* Constructors for types with virtual baseclasses need an "in-charge" flag
saying whether this constructor is responsible for initialization of
virtual baseclasses or not. All destructors also need this "in-charge"
@@ -956,10 +972,7 @@ maybe_retrofit_in_chrg (fn)
return;
/* First add it to DECL_ARGUMENTS... */
- parm = build_decl (PARM_DECL, in_charge_identifier, integer_type_node);
- /* Mark the artificial `__in_chrg' parameter as "artificial". */
- SET_DECL_ARTIFICIAL (parm);
- DECL_ARG_TYPE (parm) = integer_type_node;
+ parm = build_artificial_parm (in_charge_identifier, integer_type_node);
TREE_READONLY (parm) = 1;
parms = DECL_ARGUMENTS (fn);
TREE_CHAIN (parm) = TREE_CHAIN (parms);
@@ -978,6 +991,18 @@ maybe_retrofit_in_chrg (fn)
/* Now we've got the in-charge parameter. */
DECL_HAS_IN_CHARGE_PARM_P (fn) = 1;
+
+ /* If this is a subobject constructor or destructor, our caller will
+ pass us a pointer to our VTT. */
+ if (flag_new_abi && TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
+ {
+ DECL_VTT_PARM (fn) = build_artificial_parm (vtt_parm_identifier,
+ vtt_parm_type);
+ DECL_CONTEXT (DECL_VTT_PARM (fn)) = fn;
+ DECL_USE_VTT_PARM (fn) = build_artificial_parm (NULL_TREE,
+ boolean_type_node);
+ DECL_CONTEXT (DECL_USE_VTT_PARM (fn)) = fn;
+ }
}
/* Classes overload their constituent function names automatically.
@@ -1032,12 +1057,9 @@ grokclassfn (ctype, function, flags, quals)
assigned to. */
this_quals |= TYPE_QUAL_CONST;
qual_type = cp_build_qualified_type (type, this_quals);
- parm = build_decl (PARM_DECL, this_identifier, qual_type);
+ parm = build_artificial_parm (this_identifier, qual_type);
c_apply_type_quals_to_decl (this_quals, parm);
- /* Mark the artificial `this' parameter as "artificial". */
- SET_DECL_ARTIFICIAL (parm);
- DECL_ARG_TYPE (parm) = type;
/* We can make this a register, so long as we don't
accidentally complain if someone tries to take its address. */
DECL_REGISTER (parm) = 1;