diff options
| author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-10 14:01:33 +0000 |
|---|---|---|
| committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-10 14:01:33 +0000 |
| commit | 4cfd90300764d601a319883f5979fcea67d829a7 (patch) | |
| tree | d9f451da73883db76d0425e08382fce4bb154737 /gcc/cp/decl.c | |
| parent | bba852750618143960eb4faff66df9dfa1c4b715 (diff) | |
| download | ppe42-gcc-4cfd90300764d601a319883f5979fcea67d829a7.tar.gz ppe42-gcc-4cfd90300764d601a319883f5979fcea67d829a7.zip | |
* c-common.h (RETURN_NULLIFIED_P): Lose.
* c-semantics.c (genrtl_return_stmt): Don't check it.
Support named return value optimization for inlines, too.
* decl.c (finish_function): Nullify returns here.
* semantics.c (genrtl_start_function): Not here.
(cp_expand_stmt): Don't mess with CLEANUP_STMTs.
(nullify_returns_r): No longer static. Just clear RETURN_EXPR.
Also nullify the CLEANUP_STMT for the nrv.
* cp-tree.h: Declare it.
* optimize.c (declare_return_variable): Replace the nrv with the
return variable.
* typeck.c (check_return_expr): Be more flexible on alignment check.
Ignore cv-quals when checking for a matching type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44762 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
| -rw-r--r-- | gcc/cp/decl.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9ad8b76dc61..8fffdb88d82 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13955,6 +13955,28 @@ finish_function (flags) my_friendly_abort (122); poplevel (1, 0, 1); + /* Set up the named return value optimization, if we can. Here, we + eliminate the copy from the nrv into the RESULT_DECL and any cleanup + for the nrv. genrtl_start_function and declare_return_variable + handle making the nrv and RESULT_DECL share space. */ + if (current_function_return_value) + { + tree r = current_function_return_value; + /* This is only worth doing for fns that return in memory--and + simpler, since we don't have to worry about promoted modes. */ + if (r != error_mark_node + && aggregate_value_p (TREE_TYPE (TREE_TYPE (fndecl)))) + { + DECL_ALIGN (r) = DECL_ALIGN (DECL_RESULT (fndecl)); + walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl), + nullify_returns_r, r); + } + else + /* Clear it so genrtl_start_function and declare_return_variable + know we're not optimizing. */ + current_function_return_value = NULL_TREE; + } + /* Remember that we were in class scope. */ if (current_class_name) ctype = current_class_type; |

