[llvm-commits] [llvm] r158769 - /llvm/trunk/lib/Support/StreamableMemoryObject.cpp

Chandler Carruth chandlerc at google.com
Tue Jun 19 17:36:15 PDT 2012


On Tue, Jun 19, 2012 at 5:16 PM, Kaelyn Uhrain <rikka at google.com> wrote:

> Author: rikka
> Date: Tue Jun 19 19:16:40 2012
> New Revision: 158769
>
> URL: http://llvm.org/viewvc/llvm-project?rev=158769&view=rev
> Log:
> Don't assert when given an empty range.
>
> llvm::RawMemoryObject handles empty ranges just fine, and the assert can
> be triggered in the wild by e.g. invoking clang with a file that
> included an empty pre-compiled header file when clang has been built
> with assertions enabled. Without assertions enabled, clang will properly
> report that the empty file is not a valid PCH.
>

Add a test case that builds an empty pre-compiled header and invokes clang
with it?


>
> Modified:
>    llvm/trunk/lib/Support/StreamableMemoryObject.cpp
>
> Modified: llvm/trunk/lib/Support/StreamableMemoryObject.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StreamableMemoryObject.cpp?rev=158769&r1=158768&r2=158769&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Support/StreamableMemoryObject.cpp (original)
> +++ llvm/trunk/lib/Support/StreamableMemoryObject.cpp Tue Jun 19 19:16:40
> 2012
> @@ -20,7 +20,7 @@
>  public:
>   RawMemoryObject(const unsigned char *Start, const unsigned char *End) :
>     FirstChar(Start), LastChar(End) {
> -    assert(LastChar > FirstChar && "Invalid start/end range");
> +    assert(LastChar >= FirstChar && "Invalid start/end range");
>   }
>
>   virtual uint64_t getBase() const { return 0; }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120619/63460a5e/attachment.html>


More information about the llvm-commits mailing list