summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/TGSourceMgr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-18 20:36:45 +0000
committerChris Lattner <sabre@nondot.org>2009-03-18 20:36:45 +0000
commit0f6dc78cfeed7ce60b6309e7401d2d77170ae717 (patch)
tree4b2292cd2ba9d547e74a5a8805e47d0075b5ee0b /llvm/utils/TableGen/TGSourceMgr.cpp
parent5def81401f499ddecb97243a008cc56f52674ac8 (diff)
downloadbcm5719-llvm-0f6dc78cfeed7ce60b6309e7401d2d77170ae717.tar.gz
bcm5719-llvm-0f6dc78cfeed7ce60b6309e7401d2d77170ae717.zip
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 llvm-svn: 67232
Diffstat (limited to 'llvm/utils/TableGen/TGSourceMgr.cpp')
-rw-r--r--llvm/utils/TableGen/TGSourceMgr.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/TGSourceMgr.cpp b/llvm/utils/TableGen/TGSourceMgr.cpp
index 9c39230def2..e4d1c40dc6c 100644
--- a/llvm/utils/TableGen/TGSourceMgr.cpp
+++ b/llvm/utils/TableGen/TGSourceMgr.cpp
@@ -28,7 +28,9 @@ TGSourceMgr::~TGSourceMgr() {
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;
}
OpenPOWER on IntegriCloud