aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/escape.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-10-18 23:02:27 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-10-18 23:02:27 +0000
commit8cc43cb40362b9120858264a853c0222c35fe7e7 (patch)
tree1bac7b3644e81e33e652af19554db46415c47971 /gcc/go/gofrontend/escape.cc
parent0799a08b5c6a2087de9512252be6d9192e92395a (diff)
downloadgcc-8cc43cb40362b9120858264a853c0222c35fe7e7.zip
gcc-8cc43cb40362b9120858264a853c0222c35fe7e7.tar.gz
gcc-8cc43cb40362b9120858264a853c0222c35fe7e7.tar.bz2
Revert SVN revision 264561, incorrectly committed directly to the GCC
repo rather than to the master repo. From-SVN: r265294
Diffstat (limited to 'gcc/go/gofrontend/escape.cc')
-rw-r--r--gcc/go/gofrontend/escape.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/go/gofrontend/escape.cc b/gcc/go/gofrontend/escape.cc
index eb23c2d..b56b4d0 100644
--- a/gcc/go/gofrontend/escape.cc
+++ b/gcc/go/gofrontend/escape.cc
@@ -979,7 +979,7 @@ Gogo::analyze_escape()
for (std::vector<Named_object*>::iterator fn = stack.begin();
fn != stack.end();
++fn)
- this->tag_function(*fn);
+ this->tag_function(context, *fn);
if (this->debug_escape_level() != 0)
{
@@ -1232,10 +1232,10 @@ Escape_analysis_loop::statement(Block*, size_t*, Statement* s)
class Escape_analysis_assign : public Traverse
{
public:
- Escape_analysis_assign(Escape_context* context)
+ Escape_analysis_assign(Escape_context* context, Named_object* fn)
: Traverse(traverse_statements
| traverse_expressions),
- context_(context)
+ context_(context), fn_(fn)
{ }
// Model statements within a function as assignments and flows between nodes.
@@ -1272,6 +1272,8 @@ public:
private:
// The escape context for this set of functions.
Escape_context* context_;
+ // The current function being analyzed.
+ Named_object* fn_;
};
// Helper function to detect self assignment like the following.
@@ -2702,7 +2704,7 @@ Gogo::assign_connectivity(Escape_context* context, Named_object* fn)
int save_depth = context->loop_depth();
context->set_loop_depth(1);
- Escape_analysis_assign ea(context);
+ Escape_analysis_assign ea(context, fn);
Function::Results* res = fn->func_value()->result_variables();
if (res != NULL)
{
@@ -3265,13 +3267,17 @@ Gogo::propagate_escape(Escape_context* context, Node* dst)
class Escape_analysis_tag
{
public:
- Escape_analysis_tag()
+ Escape_analysis_tag(Escape_context* context)
+ : context_(context)
{ }
// Add notes to the function's type about the escape information of its
// input parameters.
void
tag(Named_object* fn);
+
+ private:
+ Escape_context* context_;
};
void
@@ -3379,9 +3385,9 @@ Escape_analysis_tag::tag(Named_object* fn)
// retain analysis results across imports.
void
-Gogo::tag_function(Named_object* fn)
+Gogo::tag_function(Escape_context* context, Named_object* fn)
{
- Escape_analysis_tag eat;
+ Escape_analysis_tag eat(context);
eat.tag(fn);
}