[llvm-commits] [lld] Fix some warnings
Evandro Menezes
emenezes at codeaurora.org
Thu Apr 26 08:47:22 PDT 2012
Joerg,
Yes, I guess then that StringRef::size_type is better. See attachment.
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 10:40, Joerg Sonnenberger wrote:
> On Thu, Apr 26, 2012 at 10:37:04AM -0500, Evandro Menezes wrote:
>> With that said, there's only one warning:
>>
>> .../tools/lld/lib/Platforms/Darwin/ExecutableWriter.cpp:1222:30:
>> warning: comparison between signed and unsigned integer expressions
>> [-Wsign-compare]
>>
>> If this is worth getting rid off, is this patch OK?
>
> Like I said, shouldn't that be either size_t or StringRef::size_type?
> Otherwise it looks ok.
>
> Joerg
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
Index: lib/Platforms/Darwin/ExecutableWriter.cpp
===================================================================
--- lib/Platforms/Darwin/ExecutableWriter.cpp (revision 155577)
+++ lib/Platforms/Darwin/ExecutableWriter.cpp (working copy)
@@ -912,7 +912,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) {
+ for (auto i=str.size(); i > 0; --i) {
_bytes.push_back(*s++);
}
_bytes.push_back('\0');
@@ -1219,7 +1219,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) {
+ for (StringRef::size_type i=0; i < str.size(); ++i) {
_strings.push_back(s[i]);
}
_strings.push_back('\0');
More information about the llvm-commits
mailing list