From: Jason Merrill Date: Wed, 30 Aug 2000 23:43:53 +0000 (-0400) Subject: cp-tree.h (LOCAL_CLASS_P): Use decl_function_context. X-Git-Tag: prereleases/libstdc++-2.92~4341 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=495d26d6ce58caf1f86a1039b0c44e1b23878bc6;p=thirdparty%2Fgcc.git cp-tree.h (LOCAL_CLASS_P): Use decl_function_context. * cp-tree.h (LOCAL_CLASS_P): Use decl_function_context. * tree.c (bot_manip): Check TREE_CONSTANT rather than !TREE_SIDE_EFFECTS. Call break_out_target_exprs and build_target_expr_with_type for the non-AGGR_INIT_EXPR case. * decl.c (start_function): Always call make_function_rtl. From-SVN: r36080 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b0842f5f7cbb..033185e40219 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,16 @@ +2000-08-30 Jason Merrill + + * cp-tree.h (LOCAL_CLASS_P): Use decl_function_context. + + * tree.c (bot_manip): Check TREE_CONSTANT rather than + !TREE_SIDE_EFFECTS. Call break_out_target_exprs and + build_target_expr_with_type for the non-AGGR_INIT_EXPR case. + + * decl.c (start_function): Always call make_function_rtl. + 2000-08-29 Zack Weinberg - * cp/semantics.c (prune_unused_decls): New function. + * semantics.c (prune_unused_decls): New function. (finish_stmt_tree): Call it via walk_tree. 2000-08-29 Zack Weinberg diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index cc5046921f96..4fee6fffc636 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2226,8 +2226,7 @@ struct lang_decl /* 1 iff NODE is function-local, but for types. */ #define LOCAL_CLASS_P(NODE) \ - (TYPE_CONTEXT (NODE) \ - && TREE_CODE (TYPE_CONTEXT (NODE)) == FUNCTION_DECL) + (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE) /* For a NAMESPACE_DECL: the list of using namespace directives The PURPOSE is the used namespace, the value is the namespace diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e84232d64b5f..b5627f1df2c9 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13838,10 +13838,11 @@ start_function (declspecs, declarator, attrs, flags) cplus_decl_attributes (decl1, NULL_TREE, attrs); if (!building_stmt_tree ()) - { - GNU_xref_function (decl1, current_function_parms); - make_function_rtl (decl1); - } + GNU_xref_function (decl1, current_function_parms); + + /* We need to do this even if we aren't expanding yet so that + assemble_external works. */ + make_function_rtl (decl1); /* Promote the value to int before returning it. */ if (C_PROMOTING_INTEGER_TYPE_P (restype)) diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index cd7d45f0d29c..009cb0e388e3 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1649,13 +1649,15 @@ bot_manip (tp, walk_subtrees, data) splay_tree target_remap = ((splay_tree) data); tree t = *tp; - if (TREE_CODE (t) != TREE_LIST && ! TREE_SIDE_EFFECTS (t)) + if (TREE_CONSTANT (t)) { - /* There can't be any TARGET_EXPRs below this point. */ + /* There can't be any TARGET_EXPRs or their slot variables below + this point. We used to check !TREE_SIDE_EFFECTS, but then we + failed to copy an ADDR_EXPR of the slot VAR_DECL. */ *walk_subtrees = 0; return NULL_TREE; } - else if (TREE_CODE (t) == TARGET_EXPR) + if (TREE_CODE (t) == TARGET_EXPR) { tree u; @@ -1667,13 +1669,8 @@ bot_manip (tp, walk_subtrees, data) } else { - tree var; - - u = copy_node (t); - var = build (VAR_DECL, TREE_TYPE (t)); - DECL_CONTEXT (var) = current_function_decl; - layout_decl (var, 0); - TREE_OPERAND (u, 0) = var; + u = build_target_expr_with_type + (break_out_target_exprs (TREE_OPERAND (t, 1)), TREE_TYPE (t)); } /* Map the old variable to the new one. */