compiler: use const std::string& in a couple of places
Use a reference to avoid copying a std::string.
Fixes https://gcc.gnu.org/PR94766
Change-Id: Icd28fda48a795fe88c82fb7f57c6cfa2c8593f2a
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/233320
Reviewed-by: Cherry Zhang <cherryyz@google.com>
diff --git a/go/gogo.h b/go/gogo.h
index 7d83119..2fb8a3a 100644
--- a/go/gogo.h
+++ b/go/gogo.h
@@ -958,7 +958,7 @@
// Return the name of the type descriptor list symbol of a package.
std::string
- type_descriptor_list_symbol(std::string);
+ type_descriptor_list_symbol(const std::string&);
// Return the name of the list of all type descriptor lists.
std::string
@@ -1073,7 +1073,7 @@
Specific_type_function(Type* atype, Named_type* aname, int64_t asize,
Specific_type_function_kind akind,
- const std::string afnname,
+ const std::string& afnname,
Function_type* afntype)
: type(atype), name(aname), size(asize), kind(akind),
fnname(afnname), fntype(afntype)
diff --git a/go/names.cc b/go/names.cc
index f4ad181..a721a36 100644
--- a/go/names.cc
+++ b/go/names.cc
@@ -1024,7 +1024,7 @@
// Return the name of the type descriptor list symbol of a package.
std::string
-Gogo::type_descriptor_list_symbol(std::string pkgpath)
+Gogo::type_descriptor_list_symbol(const std::string& pkgpath)
{
return pkgpath + "..types";
}