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

Kaelyn Uhrain rikka at google.com
Tue Jun 19 17:16:40 PDT 2012


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.

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; }





More information about the llvm-commits mailing list