aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/optimize.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2001-08-10 10:01:33 -0400
committerJason Merrill <jason@gcc.gnu.org>2001-08-10 10:01:33 -0400
commit07b2f2fd6efdf33ab13eb31fc8ea38668dbf6ed6 (patch)
treed9f451da73883db76d0425e08382fce4bb154737 /gcc/cp/optimize.c
parent67070ffeb0f10bcc841e87756d18eb85de1ab8a8 (diff)
downloadgcc-07b2f2fd6efdf33ab13eb31fc8ea38668dbf6ed6.zip
gcc-07b2f2fd6efdf33ab13eb31fc8ea38668dbf6ed6.tar.gz
gcc-07b2f2fd6efdf33ab13eb31fc8ea38668dbf6ed6.tar.bz2
c-common.h (RETURN_NULLIFIED_P): Lose.
* 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. From-SVN: r44762
Diffstat (limited to 'gcc/cp/optimize.c')
-rw-r--r--gcc/cp/optimize.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 22e1eec..c0ebb99 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -602,6 +602,23 @@ declare_return_variable (id, use_stmt)
(splay_tree_key) result,
(splay_tree_value) var);
+ if (DECL_SAVED_FUNCTION_DATA (fn))
+ {
+ tree nrv = DECL_SAVED_FUNCTION_DATA (fn)->x_return_value;
+ if (nrv)
+ {
+ /* We have a named return value; copy the name and source
+ position so we can get reasonable debugging information, and
+ register the return variable as its equivalent. */
+ DECL_NAME (var) = DECL_NAME (nrv);
+ DECL_SOURCE_FILE (var) = DECL_SOURCE_FILE (nrv);
+ DECL_SOURCE_LINE (var) = DECL_SOURCE_LINE (nrv);
+ splay_tree_insert (id->decl_map,
+ (splay_tree_key) nrv,
+ (splay_tree_value) var);
+ }
+ }
+
/* Build the USE_STMT. */
*use_stmt = build_stmt (EXPR_STMT, var);