@@ -266,9 +266,8 @@ MemoryBuffer::getFile(const Twine &Filename, bool IsText,
266
266
template <typename MB>
267
267
static ErrorOr<std::unique_ptr<MB>>
268
268
getOpenFileImpl (sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
269
- uint64_t MapSize, int64_t Offset, bool IsText,
270
- bool RequiresNullTerminator, bool IsVolatile,
271
- std::optional<Align> Alignment);
269
+ uint64_t MapSize, int64_t Offset, bool RequiresNullTerminator,
270
+ bool IsVolatile, std::optional<Align> Alignment);
272
271
273
272
template <typename MB>
274
273
static ErrorOr<std::unique_ptr<MB>>
@@ -281,8 +280,7 @@ getFileAux(const Twine &Filename, uint64_t MapSize, uint64_t Offset,
281
280
return errorToErrorCode (FDOrErr.takeError ());
282
281
sys::fs::file_t FD = *FDOrErr;
283
282
auto Ret = getOpenFileImpl<MB>(FD, Filename, /* FileSize=*/ -1 , MapSize, Offset,
284
- IsText, RequiresNullTerminator, IsVolatile,
285
- Alignment);
283
+ RequiresNullTerminator, IsVolatile, Alignment);
286
284
sys::fs::closeFile (FD);
287
285
return Ret;
288
286
}
@@ -470,9 +468,8 @@ WriteThroughMemoryBuffer::getFileSlice(const Twine &Filename, uint64_t MapSize,
470
468
template <typename MB>
471
469
static ErrorOr<std::unique_ptr<MB>>
472
470
getOpenFileImpl (sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
473
- uint64_t MapSize, int64_t Offset, bool IsText,
474
- bool RequiresNullTerminator, bool IsVolatile,
475
- std::optional<Align> Alignment) {
471
+ uint64_t MapSize, int64_t Offset, bool RequiresNullTerminator,
472
+ bool IsVolatile, std::optional<Align> Alignment) {
476
473
static int PageSize = sys::Process::getPageSizeEstimate ();
477
474
478
475
// Default is to map the full file.
@@ -509,7 +506,7 @@ getOpenFileImpl(sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
509
506
// from the page cache that are not properly filled with trailing zeroes,
510
507
// if some prior user of the page wrote non-zero bytes. Detect this and
511
508
// don't use mmap in that case.
512
- if (!IsText || *Result->getBufferEnd () == ' \0 ' )
509
+ if (!RequiresNullTerminator || *Result->getBufferEnd () == ' \0 ' )
513
510
return std::move (Result);
514
511
}
515
512
}
@@ -558,16 +555,16 @@ MemoryBuffer::getOpenFile(sys::fs::file_t FD, const Twine &Filename,
558
555
uint64_t FileSize, bool RequiresNullTerminator,
559
556
bool IsVolatile, std::optional<Align> Alignment) {
560
557
return getOpenFileImpl<MemoryBuffer>(FD, Filename, FileSize, FileSize, 0 ,
561
- false , RequiresNullTerminator ,
562
- IsVolatile, Alignment);
558
+ RequiresNullTerminator, IsVolatile ,
559
+ Alignment);
563
560
}
564
561
565
562
ErrorOr<std::unique_ptr<MemoryBuffer>> MemoryBuffer::getOpenFileSlice (
566
563
sys::fs::file_t FD, const Twine &Filename, uint64_t MapSize, int64_t Offset,
567
564
bool IsVolatile, std::optional<Align> Alignment) {
568
565
assert (MapSize != uint64_t (-1 ));
569
566
return getOpenFileImpl<MemoryBuffer>(FD, Filename, -1 , MapSize, Offset, false ,
570
- false , IsVolatile, Alignment);
567
+ IsVolatile, Alignment);
571
568
}
572
569
573
570
ErrorOr<std::unique_ptr<MemoryBuffer>> MemoryBuffer::getSTDIN () {
0 commit comments