aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/MemoryBuffer.cpp
diff options
context:
space:
mode:
authorJan Voung <jvoung@chromium.org>2012-10-19 10:31:28 -0700
committerJan Voung <jvoung@chromium.org>2012-10-19 10:31:28 -0700
commitd3923cb96e0567630fae041a438f6e26702638d9 (patch)
tree091ae2c0b040a94c9fed32ae95490bc8bbf8b907 /lib/Support/MemoryBuffer.cpp
parent556121338c248ba1bb49b369388b697250e848c3 (diff)
llvm: Remove some localmods in MemoryBuffer and clean nacl_file a bit.
There were parts of nacl_file that assumed we used shared memory. More of this could be removed if we use streaming by default. BUG= cleanup TEST= edit the driver to set stream rate to "0", then run pnacl/test.sh test-arm-sbtc toolchain_tests Review URL: https://codereview.chromium.org/11191062
Diffstat (limited to 'lib/Support/MemoryBuffer.cpp')
-rw-r--r--lib/Support/MemoryBuffer.cpp12
1 files changed, 0 insertions, 12 deletions
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp
index 8b009b84a5..2501f2ea98 100644
--- a/lib/Support/MemoryBuffer.cpp
+++ b/lib/Support/MemoryBuffer.cpp
@@ -251,11 +251,6 @@ static bool shouldUseMmap(int FD,
if (!RequiresNullTerminator)
return true;
-
-// LLVM uses mmap to read the file contents. This disallows use of the
-// wrapper syscalls defined in tools/llc/nacl_file.c. Thus, when NACL_SRPC
-// is specified, code sequence execising the read syscall below is used.
-#if !defined(NACL_SRPC)
// If we don't know the file size, use fstat to find out. fstat on an open
// file descriptor is cheaper than stat on a random path.
// FIXME: this chunk of code is duplicated, but it avoids a fstat when
@@ -268,9 +263,6 @@ static bool shouldUseMmap(int FD,
}
FileSize = FileInfo.st_size;
}
-#else
- assert(FileSize != -1 && "invalid file size!");
-#endif
// If we need a null terminator and the end of the map is inside the file,
// we cannot use mmap.
@@ -298,7 +290,6 @@ error_code MemoryBuffer::getOpenFile(int FD, const char *Filename,
if (MapSize == uint64_t(-1)) {
// If we don't know the file size, use fstat to find out. fstat on an open
// file descriptor is cheaper than stat on a random path.
-#if !defined(NACL_SRPC)
if (FileSize == uint64_t(-1)) {
struct stat FileInfo;
// TODO: This should use fstat64 when available.
@@ -307,9 +298,6 @@ error_code MemoryBuffer::getOpenFile(int FD, const char *Filename,
}
FileSize = FileInfo.st_size;
}
-#else
- assert(FileSize != -1 && "invalid file size!");
-#endif
MapSize = FileSize;
}