[llvm-commits] [llvm] r67232 - /llvm/trunk/utils/TableGen/TGSourceMgr.cpp

Chris Lattner sabre at nondot.org
Wed Mar 18 13:36:45 PDT 2009


Author: lattner
Date: Wed Mar 18 15:36:45 2009
New Revision: 67232

URL: http://llvm.org/viewvc/llvm-project?rev=67232&view=rev
Log:
include the null at the end of a memorybuffer as part of the buffer.
This allows tblgen to handle include "foo.td" when the quote is exactly
the last character in a file.  rdar://6695728

Modified:
    llvm/trunk/utils/TableGen/TGSourceMgr.cpp

Modified: llvm/trunk/utils/TableGen/TGSourceMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGSourceMgr.cpp?rev=67232&r1=67231&r2=67232&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TGSourceMgr.cpp (original)
+++ llvm/trunk/utils/TableGen/TGSourceMgr.cpp Wed Mar 18 15:36:45 2009
@@ -28,7 +28,9 @@
 int TGSourceMgr::FindBufferContainingLoc(TGLoc Loc) const {
   for (unsigned i = 0, e = Buffers.size(); i != e; ++i)
     if (Loc.getPointer() >= Buffers[i].Buffer->getBufferStart() &&
-        Loc.getPointer() <  Buffers[i].Buffer->getBufferEnd())
+        // Use <= here so that a pointer to the null at the end of the buffer
+        // is included as part of the buffer.
+        Loc.getPointer() <= Buffers[i].Buffer->getBufferEnd())
       return i;
   return -1;
 }





More information about the llvm-commits mailing list