compiler: rename "requires" to "needs"
As of C++20 "requires" is a C++ keyword.
Change-Id: Ie57d19f90c603bb5cc10709b56abe40b97196916
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415754
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
diff --git a/go/gogo.cc b/go/gogo.cc
index e13df0d..67b91fa 100644
--- a/go/gogo.cc
+++ b/go/gogo.cc
@@ -5302,16 +5302,16 @@
Named_object* no = types.front();
types.pop_front();
- std::vector<const Named_object*> requires;
+ std::vector<const Named_object*> needs;
std::vector<const Named_object*> declare;
- if (!no->type_value()->struct_type()->can_write_to_c_header(&requires,
+ if (!no->type_value()->struct_type()->can_write_to_c_header(&needs,
&declare))
continue;
bool ok = true;
for (std::vector<const Named_object*>::const_iterator pr
- = requires.begin();
- pr != requires.end() && ok;
+ = needs.begin();
+ pr != needs.end() && ok;
++pr)
{
for (std::list<Named_object*>::const_iterator pt = types.begin();
@@ -5342,10 +5342,10 @@
if (*pd == no)
continue;
- std::vector<const Named_object*> drequires;
+ std::vector<const Named_object*> dneeds;
std::vector<const Named_object*> ddeclare;
if (!(*pd)->type_value()->struct_type()->
- can_write_to_c_header(&drequires, &ddeclare))
+ can_write_to_c_header(&dneeds, &ddeclare))
continue;
bool done = false;
diff --git a/go/types.cc b/go/types.cc
index e82be68..4995283 100644
--- a/go/types.cc
+++ b/go/types.cc
@@ -6967,7 +6967,7 @@
bool
Struct_type::can_write_to_c_header(
- std::vector<const Named_object*>* requires,
+ std::vector<const Named_object*>* needs,
std::vector<const Named_object*>* declare) const
{
const Struct_field_list* fields = this->fields_;
@@ -6978,7 +6978,7 @@
p != fields->end();
++p)
{
- if (!this->can_write_type_to_c_header(p->type(), requires, declare))
+ if (!this->can_write_type_to_c_header(p->type(), needs, declare))
return false;
if (Gogo::message_name(p->field_name()) == "_")
sinks++;
@@ -6993,7 +6993,7 @@
bool
Struct_type::can_write_type_to_c_header(
const Type* t,
- std::vector<const Named_object*>* requires,
+ std::vector<const Named_object*>* needs,
std::vector<const Named_object*>* declare) const
{
t = t->forwarded();
@@ -7027,13 +7027,13 @@
return true;
case TYPE_STRUCT:
- return t->struct_type()->can_write_to_c_header(requires, declare);
+ return t->struct_type()->can_write_to_c_header(needs, declare);
case TYPE_ARRAY:
if (t->is_slice_type())
return true;
return this->can_write_type_to_c_header(t->array_type()->element_type(),
- requires, declare);
+ needs, declare);
case TYPE_NAMED:
{
@@ -7049,10 +7049,10 @@
// We will accept empty struct fields, but not print them.
if (t->struct_type()->total_field_count() == 0)
return true;
- requires->push_back(no);
- return t->struct_type()->can_write_to_c_header(requires, declare);
+ needs->push_back(no);
+ return t->struct_type()->can_write_to_c_header(needs, declare);
}
- return this->can_write_type_to_c_header(t->base(), requires, declare);
+ return this->can_write_type_to_c_header(t->base(), needs, declare);
}
case TYPE_CALL_MULTIPLE_RESULT:
@@ -7150,9 +7150,9 @@
case TYPE_POINTER:
{
- std::vector<const Named_object*> requires;
+ std::vector<const Named_object*> needs;
std::vector<const Named_object*> declare;
- if (!this->can_write_type_to_c_header(t->points_to(), &requires,
+ if (!this->can_write_type_to_c_header(t->points_to(), &needs,
&declare))
os << "void*";
else