diff options
author | Rui Ueyama <ruiu@google.com> | 2018-12-18 23:50:37 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2018-12-18 23:50:37 +0000 |
commit | 5e63d9b3170233a4870eaca6007b30e769fbca76 (patch) | |
tree | 6abc104cc62ec701b23c50dde90ab3dae1500d29 /lld | |
parent | 01534184296eb78076834cc3f0bfee6e865d1cb9 (diff) |
Use unique_ptr to manage a TarWriter instance. NFC.
Diffstat (limited to 'lld')
-rw-r--r-- | lld/ELF/Driver.cpp | 3 | ||||
-rw-r--r-- | lld/ELF/InputFiles.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/InputFiles.h | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 1888edc025c..51daa81edc8 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -402,10 +402,9 @@ void LinkerDriver::main(ArrayRef<const char *> ArgsArr) { Expected<std::unique_ptr<TarWriter>> ErrOrWriter = TarWriter::create(Path, path::stem(Path)); if (ErrOrWriter) { - Tar = ErrOrWriter->get(); + Tar = std::move(*ErrOrWriter); Tar->append("response.txt", createResponseFile(Args)); Tar->append("version.txt", getLLDVersion() + "\n"); - make<std::unique_ptr<TarWriter>>(std::move(*ErrOrWriter)); } else { error("--reproduce: " + toString(ErrOrWriter.takeError())); } diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 8a7e9276ea6..a85e5e6afb0 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -46,7 +46,7 @@ std::vector<LazyObjFile *> elf::LazyObjFiles; std::vector<InputFile *> elf::ObjectFiles; std::vector<InputFile *> elf::SharedFiles; -TarWriter *elf::Tar; +std::unique_ptr<TarWriter> elf::Tar; InputFile::InputFile(Kind K, MemoryBufferRef M) : MB(M), GroupId(NextGroupId), FileKind(K) { diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index 3481a0a54d5..5094ddd804a 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -50,7 +50,7 @@ class Symbol; // If -reproduce option is given, all input files are written // to this tar archive. -extern llvm::TarWriter *Tar; +extern std::unique_ptr<llvm::TarWriter> Tar; // Opens a given file. llvm::Optional<MemoryBufferRef> readFile(StringRef Path); |