From c83cd8feef7eb8319131d968bb8c94fdc8dbb6a6 Mon Sep 17 00:00:00 2001 From: Abhina Sreeskantharajan Date: Thu, 25 Mar 2021 09:47:25 -0400 Subject: [NFC] Reordering parameters in getFile and getFileOrSTDIN In future patches I will be setting the IsText parameter frequently so I will refactor the args to be in the following order. I have removed the FileSize parameter because it is never used. ``` static ErrorOr> getFile(const Twine &Filename, bool IsText = false, bool RequiresNullTerminator = true, bool IsVolatile = false); static ErrorOr> getFileOrSTDIN(const Twine &Filename, bool IsText = false, bool RequiresNullTerminator = true); static ErrorOr> getFileAux(const Twine &Filename, uint64_t MapSize, uint64_t Offset, bool IsText, bool RequiresNullTerminator, bool IsVolatile); static ErrorOr> getFile(const Twine &Filename, bool IsVolatile = false); ``` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D99182 --- llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp') diff --git a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp index f3904b9..80d3033 100644 --- a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -112,8 +112,8 @@ static void doList(opt::InputArgList& Args) { std::unique_ptr B; for (auto *Arg : Args.filtered(OPT_INPUT)) { // Create or open the archive object. - ErrorOr> MaybeBuf = - MemoryBuffer::getFile(Arg->getValue(), -1, false); + ErrorOr> MaybeBuf = MemoryBuffer::getFile( + Arg->getValue(), /*IsText=*/false, /*RequiresNullTerminator=*/false); fatalOpenError(errorCodeToError(MaybeBuf.getError()), Arg->getValue()); if (identify_magic(MaybeBuf.get()->getBuffer()) == file_magic::archive) { @@ -339,8 +339,8 @@ int llvm::libDriverMain(ArrayRef ArgsArr) { continue; // Open a file. - ErrorOr> MOrErr = - MemoryBuffer::getFile(Path, -1, false); + ErrorOr> MOrErr = MemoryBuffer::getFile( + Path, /*IsText=*/false, /*RequiresNullTerminator=*/false); fatalOpenError(errorCodeToError(MOrErr.getError()), Path); MemoryBufferRef MBRef = (*MOrErr)->getMemBufferRef(); -- cgit v1.1