diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-01 04:26:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-01 04:26:46 +0000 |
commit | d4310a27aa6dff5adabd2f6278213ae57eb07b32 (patch) | |
tree | af7779fed2e1a52e5d845dd4b8de86575acec86e /llvm/lib/Archive/Archive.cpp | |
parent | 014dea94b2dab821381a500739c8c996a499489a (diff) | |
download | bcm5719-llvm-d4310a27aa6dff5adabd2f6278213ae57eb07b32.tar.gz bcm5719-llvm-d4310a27aa6dff5adabd2f6278213ae57eb07b32.zip |
change the archive stuff to use MemoryBuffer instead of mappedfile.
MemoryBuffer is higher level and more closely matches the model
needed.
llvm-svn: 49029
Diffstat (limited to 'llvm/lib/Archive/Archive.cpp')
-rw-r--r-- | llvm/lib/Archive/Archive.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/llvm/lib/Archive/Archive.cpp b/llvm/lib/Archive/Archive.cpp index c5da1145384..e32c7164bd1 100644 --- a/llvm/lib/Archive/Archive.cpp +++ b/llvm/lib/Archive/Archive.cpp @@ -17,7 +17,6 @@ #include "llvm/ModuleProvider.h" #include "llvm/Module.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/System/MappedFile.h" #include "llvm/System/Process.h" #include <memory> #include <cstring> @@ -145,25 +144,19 @@ Archive::Archive(const sys::Path& filename) } bool -Archive::mapToMemory(std::string* ErrMsg) -{ - mapfile = new sys::MappedFile(); - if (mapfile->open(archPath, ErrMsg)) - return true; - if (!(base = (char*) mapfile->map(ErrMsg))) +Archive::mapToMemory(std::string* ErrMsg) { + mapfile = MemoryBuffer::getFile(archPath.c_str(), archPath.size(), ErrMsg); + if (mapfile == 0) return true; + base = mapfile->getBufferStart(); return false; } void Archive::cleanUpMemory() { // Shutdown the file mapping - if (mapfile) { - mapfile->close(); - delete mapfile; - - mapfile = 0; - base = 0; - } + delete mapfile; + mapfile = 0; + base = 0; // Forget the entire symbol table symTab.clear(); |