diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-04-06 15:53:59 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-04-06 15:53:59 +0000 |
commit | 60bfabcd8ce617297c0d231f77d14ab507e98796 (patch) | |
tree | 59c928209f8007777dd96568b026bdfe200691de /lib/Lex | |
parent | 2c56c396ce5990954f85194029eeb391bc3529ff (diff) | |
download | src-test2-60bfabcd8ce617297c0d231f77d14ab507e98796.tar.gz src-test2-60bfabcd8ce617297c0d231f77d14ab507e98796.zip |
Notes
Diffstat (limited to 'lib/Lex')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 8b4b1ddf4149..4598383c1c93 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -258,9 +258,10 @@ bool Preprocessor::SetCodeCompletionPoint(const FileEntry *File, // Truncate the buffer. if (Position < Buffer->getBufferEnd()) { + llvm::StringRef Data(Buffer->getBufferStart(), + Position-Buffer->getBufferStart()); MemoryBuffer *TruncatedBuffer - = MemoryBuffer::getMemBufferCopy(Buffer->getBufferStart(), Position, - Buffer->getBufferIdentifier()); + = MemoryBuffer::getMemBufferCopy(Data, Buffer->getBufferIdentifier()); SourceMgr.overrideFileContents(File, TruncatedBuffer); } @@ -508,9 +509,7 @@ bool Preprocessor::EnterMainSourceFile() { // Preprocess Predefines to populate the initial preprocessor state. llvm::MemoryBuffer *SB = - llvm::MemoryBuffer::getMemBufferCopy(Predefines.data(), - Predefines.data() + Predefines.size(), - "<built-in>"); + llvm::MemoryBuffer::getMemBufferCopy(Predefines, "<built-in>"); assert(SB && "Cannot fail to create predefined source buffer"); FileID FID = SourceMgr.createFileIDForMemBuffer(SB); assert(!FID.isInvalid() && "Could not create FileID for predefines?"); |