This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Lose break_out_cleanups
- To: gcc-patches at gcc dot gnu dot org
- Subject: C++ PATCH: Lose break_out_cleanups
- From: Jason Merrill <jason at redhat dot com>
- Date: 21 Dec 2000 17:26:30 +0000
break_out_cleanups is no longer useful; we now do the necessary processing
when we build the CALL_EXPR.
Tested i686-pc-linux-gnu.
2000-12-20 Jason Merrill <jason@redhat.com>
* tree.c (break_out_cleanups): Lose.
* cp-tree.h: Remove prototype.
* typeck.c (build_component_ref): Don't break_out_cleanups.
(build_compound_expr): Likewise.
* semantics.c (finish_expr_stmt): Likewise.
*** tree.c.~1~ Thu Dec 21 17:08:17 2000
--- tree.c Thu Dec 21 17:08:19 2000
*************** get_target_expr (init)
*** 317,353 ****
return build_target_expr_with_type (init, TREE_TYPE (init));
}
- /* Recursively search EXP for CALL_EXPRs that need cleanups and replace
- these CALL_EXPRs with tree nodes that will perform the cleanups. */
-
- tree
- break_out_cleanups (exp)
- tree exp;
- {
- tree tmp = exp;
-
- if (TREE_CODE (tmp) == CALL_EXPR
- && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (tmp)))
- return build_cplus_new (TREE_TYPE (tmp), tmp);
-
- while (TREE_CODE (tmp) == NOP_EXPR
- || TREE_CODE (tmp) == CONVERT_EXPR
- || TREE_CODE (tmp) == NON_LVALUE_EXPR)
- {
- if (TREE_CODE (TREE_OPERAND (tmp, 0)) == CALL_EXPR
- && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (TREE_OPERAND (tmp, 0))))
- {
- TREE_OPERAND (tmp, 0)
- = build_cplus_new (TREE_TYPE (TREE_OPERAND (tmp, 0)),
- TREE_OPERAND (tmp, 0));
- break;
- }
- else
- tmp = TREE_OPERAND (tmp, 0);
- }
- return exp;
- }
-
/* Recursively perform a preorder search EXP for CALL_EXPRs, making
copies where they are found. Returns a deep copy all nodes transitively
containing CALL_EXPRs. */
--- 317,322 ----
*** cp-tree.h.~1~ Thu Dec 21 17:08:17 2000
--- cp-tree.h Thu Dec 21 17:08:18 2000
*************** extern int lvalue_p PARAMS ((tree));
*** 4401,4407 ****
extern int lvalue_or_else PARAMS ((tree, const char *));
extern tree build_cplus_new PARAMS ((tree, tree));
extern tree get_target_expr PARAMS ((tree));
- extern tree break_out_cleanups PARAMS ((tree));
extern tree break_out_calls PARAMS ((tree));
extern tree build_cplus_method_type PARAMS ((tree, tree, tree));
extern tree build_cplus_staticfn_type PARAMS ((tree, tree, tree));
--- 4401,4406 ----
*** typeck.c.~1~ Thu Dec 21 17:08:17 2000
--- typeck.c Thu Dec 21 17:08:19 2000
*************** build_component_ref (datum, component, b
*** 2278,2285 ****
field_type = cp_build_qualified_type (field_type, type_quals);
}
! ref = fold (build (COMPONENT_REF, field_type,
! break_out_cleanups (datum), field));
/* Mark the expression const or volatile, as appropriate. Even
though we've dealt with the type above, we still have to mark the
--- 2278,2284 ----
field_type = cp_build_qualified_type (field_type, type_quals);
}
! ref = fold (build (COMPONENT_REF, field_type, datum, field));
/* Mark the expression const or volatile, as appropriate. Even
though we've dealt with the type above, we still have to mark the
*************** build_compound_expr (list)
*** 5039,5046 ****
if (! TREE_SIDE_EFFECTS (first) && ! pedantic)
return rest;
! return build (COMPOUND_EXPR, TREE_TYPE (rest),
! break_out_cleanups (first), rest);
}
tree
--- 5038,5044 ----
if (! TREE_SIDE_EFFECTS (first) && ! pedantic)
return rest;
! return build (COMPOUND_EXPR, TREE_TYPE (rest), first, rest);
}
tree
*** semantics.c.~1~ Thu Dec 21 17:08:17 2000
--- semantics.c Thu Dec 21 17:08:19 2000
*************** finish_expr_stmt (expr)
*** 214,222 ****
if (stmts_are_full_exprs_p ())
expr = convert_to_void (expr, "statement");
- if (!processing_template_decl)
- expr = break_out_cleanups (expr);
-
r = add_stmt (build_stmt (EXPR_STMT, expr));
}
--- 214,219 ----