diff options
-rw-r--r-- | gcc/cp/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 3 | ||||
-rw-r--r-- | gcc/cp/decl.c | 9 | ||||
-rw-r--r-- | gcc/cp/tree.c | 17 |
4 files changed, 24 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b0842f5..033185e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,16 @@ +2000-08-30 Jason Merrill <jason@redhat.com> + + * 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 <zack@wolery.cumb.org> - * 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 <zack@wolery.cumb.org> diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index cc50469..4fee6ff 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 e84232d..b5627f1 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 cd7d45f..009cb0e 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. */ |