summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/MemoryBufferTest.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-07-10 00:34:13 +0000
committerReid Kleckner <rnk@google.com>2019-07-10 00:34:13 +0000
commitcc418a3af45adbe740f868a31bde6155083f0b9d (patch)
treed0b24abef24564f0f5a81d17df58ec768b2de356 /llvm/unittests/Support/MemoryBufferTest.cpp
parent9c147bd40bc93376df274e8a5d51c69a55199044 (diff)
downloadbcm5719-llvm-cc418a3af45adbe740f868a31bde6155083f0b9d.tar.gz
bcm5719-llvm-cc418a3af45adbe740f868a31bde6155083f0b9d.zip
[Support] Move llvm::MemoryBuffer to sys::fs::file_t
Summary: On Windows, Posix integer file descriptors are a compatibility layer over native file handles provided by the C runtime. There is a hard limit on the maximum number of file descriptors that a process can open, and the limit is 8192. LLD typically doesn't run into this limit because it opens input files, maps them into memory, and then immediately closes the file descriptor. This prevents it from running out of FDs. For various reasons, I'd like to open handles to every input file and keep them open during linking. That requires migrating MemoryBuffer over to taking open native file handles instead of integer FDs. Reviewers: aganea, Bigcheese Reviewed By: aganea Subscribers: smeenai, silvas, mehdi_amini, hiraditya, steven_wu, dexonsmith, dang, llvm-commits, zturner Tags: #llvm Differential Revision: https://reviews.llvm.org/D63453 llvm-svn: 365588
Diffstat (limited to 'llvm/unittests/Support/MemoryBufferTest.cpp')
-rw-r--r--llvm/unittests/Support/MemoryBufferTest.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/unittests/Support/MemoryBufferTest.cpp b/llvm/unittests/Support/MemoryBufferTest.cpp
index bba662931d6..2f9664308dc 100644
--- a/llvm/unittests/Support/MemoryBufferTest.cpp
+++ b/llvm/unittests/Support/MemoryBufferTest.cpp
@@ -149,11 +149,11 @@ void MemoryBufferTest::testGetOpenFileSlice(bool Reopen) {
EXPECT_FALSE(sys::fs::openFileForRead(TestPath.c_str(), TestFD));
}
- ErrorOr<OwningBuffer> Buf =
- MemoryBuffer::getOpenFileSlice(TestFD, TestPath.c_str(),
- 40000, // Size
- 80000 // Offset
- );
+ ErrorOr<OwningBuffer> Buf = MemoryBuffer::getOpenFileSlice(
+ sys::fs::convertFDToNativeFile(TestFD), TestPath.c_str(),
+ 40000, // Size
+ 80000 // Offset
+ );
std::error_code EC = Buf.getError();
EXPECT_FALSE(EC);
OpenPOWER on IntegriCloud