[lld] r349581 - Use unique_ptr to manage a TarWriter instance. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 18 15:50:37 PST 2018
Author: ruiu
Date: Tue Dec 18 15:50:37 2018
New Revision: 349581
URL: http://llvm.org/viewvc/llvm-project?rev=349581&view=rev
Log:
Use unique_ptr to manage a TarWriter instance. NFC.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/InputFiles.h
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=349581&r1=349580&r2=349581&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Dec 18 15:50:37 2018
@@ -402,10 +402,9 @@ void LinkerDriver::main(ArrayRef<const c
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()));
}
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=349581&r1=349580&r2=349581&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Dec 18 15:50:37 2018
@@ -46,7 +46,7 @@ std::vector<LazyObjFile *> elf::LazyObjF
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) {
Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=349581&r1=349580&r2=349581&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Tue Dec 18 15:50:37 2018
@@ -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);
More information about the llvm-commits
mailing list