compiler: use const std::string& in a couple of places
authorIan Lance Taylor <iant@golang.org>
Mon, 11 May 2020 22:28:55 +0000 (15:28 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 11 May 2020 23:11:04 +0000 (16:11 -0700)
Use a reference to avoid copying a std::string.

Fixes go/94766

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/233320

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/gogo.h
gcc/go/gofrontend/names.cc

index 5aecee18dd6a42c8dbcc85beae22aaa57897a596..428b329382b30b0a37448034fdca1479a898c2e1 100644 (file)
@@ -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.
index 7d83119b698b9a3c0b8f80f94ef5f71a11679463..2fb8a3aeb4341400952dd27e505ce779106abea9 100644 (file)
@@ -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)
index f4ad181515b835ce7a8ac6bf49be5e7f22f376b1..a721a364212bec751f4f4b7cf84c5b0d33aee294 100644 (file)
@@ -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";
 }