aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
diff options
context:
space:
mode:
authorAbhina Sreeskantharajan <Abhina.Sreeskantharajan@ibm.com>2021-03-25 09:47:25 -0400
committerAbhina Sreeskantharajan <Abhina.Sreeskantharajan@ibm.com>2021-03-25 09:47:49 -0400
commitc83cd8feef7eb8319131d968bb8c94fdc8dbb6a6 (patch)
treed05e472da6cc9f329ec6c51095012818f6847333 /llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
parent0becc4d721d0036e2e38d581bc487e27f78eb8a9 (diff)
downloadllvm-c83cd8feef7eb8319131d968bb8c94fdc8dbb6a6.zip
llvm-c83cd8feef7eb8319131d968bb8c94fdc8dbb6a6.tar.gz
llvm-c83cd8feef7eb8319131d968bb8c94fdc8dbb6a6.tar.bz2
[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<std::unique_ptr<MemoryBuffer>> getFile(const Twine &Filename, bool IsText = false, bool RequiresNullTerminator = true, bool IsVolatile = false); static ErrorOr<std::unique_ptr<MemoryBuffer>> getFileOrSTDIN(const Twine &Filename, bool IsText = false, bool RequiresNullTerminator = true); static ErrorOr<std::unique_ptr<MB>> getFileAux(const Twine &Filename, uint64_t MapSize, uint64_t Offset, bool IsText, bool RequiresNullTerminator, bool IsVolatile); static ErrorOr<std::unique_ptr<WritableMemoryBuffer>> getFile(const Twine &Filename, bool IsVolatile = false); ``` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D99182
Diffstat (limited to 'llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp')
-rw-r--r--llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp8
1 files changed, 4 insertions, 4 deletions
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<MemoryBuffer> B;
for (auto *Arg : Args.filtered(OPT_INPUT)) {
// Create or open the archive object.
- ErrorOr<std::unique_ptr<MemoryBuffer>> MaybeBuf =
- MemoryBuffer::getFile(Arg->getValue(), -1, false);
+ ErrorOr<std::unique_ptr<MemoryBuffer>> 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<const char *> ArgsArr) {
continue;
// Open a file.
- ErrorOr<std::unique_ptr<MemoryBuffer>> MOrErr =
- MemoryBuffer::getFile(Path, -1, false);
+ ErrorOr<std::unique_ptr<MemoryBuffer>> MOrErr = MemoryBuffer::getFile(
+ Path, /*IsText=*/false, /*RequiresNullTerminator=*/false);
fatalOpenError(errorCodeToError(MOrErr.getError()), Path);
MemoryBufferRef MBRef = (*MOrErr)->getMemBufferRef();