compiler: remove unused fields
This avoids clang warnings:
gcc/go/gofrontend/escape.cc:1290:17: warning: private field 'fn_' is not used [-Wunused-private-field]
gcc/go/gofrontend/escape.cc:3478:19: warning: private field 'context_' is not used [-Wunused-private-field]
gcc/go/gofrontend/lex.h:564:15: warning: private field 'input_file_name_' is not used [-Wunused-private-field]
gcc/go/gofrontend/types.cc:5788:20: warning: private field 'call_' is not used [-Wunused-private-field]
gcc/go/gofrontend/wb.cc:206:9: warning: private field 'gogo_' is not used [-Wunused-private-field]
Path by Martin Liška.
Change-Id: I3c1721b26454ba4811991f1e4272918c9bd24421
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458975
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/go/escape.cc b/go/escape.cc
index 6da29ed..89e6442 100644
--- a/go/escape.cc
+++ b/go/escape.cc
@@ -990,7 +990,7 @@
for (std::vector<Named_object*>::iterator fn = stack.begin();
fn != stack.end();
++fn)
- this->tag_function(context, *fn);
+ this->tag_function(*fn);
if (this->debug_escape_level() != 0)
{
@@ -1246,10 +1246,10 @@
class Escape_analysis_assign : public Traverse
{
public:
- Escape_analysis_assign(Escape_context* context, Named_object* fn)
+ Escape_analysis_assign(Escape_context* context)
: Traverse(traverse_statements
| traverse_expressions),
- context_(context), fn_(fn)
+ context_(context)
{ }
// Model statements within a function as assignments and flows between nodes.
@@ -1286,8 +1286,6 @@
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.
@@ -2899,7 +2897,7 @@
int save_depth = context->loop_depth();
context->set_loop_depth(1);
- Escape_analysis_assign ea(context, fn);
+ Escape_analysis_assign ea(context);
Function::Results* res = fn->func_value()->result_variables();
if (res != NULL)
{
@@ -3465,17 +3463,13 @@
class Escape_analysis_tag
{
public:
- Escape_analysis_tag(Escape_context* context)
- : context_(context)
+ Escape_analysis_tag()
{ }
// 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
@@ -3580,9 +3574,9 @@
// retain analysis results across imports.
void
-Gogo::tag_function(Escape_context* context, Named_object* fn)
+Gogo::tag_function(Named_object* fn)
{
- Escape_analysis_tag eat(context);
+ Escape_analysis_tag eat;
eat.tag(fn);
}
diff --git a/go/expressions.cc b/go/expressions.cc
index 71838b1..5390130 100644
--- a/go/expressions.cc
+++ b/go/expressions.cc
@@ -12500,7 +12500,7 @@
else if (results->size() == 1)
ret = results->begin()->type();
else
- ret = Type::make_call_multiple_result_type(this);
+ ret = Type::make_call_multiple_result_type();
this->type_ = ret;
diff --git a/go/gogo.h b/go/gogo.h
index 433fdae..c08a16b 100644
--- a/go/gogo.h
+++ b/go/gogo.h
@@ -879,7 +879,7 @@
// Add notes about the escape level of a function's input and output
// parameters for exporting and importing top level functions.
void
- tag_function(Escape_context*, Named_object*);
+ tag_function(Named_object*);
// Reclaim memory of escape analysis Nodes.
void
diff --git a/go/lex.h b/go/lex.h
index 1c4cc5b..701e5d4 100644
--- a/go/lex.h
+++ b/go/lex.h
@@ -561,7 +561,7 @@
gather_embed(const char*, const char*);
// The input file name.
- const char* input_file_name_;
+ const char* input_file_name_ ATTRIBUTE_UNUSED;
// The input file.
FILE* input_file_;
// The object used to keep track of file names and line numbers.
diff --git a/go/types.cc b/go/types.cc
index 9f34801..7f471ea 100644
--- a/go/types.cc
+++ b/go/types.cc
@@ -5747,9 +5747,8 @@
class Call_multiple_result_type : public Type
{
public:
- Call_multiple_result_type(Call_expression* call)
- : Type(TYPE_CALL_MULTIPLE_RESULT),
- call_(call)
+ Call_multiple_result_type()
+ : Type(TYPE_CALL_MULTIPLE_RESULT)
{ }
protected:
@@ -5782,18 +5781,14 @@
void
do_mangled_name(Gogo*, std::string*, bool*) const
{ go_assert(saw_errors()); }
-
- private:
- // The expression being called.
- Call_expression* call_;
};
// Make a call result type.
Type*
-Type::make_call_multiple_result_type(Call_expression* call)
+Type::make_call_multiple_result_type()
{
- return new Call_multiple_result_type(call);
+ return new Call_multiple_result_type;
}
// Class Struct_field.
diff --git a/go/types.h b/go/types.h
index 49404bd..057fa01 100644
--- a/go/types.h
+++ b/go/types.h
@@ -535,7 +535,7 @@
make_nil_type();
static Type*
- make_call_multiple_result_type(Call_expression*);
+ make_call_multiple_result_type();
static Struct_type*
make_struct_type(Struct_field_list* fields, Location);
diff --git a/go/wb.cc b/go/wb.cc
index 104c5db..e039c66 100644
--- a/go/wb.cc
+++ b/go/wb.cc
@@ -191,9 +191,8 @@
class Check_escape : public Traverse
{
public:
- Check_escape(Gogo* gogo)
- : Traverse(traverse_expressions | traverse_variables),
- gogo_(gogo)
+ Check_escape()
+ : Traverse(traverse_expressions | traverse_variables)
{ }
int
@@ -201,9 +200,6 @@
int
variable(Named_object*);
-
- private:
- Gogo* gogo_;
};
int
@@ -664,7 +660,7 @@
{
this->propagate_writebarrierrec();
- Check_escape chk(this);
+ Check_escape chk;
this->traverse(&chk);
}