[llvm-commits] [126202] Fix assertion that was off by one.

dpatel at apple.com dpatel at apple.com
Mon Apr 16 11:11:24 PDT 2007


Revision: 126202
Author:   dpatel
Date:     2007-04-16 11:11:23 -0700 (Mon, 16 Apr 2007)

Log Message:
-----------
Fix assertion that was off by one. Update comments.
Patch by Duncan Sands.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/llvm-types.cpp

Modified: apple-local/branches/llvm/gcc/llvm-types.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-types.cpp	2007-04-16 18:10:57 UTC (rev 126201)
+++ apple-local/branches/llvm/gcc/llvm-types.cpp	2007-04-16 18:11:23 UTC (rev 126202)
@@ -1256,14 +1256,12 @@
   unsigned StartOffsetInBits = getFieldOffsetInBits(Field);
   unsigned EndBitOffset    = FieldSizeInBits+StartOffsetInBits;
   
-  // If  the last inserted LLVM field completely contains this bitfield, just
+  // If the last inserted LLVM field completely contains this bitfield, just
   // ignore this field.
   if (!Info.Elements.empty()) {
-    // If the last field does not completely contain *this* bitfield, extend
-    // it.
     unsigned LastFieldBitOffset = Info.ElementOffsetInBytes.back()*8;
     unsigned LastFieldBitSize   = Info.ElementSizeInBytes.back()*8;
-    assert(LastFieldBitOffset < StartOffsetInBits &&
+    assert(LastFieldBitOffset <= StartOffsetInBits &&
            "This bitfield isn't part of the last field!");
     if (EndBitOffset <= LastFieldBitOffset+LastFieldBitSize &&
         LastFieldBitOffset+LastFieldBitSize >= StartOffsetInBits) {





More information about the llvm-commits mailing list