aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c48
1 files changed, 16 insertions, 32 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index e77e9299ec1..43d3074dca3 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -205,6 +205,7 @@ finish_expr_stmt (expr)
tree expr;
{
tree r = NULL_TREE;
+ tree expr_type = NULL_TREE;;
if (expr != NULL_TREE)
{
@@ -215,6 +216,9 @@ finish_expr_stmt (expr)
|| TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE))
expr = default_conversion (expr);
+ /* Remember the type of the expression. */
+ expr_type = TREE_TYPE (expr);
+
if (stmts_are_full_exprs_p ())
expr = convert_to_void (expr, "statement");
@@ -225,7 +229,7 @@ finish_expr_stmt (expr)
/* This was an expression-statement, so we save the type of the
expression. */
- last_expr_type = expr ? TREE_TYPE (expr) : NULL_TREE;
+ last_expr_type = expr_type;
return r;
}
@@ -1209,7 +1213,7 @@ begin_global_stmt_expr ()
keep_next_level (1);
- return (last_tree != NULL_TREE) ? last_tree : expand_start_stmt_expr();
+ return last_tree ? last_tree : expand_start_stmt_expr(/*has_scope=*/1);
}
/* Finish the STMT_EXPR last begun with begin_global_stmt_expr. */
@@ -1502,32 +1506,13 @@ decl_type_access_control (decl)
added to type_lookups after typed_declspecs saved the copy that
ended up in current_type_lookups. */
type_lookups = current_type_lookups;
-
- current_type_lookups = NULL_TREE;
}
-/* Record the lookups, if we're doing deferred access control. */
-
void
save_type_access_control (lookups)
tree lookups;
{
- if (type_lookups != error_mark_node)
- {
- my_friendly_assert (!current_type_lookups, 20010301);
- current_type_lookups = lookups;
- }
- else
- my_friendly_assert (!lookups || lookups == error_mark_node, 20010301);
-}
-
-/* Set things up so that the next deferred access control will succeed.
- This is needed for friend declarations see grokdeclarator for details. */
-
-void
-skip_type_access_control ()
-{
- type_lookups = NULL_TREE;
+ current_type_lookups = lookups;
}
/* Reset the deferred access control. */
@@ -1911,8 +1896,6 @@ finish_class_definition (t, attributes, semi, pop_scope_p)
check_for_missing_semicolon (t);
if (pop_scope_p)
pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (t)));
- if (current_function_decl)
- type_lookups = error_mark_node;
if (current_scope () == current_function_decl)
do_pending_defargs ();
@@ -2146,10 +2129,6 @@ cp_expand_stmt (t)
{
switch (TREE_CODE (t))
{
- case CLEANUP_STMT:
- genrtl_decl_cleanup (CLEANUP_DECL (t), CLEANUP_EXPR (t));
- break;
-
case CTOR_STMT:
genrtl_ctor_stmt (t);
break;
@@ -2478,7 +2457,7 @@ nullify_returns_r (tp, walk_subtrees, data)
RETURN_EXPR (*tp) = NULL_TREE;
else if (TREE_CODE (*tp) == CLEANUP_STMT
&& CLEANUP_DECL (*tp) == nrv)
- CLEANUP_EXPR (*tp) = NULL_TREE;
+ CLEANUP_EH_ONLY (*tp) = 1;
/* Keep iterating. */
return NULL_TREE;
@@ -2525,9 +2504,14 @@ genrtl_start_function (fn)
if (!current_function_cannot_inline)
current_function_cannot_inline = cp_function_chain->cannot_inline;
- /* We don't need the saved data anymore. */
- free (DECL_SAVED_FUNCTION_DATA (fn));
- DECL_SAVED_FUNCTION_DATA (fn) = NULL;
+ /* We don't need the saved data anymore. Unless this is an inline
+ function; we need the named return value info for
+ cp_copy_res_decl_for_inlining. */
+ if (! DECL_INLINE (fn))
+ {
+ free (DECL_SAVED_FUNCTION_DATA (fn));
+ DECL_SAVED_FUNCTION_DATA (fn) = NULL;
+ }
}
/* Keep track of how many functions we're presently expanding. */