Go frontend patch committed: Use some const string references

Ian Lance Taylor iant@golang.org
Mon May 11 23:11:18 GMT 2020


This patch to the Go frontend uses const string references in a couple
of places that were using plain std::string.  This will save some
std::string copying.  This fixes GCC PR 94766.  Bootstrapped and ran
Go testsuite on x86_64-pc-linux-gnu.  Committed to master.

Ian
-------------- next part --------------
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 5aecee18dd6..428b329382b 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-761d68dacefc578e45ff299761f20989aef67823
+41019d50ae519328dd3cf200815a2a2b0b64674e
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 7d83119b698..2fb8a3aeb43 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -958,7 +958,7 @@ class Gogo
 
   // 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 @@ class Gogo
 
     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/gcc/go/gofrontend/names.cc b/gcc/go/gofrontend/names.cc
index f4ad181515b..a721a364212 100644
--- a/gcc/go/gofrontend/names.cc
+++ b/gcc/go/gofrontend/names.cc
@@ -1024,7 +1024,7 @@ Gogo::type_descriptor_name(const Type* type, Named_type* nt)
 // 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";
 }


More information about the Gcc-patches mailing list