zlaski 02/09/24 18:35:28
Modified: gcc/cp typeck.c
Log:
Re-enable the -fapple-kext bits by replacing calls to build_component_ref
with finish_class_member_access_expr (which worked out quite well in
ObjC++'s case).
Revision Changes Path
1.33 +13 -24 gcc3/gcc/cp/typeck.c
Index: typeck.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/cp/typeck.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- typeck.c 2002/08/26 20:08:08 1.32
+++ typeck.c 2002/09/25 01:35:28 1.33
@@ -2540,7 +2540,8 @@
if (TYPE_PTRMEMFUNC_P (TREE_TYPE (function)))
{
- tree idx, delta, e1, e2, e3, vtbl, basetype;
+ /* APPLE LOCAL 2.95-ptmf-compatibility turly 20020314 */
+ tree idx, delta, delta2, e1, e2, e3, vtbl, basetype;
tree fntype = TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (function));
tree instance_ptr = *instance_ptrptr;
@@ -2571,19 +2572,17 @@
/* Start by extracting all the information from the PMF itself. */
e3 = PFN_FROM_PTRMEMFUNC (function);
-#if 0 /* APPLE MERGE orphaned code */
/* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020314 */
if (flag_apple_kext)
{
idx = save_expr (default_conversion
- (build_component_ref (function, index_identifier,
- NULL_TREE, 0)));
+ (finish_class_member_access_expr
+ (function, index_identifier)));
e1 = cp_build_binary_op (GE_EXPR, idx, integer_zero_node);
}
else
{
/* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020314 */
-#endif
delta = build_ptrmemfunc_access_expr (function, delta_identifier);
idx = build1 (NOP_EXPR, vtable_index_type, e3);
switch (TARGET_PTRMEMFUNC_VBIT_LOCATION)
@@ -2602,17 +2601,15 @@
abort ();
}
-#if 0 /* APPLE MERGE orphaned code */
/* DELTA2 is the amount by which to adjust the `this' pointer
to find the vtbl. */
/* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020314 */
}
if (flag_apple_kext)
- delta2 = build_component_ref
- (build_component_ref (function,
- pfn_or_delta2_identifier, NULL_TREE,
- 0),
- delta2_identifier, NULL_TREE, 0);
+ delta2 = finish_class_member_access_expr
+ (finish_class_member_access_expr
+ (function, pfn_or_delta2_identifier),
+ delta2_identifier);
else
/* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020314 */
delta2 = delta;
@@ -2620,7 +2617,6 @@
(PLUS_EXPR,
build_pointer_type (build_pointer_type (vtable_entry_type)),
vtbl, cp_convert (ptrdiff_type_node, delta2));
-#endif
/* Convert down to the right base before using the instance. First
use the type... */
basetype = TYPE_METHOD_BASETYPE (TREE_TYPE (fntype));
@@ -2641,7 +2637,6 @@
instance_ptr);
vtbl = build_indirect_ref (vtbl, NULL);
-#if 0 /* APPLE MERGE more orphans */
/* APPLE LOCAL double destructor turly 20020301 */
#ifdef ADJUST_VTABLE_INDEX
/* vptr hack already compensated for! */
@@ -2656,7 +2651,6 @@
else
/* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020314 */
e2 = build_array_ref (vtbl, idx);
-#endif
/* Finally, extract the function pointer from the vtable. */
e2 = fold (build (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, idx));
@@ -3347,15 +3341,13 @@
}
else if (TYPE_PTRMEMFUNC_P (type0) && null_ptr_cst_p (op1))
{
-#if 0 /* APPLE MERGE rewrite code */
/* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020314 */
/* Shouldn't we use INDEX here rather than PFN? This seems to
work fine, though... */
if (flag_apple_kext)
- op0 = build_component_ref (op0, index_identifier, NULL_TREE, 0);
+ op0 = finish_class_member_access_expr (op0, index_identifier);
else
/* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020314 */
-#endif
op0 = build_ptrmemfunc_access_expr (op0, pfn_identifier);
op1 = cp_convert (TREE_TYPE (op0), integer_zero_node);
result_type = TREE_TYPE (op0);
@@ -5921,7 +5913,6 @@
pfn_from_ptrmemfunc (t)
tree t;
{
-#if 0 /* APPLE MERGE fix this */
/* APPLE LOCAL begin 2.95-ptmf-compatibility turly 20020313 */
if (flag_apple_kext)
{
@@ -5933,14 +5924,12 @@
build_addr_func (fn));
}
- return (build_component_ref
- (build_component_ref (t,
- pfn_or_delta2_identifier, NULL_TREE,
- 0),
- pfn_identifier, NULL_TREE, 0));
+ return (finish_class_member_access_expr
+ (finish_class_member_access_expr
+ (t, pfn_or_delta2_identifier),
+ pfn_identifier));
}
/* APPLE LOCAL end 2.95-ptmf-compatibility turly 20020313 */
-#endif
if (TREE_CODE (t) == PTRMEM_CST)
{