summaryrefslogtreecommitdiff
path: root/lib/Archive/Archive.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-01 04:26:46 +0000
committerChris Lattner <sabre@nondot.org>2008-04-01 04:26:46 +0000
commit7f6b4479044e7f6553f517737caa18e4e543697c (patch)
treefcd5198a01f00522dead5657dd55d3546f9b64d4 /lib/Archive/Archive.cpp
parent685412e92ff6ffba88adcbf158fb73335ab27d1e (diff)
downloadllvm-7f6b4479044e7f6553f517737caa18e4e543697c.tar.gz
llvm-7f6b4479044e7f6553f517737caa18e4e543697c.tar.bz2
llvm-7f6b4479044e7f6553f517737caa18e4e543697c.tar.xz
change the archive stuff to use MemoryBuffer instead of mappedfile.
MemoryBuffer is higher level and more closely matches the model needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49029 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Archive/Archive.cpp')
-rw-r--r--lib/Archive/Archive.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp
index c5da114538..e32c7164bd 100644
--- a/lib/Archive/Archive.cpp
+++ b/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();