aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2002-08-02 07:52:38 -0400
committerJason Merrill <jason@gcc.gnu.org>2002-08-02 07:52:38 -0400
commit367aa58580632b0bef67f5bbcc41009eb8a09381 (patch)
tree614fc3d0851f4bac9d99a7deabcd571259d62a9f /gcc
parenta6be5aeed5b63c9e774110910a81b16a51b8f89d (diff)
downloadgcc-367aa58580632b0bef67f5bbcc41009eb8a09381.zip
gcc-367aa58580632b0bef67f5bbcc41009eb8a09381.tar.gz
gcc-367aa58580632b0bef67f5bbcc41009eb8a09381.tar.bz2
semantics.c (expand_body): Do tree optimization in the function context, too.
* semantics.c (expand_body): Do tree optimization in the function context, too. From-SVN: r55982
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/semantics.c20
2 files changed, 17 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 84b1a98..f9e22ca 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2002-08-02 Jason Merrill <jason@redhat.com>
+
+ * semantics.c (expand_body): Do tree optimization in the function
+ context, too.
+
2002-08-01 Neil Booth <neil@daikokuya.co.uk>
* cp-tree.h: Move all warning and flag declarations to c-common.h.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 7098aae..58d1647 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2326,6 +2326,7 @@ expand_body (fn)
{
int saved_lineno;
const char *saved_input_filename;
+ tree saved_function;
/* When the parser calls us after finishing the body of a template
function, we don't really want to expand the body. When we're
@@ -2403,21 +2404,23 @@ expand_body (fn)
if (DECL_EXTERNAL (fn))
return;
- timevar_push (TV_INTEGRATION);
-
- /* Optimize the body of the function before expanding it. */
- optimize_function (fn);
-
- timevar_pop (TV_INTEGRATION);
- timevar_push (TV_EXPAND);
-
/* Save the current file name and line number. When we expand the
body of the function, we'll set LINENO and INPUT_FILENAME so that
error-mesages come out in the right places. */
saved_lineno = lineno;
saved_input_filename = input_filename;
+ saved_function = current_function_decl;
lineno = DECL_SOURCE_LINE (fn);
input_filename = DECL_SOURCE_FILE (fn);
+ current_function_decl = fn;
+
+ timevar_push (TV_INTEGRATION);
+
+ /* Optimize the body of the function before expanding it. */
+ optimize_function (fn);
+
+ timevar_pop (TV_INTEGRATION);
+ timevar_push (TV_EXPAND);
genrtl_start_function (fn);
current_function_is_thunk = DECL_THUNK_P (fn);
@@ -2450,6 +2453,7 @@ expand_body (fn)
DECL_SAVED_TREE (fn) = NULL_TREE;
/* And restore the current source position. */
+ current_function_decl = saved_function;
lineno = saved_lineno;
input_filename = saved_input_filename;
extract_interface_info ();