[llvm-commits] [lld] Fix some warnings

Evandro Menezes emenezes at codeaurora.org
Thu Apr 26 11:53:46 PDT 2012


Michael,

It makes a lot of sense.

Thanks,

-- 
Evandro Menezes          Austin, TX          emenezes at codeaurora.org
Qualcomm Innovation Center, Inc is a member of the Code Aurora Forum


On 04/26/12 13:39, Michael Spencer wrote:
> _bytes.insert(_bytes.end(), str.begin(), str.end());
-------------- next part --------------
Index: lib/Platforms/Darwin/ExecutableWriter.cpp
===================================================================
--- lib/Platforms/Darwin/ExecutableWriter.cpp	(revision 155644)
+++ lib/Platforms/Darwin/ExecutableWriter.cpp	(working copy)
@@ -911,10 +911,7 @@ void DyldInfoChunk::append_byte(uint8_t b) {
 }
 
 void DyldInfoChunk::append_string(StringRef str) {
-  const char *s = str.data();
-  for (int i=str.size(); i > 0; --i) {
-    _bytes.push_back(*s++);
-  }
+  _bytes.insert(_bytes.end(), str.begin(), str.end());
   _bytes.push_back('\0');
 }
 
@@ -1219,9 +1216,7 @@ void SymbolStringsChunk::computeSize(const lld::Fi
 uint32_t SymbolStringsChunk::stringIndex(StringRef str) {
   uint32_t result = _strings.size();
   const char* s = str.data();
-  for (int i=0; i < str.size(); ++i) {
-    _strings.push_back(s[i]);
-  }
+  _strings.insert(_strings.end(), str.begin(), str.end());
   _strings.push_back('\0');
   return result;
 }


More information about the llvm-commits mailing list