[cfe-commits] r100484 - in /cfe/trunk: lib/AST/ASTImporter.cpp lib/Frontend/FrontendAction.cpp lib/Frontend/PCHReader.cpp lib/Lex/Preprocessor.cpp tools/CIndex/CIndex.cpp
Chris Lattner
sabre at nondot.org
Mon Apr 5 15:42:27 PDT 2010
Author: lattner
Date: Mon Apr 5 17:42:27 2010
New Revision: 100484
URL: http://llvm.org/viewvc/llvm-project?rev=100484&view=rev
Log:
Match MemoryBuffer API changes.
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/Frontend/FrontendAction.cpp
cfe/trunk/lib/Frontend/PCHReader.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
cfe/trunk/tools/CIndex/CIndex.cpp
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=100484&r1=100483&r2=100484&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Mon Apr 5 17:42:27 2010
@@ -3088,8 +3088,7 @@
// FIXME: We want to re-use the existing MemoryBuffer!
const llvm::MemoryBuffer *FromBuf = Cache->getBuffer(getDiags());
llvm::MemoryBuffer *ToBuf
- = llvm::MemoryBuffer::getMemBufferCopy(FromBuf->getBufferStart(),
- FromBuf->getBufferEnd(),
+ = llvm::MemoryBuffer::getMemBufferCopy(FromBuf->getBuffer(),
FromBuf->getBufferIdentifier());
ToID = ToSM.createFileIDForMemBuffer(ToBuf);
}
Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=100484&r1=100483&r2=100484&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Mon Apr 5 17:42:27 2010
@@ -136,7 +136,7 @@
// simplest way to reuse the logic in ParseAST.
const char *EmptyStr = "";
llvm::MemoryBuffer *SB =
- llvm::MemoryBuffer::getMemBuffer(EmptyStr, EmptyStr, "<dummy input>");
+ llvm::MemoryBuffer::getMemBuffer(EmptyStr, "<dummy input>");
CI.getSourceManager().createMainFileIDForMemBuffer(SB);
} else {
if (!CI.InitializeSourceManager(getCurrentFile()))
Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=100484&r1=100483&r2=100484&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Mon Apr 5 17:42:27 2010
@@ -950,9 +950,8 @@
}
llvm::MemoryBuffer *Buffer
- = llvm::MemoryBuffer::getMemBuffer(BlobStart,
- BlobStart + BlobLen - 1,
- Name);
+ = llvm::MemoryBuffer::getMemBuffer(llvm::StringRef(BlobStart, BlobLen - 1),
+ Name);
FileID BufferID = SourceMgr.createFileIDForMemBuffer(Buffer, ID, Offset);
if (strcmp(Name, "<built-in>") == 0) {
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=100484&r1=100483&r2=100484&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Mon Apr 5 17:42:27 2010
@@ -258,9 +258,10 @@
// 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 @@
// 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?");
Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=100484&r1=100483&r2=100484&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Mon Apr 5 17:42:27 2010
@@ -1020,10 +1020,9 @@
llvm::SmallVector<ASTUnit::RemappedFile, 4> RemappedFiles;
for (unsigned I = 0; I != num_unsaved_files; ++I) {
+ llvm::StringRef Data(unsaved_files[I].Contents, unsaved_files[I].Length);
const llvm::MemoryBuffer *Buffer
- = llvm::MemoryBuffer::getMemBufferCopy(unsaved_files[I].Contents,
- unsaved_files[I].Contents + unsaved_files[I].Length,
- unsaved_files[I].Filename);
+ = llvm::MemoryBuffer::getMemBufferCopy(Data, unsaved_files[I].Filename);
RemappedFiles.push_back(std::make_pair(unsaved_files[I].Filename,
Buffer));
}
More information about the cfe-commits
mailing list