OSDN Git Service

compiler: Fix a couple of type reflection strings.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Oct 2012 23:50:38 +0000 (23:50 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Oct 2012 23:50:38 +0000 (23:50 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@192015 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/types.cc

index b7fbc91..90856a0 100644 (file)
@@ -4928,14 +4928,15 @@ Struct_type::write_equal_function(Gogo* gogo, Named_type* name)
 void
 Struct_type::do_reflection(Gogo* gogo, std::string* ret) const
 {
-  ret->append("struct { ");
+  ret->append("struct {");
 
   for (Struct_field_list::const_iterator p = this->fields_->begin();
        p != this->fields_->end();
        ++p)
     {
       if (p != this->fields_->begin())
-       ret->append("; ");
+       ret->push_back(';');
+      ret->push_back(' ');
       if (p->is_anonymous())
        ret->push_back('?');
       else
@@ -4968,7 +4969,10 @@ Struct_type::do_reflection(Gogo* gogo, std::string* ret) const
        }
     }
 
-  ret->append(" }");
+  if (!this->fields_->empty())
+    ret->push_back(' ');
+
+  ret->push_back('}');
 }
 
 // Mangled name.
@@ -8399,6 +8403,7 @@ Named_type::do_reflection(Gogo* gogo, std::string* ret) const
     }
   if (this->in_function_ != NULL)
     {
+      ret->push_back('\t');
       ret->append(Gogo::unpack_hidden_name(this->in_function_->name()));
       ret->push_back('$');
       if (this->in_function_index_ > 0)
@@ -8408,6 +8413,7 @@ Named_type::do_reflection(Gogo* gogo, std::string* ret) const
          ret->append(buf);
          ret->push_back('$');
        }
+      ret->push_back('\t');
     }
   ret->append(Gogo::unpack_hidden_name(this->named_object_->name()));
 }