summaryrefslogtreecommitdiffstats
path: root/gcc/cp/optimize.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2005-10-14 16:36:49 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2005-10-14 16:36:49 +0000
commitff64eef02512719a04954882b396332eea7c2e74 (patch)
treebd89fe14baea44bc1be6e47a3864aa646430f170 /gcc/cp/optimize.c
parentdc0a05d1230076ec8ae93fe4738d2e1d6cae6571 (diff)
downloadppe42-gcc-ff64eef02512719a04954882b396332eea7c2e74.tar.gz
ppe42-gcc-ff64eef02512719a04954882b396332eea7c2e74.zip
PR c++/17796
* optimize.c (update_cloned_parm): Add FIRST parameter. Use it. (maybe_clone_body): Track the first clone. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105415 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/optimize.c')
-rw-r--r--gcc/cp/optimize.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 7bca77de036..7ac24376ed1 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -45,7 +45,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
/* Prototypes. */
-static void update_cloned_parm (tree, tree);
+static void update_cloned_parm (tree, tree, bool);
/* CLONED_PARM is a copy of CLONE, generated for a cloned constructor
or destructor. Update it to ensure that the source-position for
@@ -53,7 +53,7 @@ static void update_cloned_parm (tree, tree);
debugging generation code will be able to find the original PARM. */
static void
-update_cloned_parm (tree parm, tree cloned_parm)
+update_cloned_parm (tree parm, tree cloned_parm, bool first)
{
DECL_ABSTRACT_ORIGIN (cloned_parm) = parm;
@@ -63,7 +63,7 @@ update_cloned_parm (tree parm, tree cloned_parm)
/* The definition might have different constness. */
TREE_READONLY (cloned_parm) = TREE_READONLY (parm);
- TREE_USED (cloned_parm) = TREE_USED (parm);
+ TREE_USED (cloned_parm) = !first || TREE_USED (parm);
/* The name may have changed from the declaration. */
DECL_NAME (cloned_parm) = DECL_NAME (parm);
@@ -79,6 +79,7 @@ bool
maybe_clone_body (tree fn)
{
tree clone;
+ bool first = true;
/* We only clone constructors and destructors. */
if (!DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
@@ -118,7 +119,7 @@ maybe_clone_body (tree fn)
parm = DECL_ARGUMENTS (fn);
clone_parm = DECL_ARGUMENTS (clone);
/* Update the `this' parameter, which is always first. */
- update_cloned_parm (parm, clone_parm);
+ update_cloned_parm (parm, clone_parm, first);
parm = TREE_CHAIN (parm);
clone_parm = TREE_CHAIN (clone_parm);
if (DECL_HAS_IN_CHARGE_PARM_P (fn))
@@ -130,7 +131,7 @@ maybe_clone_body (tree fn)
for (; parm;
parm = TREE_CHAIN (parm), clone_parm = TREE_CHAIN (clone_parm))
/* Update this parameter. */
- update_cloned_parm (parm, clone_parm);
+ update_cloned_parm (parm, clone_parm, first);
/* Start processing the function. */
start_preparsed_function (clone, NULL_TREE, SF_PRE_PARSED);
@@ -206,6 +207,7 @@ maybe_clone_body (tree fn)
finish_function (0);
BLOCK_ABSTRACT_ORIGIN (DECL_INITIAL (clone)) = DECL_INITIAL (fn);
expand_or_defer_fn (clone);
+ first = false;
}
pop_from_top_level ();
OpenPOWER on IntegriCloud