extern void expand_start_early_try_stmts PROTO((void));
extern void store_parm_decls PROTO((void));
extern void store_return_init PROTO((tree));
-extern void finish_function PROTO((int, int));
+extern tree finish_function PROTO((int, int));
extern tree start_method PROTO((tree, tree, tree));
extern tree finish_method PROTO((tree));
extern void hack_incomplete_structures PROTO((tree));
function definition. (This processing will have taken place
after the class definition is complete.) */
-void
+tree
finish_function (lineno, flags)
int lineno;
int flags;
/* When we get some parse errors, we can end up without a
current_function_decl, so cope. */
if (fndecl == NULL_TREE)
- return;
+ return error_mark_node;
nested = function_depth > 1;
fntype = TREE_TYPE (fndecl);
if (DECL_STATIC_DESTRUCTOR (fndecl))
static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors);
+ /* Clean up. */
if (! nested)
{
/* Let the error reporting routines know that we're outside a
pop_cp_function_context and then reset via pop_function_context. */
current_function_decl = NULL_TREE;
}
+
+ return fndecl;
}
\f
/* Create the FUNCTION_DECL for a function definition.
}
else if (TREE_CODE (d) == FUNCTION_DECL)
{
- extern struct obstack *saveable_obstack;
- extern struct obstack *rtl_obstack;
-
/* Set up context. */
start_function (NULL_TREE, d, NULL_TREE, SF_PRE_PARSED);
store_parm_decls ();
- /* Anything we might
- want to save is going to have to be saved forever. Note that
- we don't want to save all kinds of temporary clutter that
- might end up on the temporary obstack so we don't want to
- call push_permanent_obstack. */
- push_obstacks_nochange ();
- saveable_obstack = &permanent_obstack;
- /* We only need this because of the cases where we generate
- RTL_EXPRs. We should really be generating RTL_EXPRs until
- final expansion time; when that is fixed, this can go. */
- rtl_obstack = &permanent_obstack;
/* Substitute into the body of the function. */
tsubst_expr (DECL_SAVED_TREE (code_pattern), args,
/*complain=*/1, tmpl);
- /* Clean up. */
- pop_obstacks ();
- finish_function (lineno, 0);
-
- /* Now, generate RTL for the function. */
- expand_body (d);
+ /* Finish the function. */
+ expand_body (finish_function (lineno, 0));
}
out:
case COMPOUND_EXPR:
case MODIFY_EXPR:
case INIT_EXPR:
+ case OFFSET_REF:
TRY (TREE_OPERAND (t, 0));
TRY (TREE_OPERAND (t, 1));
break;
case THROW_EXPR:
case EXIT_EXPR:
case LOOP_EXPR:
+ case BIT_FIELD_REF:
TRY (TREE_OPERAND (t, 0));
break;
case COMPOUND_EXPR:
case MODIFY_EXPR:
case INIT_EXPR:
+ case OFFSET_REF:
t = copy_node (t);
TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
TREE_OPERAND (t, 2) = mapcar (TREE_OPERAND (t, 2), func);
return t;
+ case BIT_FIELD_REF:
+ t = copy_node (t);
+ TREE_TYPE (t) = mapcar (TREE_TYPE (t), func);
+ TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
+ TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
+ TREE_OPERAND (t, 2) = mapcar (TREE_OPERAND (t, 2), func);
+ return t;
+
case LOOKUP_EXPR:
case EXIT_EXPR:
case LOOP_EXPR:
static void casts_away_constness_r PROTO((tree *, tree *));
static int casts_away_constness PROTO ((tree, tree));
-/* Return the target type of TYPE, which meas return T for:
+/* Return the target type of TYPE, which means return T for:
T*, T&, T[], T (...), and otherwise, just T. */
tree
}
}
#endif
+
+ /* Store the VALUE in DECL_INITIAL. If we're building a
+ statement-tree we will actually expand the initialization later
+ when we output this function. */
DECL_INITIAL (decl) = value;
return NULL_TREE;
}