[llvm] r221888 - Fixing -Wtype-limits warnings with the asserts (the expression would always evaluate to true). Also fixing a -Wcast-qual warning, where the cast expression isn't required.
Rafael EspĂndola
rafael.espindola at gmail.com
Thu Nov 13 06:09:09 PST 2014
thanks
On 13 November 2014 08:55, Aaron Ballman <aaron at aaronballman.com> wrote:
> Author: aaronballman
> Date: Thu Nov 13 07:55:13 2014
> New Revision: 221888
>
> URL: http://llvm.org/viewvc/llvm-project?rev=221888&view=rev
> Log:
> Fixing -Wtype-limits warnings with the asserts (the expression would always evaluate to true). Also fixing a -Wcast-qual warning, where the cast expression isn't required.
>
> Modified:
> llvm/trunk/lib/Support/StreamingMemoryObject.cpp
>
> Modified: llvm/trunk/lib/Support/StreamingMemoryObject.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StreamingMemoryObject.cpp?rev=221888&r1=221887&r2=221888&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Support/StreamingMemoryObject.cpp (original)
> +++ llvm/trunk/lib/Support/StreamingMemoryObject.cpp Thu Nov 13 07:55:13 2014
> @@ -59,9 +59,9 @@ uint64_t RawMemoryObject::readBytes(uint
> if (End > BufferSize)
> End = BufferSize;
>
> + assert(static_cast<int64_t>(End - Address) >= 0);
> Size = End - Address;
> - assert(Size >= 0);
> - memcpy(Buf, (uint8_t *)(Address + FirstChar), Size);
> + memcpy(Buf, Address + FirstChar, Size);
> return Size;
> }
>
> @@ -96,8 +96,8 @@ uint64_t StreamingMemoryObject::readByte
> uint64_t End = Address + Size;
> if (End > BytesRead)
> End = BytesRead;
> + assert(static_cast<int64_t>(End - Address) >= 0);
> Size = End - Address;
> - assert(Size >= 0);
> memcpy(Buf, &Bytes[Address + BytesSkipped], Size);
> return Size;
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list