OSDN Git Service

Don't assert when given an empty range.
authorKaelyn Uhrain <rikka@google.com>
Wed, 20 Jun 2012 00:16:40 +0000 (00:16 +0000)
committerKaelyn Uhrain <rikka@google.com>
Wed, 20 Jun 2012 00:16:40 +0000 (00:16 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158769 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/StreamableMemoryObject.cpp

index c23f07b..fe3752a 100644 (file)
@@ -20,7 +20,7 @@ class RawMemoryObject : public StreamableMemoryObject {
 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; }