diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:45 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:45 +0000 |
commit | d2bd9e70b16db88a7808ee2280b0a107afbfdd3b (patch) | |
tree | 12612d2c593445b297ac656911c9db7cf9065bdd /COFF/LTO.cpp | |
parent | f1e1c239e31b467e17f1648b1f524fc9ab5b431a (diff) | |
download | src-d2bd9e70b16db88a7808ee2280b0a107afbfdd3b.tar.gz src-d2bd9e70b16db88a7808ee2280b0a107afbfdd3b.zip |
Vendor import of stripped lld trunk r375505, the last commit before thevendor/lld/lld-trunk-r375505vendor/lld
upstream Subversion repository was made read-only, and the LLVM project
migrated to GitHub:
https://llvm.org/svn/llvm-project/lld/trunk@375505
Notes
Notes:
svn path=/vendor/lld/dist/; revision=353950
svn path=/vendor/lld/lld-r375505/; revision=353951; tag=vendor/lld/lld-trunk-r375505
Diffstat (limited to 'COFF/LTO.cpp')
-rw-r--r-- | COFF/LTO.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/COFF/LTO.cpp b/COFF/LTO.cpp index eb3c60d66077..1c21236dce2b 100644 --- a/COFF/LTO.cpp +++ b/COFF/LTO.cpp @@ -39,14 +39,14 @@ using namespace llvm; using namespace llvm::object; -using namespace lld; -using namespace lld::coff; +namespace lld { +namespace coff { // Creates an empty file to and returns a raw_fd_ostream to write to it. static std::unique_ptr<raw_fd_ostream> openFile(StringRef file) { std::error_code ec; auto ret = - llvm::make_unique<raw_fd_ostream>(file, ec, sys::fs::OpenFlags::F_None); + std::make_unique<raw_fd_ostream>(file, ec, sys::fs::OpenFlags::OF_None); if (ec) { error("cannot open " + file + ": " + ec.message()); return nullptr; @@ -105,7 +105,7 @@ BitcodeCompiler::BitcodeCompiler() { backend = lto::createInProcessThinBackend(config->thinLTOJobs); } - ltoObj = llvm::make_unique<lto::LTO>(createConfig(), backend, + ltoObj = std::make_unique<lto::LTO>(createConfig(), backend, config->ltoPartitions); } @@ -160,8 +160,8 @@ std::vector<StringRef> BitcodeCompiler::compile() { checkError(ltoObj->run( [&](size_t task) { - return llvm::make_unique<lto::NativeObjectStream>( - llvm::make_unique<raw_svector_ostream>(buf[task])); + return std::make_unique<lto::NativeObjectStream>( + std::make_unique<raw_svector_ostream>(buf[task])); }, cache)); @@ -177,6 +177,8 @@ std::vector<StringRef> BitcodeCompiler::compile() { // files. After that, we exit from linker and ThinLTO backend runs in a // distributed environment. if (config->thinLTOIndexOnly) { + if (!config->ltoObjPath.empty()) + saveBuffer(buf[0], config->ltoObjPath); if (indexFile) indexFile->close(); return {}; @@ -204,3 +206,6 @@ std::vector<StringRef> BitcodeCompiler::compile() { return ret; } + +} // namespace coff +} // namespace lld |