diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-18 20:36:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-18 20:36:45 +0000 |
commit | d4771828caa4e3a0403cb32e6b1c6c96ffa41830 (patch) | |
tree | 970ca0dec0aff8ed286a7a07a6e5b454ae3be0cd /utils/TableGen/TGSourceMgr.cpp | |
parent | f10929dd31becaf61160a4c3a1d8eebfdd72aa63 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67232 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/TGSourceMgr.cpp')
-rw-r--r-- | utils/TableGen/TGSourceMgr.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/TableGen/TGSourceMgr.cpp b/utils/TableGen/TGSourceMgr.cpp index 9c39230def..e4d1c40dc6 100644 --- a/utils/TableGen/TGSourceMgr.cpp +++ b/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; } |