diff --git a/default.nix b/default.nix index 9990bd74..7c9f9097 100644 --- a/default.nix +++ b/default.nix @@ -3,5 +3,5 @@ let release = import ./nix/release.nix args; in { - allvm-tools = release.musl.allvm-tools-clang4; + allvm-tools = release.musl.allvm-tools-clang6; } diff --git a/include/allvm/ToolCommon.h b/include/allvm/ToolCommon.h index 972d81b6..1c196d11 100644 --- a/include/allvm/ToolCommon.h +++ b/include/allvm/ToolCommon.h @@ -20,11 +20,8 @@ class ALLVMTool { llvm::cl::OptionCategory ALLVMOptCat{CatName}; auto getVersionPrinter() { - static std::string CapturedName = Name; - return []() { - llvm::raw_ostream &OS = llvm::outs(); - OS << CapturedName << " (ALLVM Tools) " << allvm::getALLVMVersion() - << "\n"; + return [Name = this->Name](auto &OS) { + OS << Name << " (ALLVM Tools) " << allvm::getALLVMVersion() << "\n"; OS << " ALLVM Project (http://allvm.org)\n"; OS << " LLVM version " << LLVM_VERSION_STRING << "\n"; @@ -44,18 +41,16 @@ class ALLVMTool { OS << ".\n" << " Default target: " << llvm::sys::getDefaultTargetTriple() << '\n' << " Host CPU: " << CPU << '\n'; - }; } public: ALLVMTool(llvm::StringRef _Name, llvm::StringRef _Overview = "") - : Name(_Name), Overview(_Overview) { - llvm::cl::SetVersionPrinter(getVersionPrinter()); - } + : Name(_Name), Overview(_Overview) {} bool parseCLOpts(int argc, const char *const *argv) { llvm::cl::HideUnrelatedOptions(ALLVMOptCat); + llvm::cl::SetVersionPrinter(getVersionPrinter()); return llvm::cl::ParseCommandLineOptions(argc, argv, Overview); } diff --git a/libs/Passes/DeInlineAsm.cpp b/libs/Passes/DeInlineAsm.cpp index 2b6ada0f..39337c6d 100644 --- a/libs/Passes/DeInlineAsm.cpp +++ b/libs/Passes/DeInlineAsm.cpp @@ -36,8 +36,9 @@ class InlineAsmVisitor : public InstVisitor { // Handle "compiler barrier" idiom StringRef constraintString = inlineAsm->getConstraintString(); if (constraintString == "~{memory},~{dirflag},~{fpsr},~{flags}") { - replacement = new FenceInst( - M->getContext(), AtomicOrdering::AcquireRelease, SingleThread, &I); + replacement = + new FenceInst(M->getContext(), AtomicOrdering::AcquireRelease, + SyncScope::SingleThread, &I); } } else { SmallVector asmPieces; diff --git a/libs/StaticCodeGen/ALLVMLinker.cpp b/libs/StaticCodeGen/ALLVMLinker.cpp index ec9057f5..a1b44b98 100644 --- a/libs/StaticCodeGen/ALLVMLinker.cpp +++ b/libs/StaticCodeGen/ALLVMLinker.cpp @@ -46,7 +46,7 @@ Error ALLVMLinker::callLinkerAsExternalProcess(StringRef LinkerProgram, bool ExecutionFailed; std::string ErrorMsg; int Res = llvm::sys::ExecuteAndWait(LinkerProgram, LinkerArgv, - /*env*/ nullptr, /*Redirects*/ nullptr, + /*env*/ nullptr, /*Redirects*/ {}, /*secondsToWait*/ 0, /*memoryLimit*/ 0, &ErrorMsg, &ExecutionFailed); diff --git a/libs/StaticCodeGen/StaticCodeGen.cpp b/libs/StaticCodeGen/StaticCodeGen.cpp index d0817863..7204bc04 100644 --- a/libs/StaticCodeGen/StaticCodeGen.cpp +++ b/libs/StaticCodeGen/StaticCodeGen.cpp @@ -28,6 +28,27 @@ using namespace allvm; using namespace llvm; using namespace object; +namespace { +struct LLCDiagnosticHandler : public DiagnosticHandler { + bool *HasError; + LLCDiagnosticHandler(bool *HasErrorPtr) : HasError(HasErrorPtr) {} + bool handleDiagnostics(const DiagnosticInfo &DI) override { + if (DI.getSeverity() == DS_Error) + *HasError = true; + + if (auto *Remark = dyn_cast(&DI)) + if (!Remark->isEnabled()) + return true; + + DiagnosticPrinterRawOStream DP(errs()); + errs() << LLVMContext::getDiagnosticMessagePrefix(DI.getSeverity()) << ": "; + DI.print(DP); + errs() << "\n"; + return true; + } +}; +} // end anonymous namespace + static inline std::string getCPUStr(StringRef MCPU) { // If user asked for the 'native' CPU, autodetect here. If autodection fails, // this will set the CPU to an empty string which tells the target to @@ -67,29 +88,25 @@ static inline void setFunctionAttributes(StringRef CPU, StringRef Features, Module &M) { for (auto &F : M) { auto &Ctx = F.getContext(); - AttributeSet Attrs = F.getAttributes(), NewAttrs; + AttributeList Attrs = F.getAttributes(); + AttrBuilder NewAttrs; if (!CPU.empty()) - NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex, - "target-cpu", CPU); + NewAttrs.addAttribute("target-cpu", CPU); if (!Features.empty()) - NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex, - "target-features", Features); + NewAttrs.addAttribute("target-features", Features); if (DisableFPElim.hasValue()) - NewAttrs = NewAttrs.addAttribute( - Ctx, AttributeSet::FunctionIndex, "no-frame-pointer-elim", - DisableFPElim.getValue() ? "true" : "false"); + NewAttrs.addAttribute("no-frame-pointer-elim", + DisableFPElim.getValue() ? "true" : "false"); if (DisableTailCalls.hasValue()) - NewAttrs = NewAttrs.addAttribute( - Ctx, AttributeSet::FunctionIndex, "disable-tail-calls", - toStringRef(DisableTailCalls.getValue())); + NewAttrs.addAttribute("disable-tail-calls", + toStringRef(DisableTailCalls.getValue())); if (StackRealign) - NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex, - "stackrealign"); + NewAttrs.addAttribute("stackrealign"); if (TrapFuncName.hasValue()) for (auto &B : F) @@ -98,13 +115,13 @@ static inline void setFunctionAttributes(StringRef CPU, StringRef Features, if (const auto *Callee = Call->getCalledFunction()) if (Callee->getIntrinsicID() == Intrinsic::debugtrap || Callee->getIntrinsicID() == Intrinsic::trap) - Call->addAttribute(AttributeSet::FunctionIndex, + Call->addAttribute(AttributeList::FunctionIndex, Attribute::get(Ctx, "trap-func-name", TrapFuncName.getValue())); // Let NewAttrs override Attrs. - NewAttrs = Attrs.addAttributes(Ctx, AttributeSet::FunctionIndex, NewAttrs); - F.setAttributes(NewAttrs); + F.setAttributes( + Attrs.addAttributes(Ctx, AttributeList::FunctionIndex, NewAttrs)); } } @@ -184,30 +201,14 @@ static Error compileModule(std::unique_ptr &M, raw_pwrite_stream &OS, // Run passes to do compilation. PM.run(*M); - auto HasError = *static_cast(Context.getDiagnosticContext()); - // TODO: Produce better error message? - if (HasError) { + auto HasError = + ((const LLCDiagnosticHandler *)(Context.getDiagHandlerPtr()))->HasError; + if (*HasError) return makeStaticCodeGenError("unknown error compiling to object file"); - } return Error::success(); } -static void DiagnosticHandler(const DiagnosticInfo &DI, void *Context) { - bool *HasError = static_cast(Context); - if (DI.getSeverity() == DS_Error) - *HasError = true; - - if (auto *Remark = dyn_cast(&DI)) - if (!Remark->isEnabled()) - return; - - DiagnosticPrinterRawOStream DP(errs()); - errs() << LLVMContext::getDiagnosticMessagePrefix(DI.getSeverity()) << ": "; - DI.print(DP); - errs() << "\n"; -} - namespace allvm { Error compileAllexe(Allexe &Input, raw_pwrite_stream &OS, @@ -217,7 +218,8 @@ Error compileAllexe(Allexe &Input, raw_pwrite_stream &OS, // Set a diagnostic handler that doesn't exit on the first error. bool HasError = false; - Context.setDiagnosticHandler(DiagnosticHandler, &HasError); + Context.setDiagnosticHandler( + llvm::make_unique(&HasError)); // Get module to be compiled. auto ExpM = Input.getModule(0, Context); @@ -233,7 +235,7 @@ Error compileAllexe(Allexe &Input, raw_pwrite_stream &OS, // Initialize compilation flags to the llc default values. CompilationOptions::CompilationOptions() - : CMModel(CodeModel::Default), RelocModel(None), OLvl(CodeGenOpt::Default), + : CMModel(CodeModel::Small), RelocModel(None), OLvl(CodeGenOpt::Default), NoVerify(false), DisableSimplifyLibCalls(false), DisableFPElim(None), DisableTailCalls(None), StackRealign(false), TrapFuncName(None) { @@ -271,9 +273,15 @@ std::string CompilationOptions::serializeCompilationOptions() const { } // Serialize OLvl buffer += std::to_string(OLvl); +#ifdef __x86_64__ + errs() << "Using incomplete serialization of compilation options, FIXME!\n"; +#else +#warning \ + "Unable to emit runtime warning that serialization of compilation options is incomplete!" +#endif // Serialize TargetOptions buffer += std::to_string(TOptions.PrintMachineCode); - buffer += std::to_string(TOptions.LessPreciseFPMADOption); + // buffer += std::to_string(TOptions.LessPreciseFPMADOption); buffer += std::to_string(TOptions.UnsafeFPMath); buffer += std::to_string(TOptions.NoInfsFPMath); buffer += std::to_string(TOptions.NoNaNsFPMath); @@ -286,7 +294,7 @@ std::string CompilationOptions::serializeCompilationOptions() const { buffer += std::to_string(TOptions.EnableFastISel); buffer += std::to_string(TOptions.UseInitArray); buffer += std::to_string(TOptions.DisableIntegratedAS); - buffer += std::to_string(TOptions.CompressDebugSections); + buffer += std::to_string(static_cast(TOptions.CompressDebugSections)); buffer += std::to_string(TOptions.RelaxELFRelocations); buffer += std::to_string(TOptions.FunctionSections); buffer += std::to_string(TOptions.DataSections); @@ -351,7 +359,7 @@ compileAllexe(Allexe &Input, StringRef Filename, // Open the output file. std::error_code EC; sys::fs::OpenFlags OpenFlags = sys::fs::F_None; - auto FDOut = llvm::make_unique(Filename, EC, OpenFlags); + auto FDOut = llvm::make_unique(Filename, EC, OpenFlags); if (EC) { return makeStaticCodeGenError("error opening compilation output", EC); } diff --git a/libs/all/Allexe.cpp b/libs/all/Allexe.cpp index 98aa63c7..43632351 100644 --- a/libs/all/Allexe.cpp +++ b/libs/all/Allexe.cpp @@ -25,7 +25,7 @@ static std::unique_ptr moduleToBuffer(const Module *M) { false, // ShouldPreserveUseListOrder nullptr, // ModuleSummaryIndex (ThinLTO) true // Generate Hash - ); + ); return MemoryBuffer::getMemBufferCopy(OS.str()); } diff --git a/libs/archive-rw/ZipArchive.cpp b/libs/archive-rw/ZipArchive.cpp index 53108e11..a131807a 100644 --- a/libs/archive-rw/ZipArchive.cpp +++ b/libs/archive-rw/ZipArchive.cpp @@ -56,7 +56,7 @@ std::unique_ptr ZipArchive::getEntry(size_t index, zip_stat_t statinfo; zip_stat_index(archive, index, 0, &statinfo); std::unique_ptr buf = - MemoryBuffer::getNewUninitMemBuffer(statinfo.size, files[index]); + WritableMemoryBuffer::getNewUninitMemBuffer(statinfo.size, files[index]); // Decompress the file into the buffer. zip_file_t *fd = zip_fopen_index(archive, index, 0); diff --git a/nix/overlay.nix b/nix/overlay.nix index 2f10b3b0..e09c5725 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,6 +1,6 @@ self: super: rec { allvm-tools = super.callPackage ./build.nix { - inherit (self.llvmPackages_4) llvm clang lld; + inherit (self.llvmPackages_6) llvm clang lld; }; allvm-tools-variants = super.recurseIntoAttrs { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e62cd3c9..ab6a1fdb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -26,14 +26,7 @@ set(ALLVM_TEST_PARAMS set(LIT_REPORT ${CMAKE_CURRENT_BINARY_DIR}/report.xml) set(ALLVM_TEST_EXTRA_ARGS --no-progress-bar -v --xunit-xml-output=${LIT_REPORT}) -# try to find 'lit' -find_program(LIT_COMMAND llvm-lit) -if (EXISTS ${LLVM_INSTALL_PREFIX}/lit/lit.py) - set(LIT_COMMAND ${LLVM_INSTALL_PREFIX}/lit/lit.py) -endif() -if (NOT LIT_COMMAND) - set(LIT_COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/third_party/lit/lit.py) -endif() +set(LLVM_EXTERNAL_LIT ${CMAKE_SOURCE_DIR}/third_party/lit/lit.py) # Check we have FileCheck utility, as indicator of the LLVM utilities. find_program(FILECHECK_PATH FileCheck HINTS ${LLVM_TOOLS_BINARY_DIR}) @@ -56,5 +49,3 @@ add_lit_testsuites(ALLVM ${CMAKE_CURRENT_SOURCE_DIR} PARAMS ${ALLVM_TEST_PARAMS} DEPENDS ${ALLVM_TEST_DEPENDS} ) - -message(STATUS "Using lit command: ${LIT_COMMAND}") diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 5e2f445c..bdd1b90b 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -17,6 +17,7 @@ curpath = os.environ.get('PATH', '') if curpath: newpath += ":" + curpath config.environment['PATH'] = newpath +config.environment['XDG_CACHE_HOME'] = config.test_exec_root + "/cache"; # TODO: Get this more reliably/directly: " = @LIBNONE_PATH@" or something libnone = "@LLVM_LIBRARY_OUTPUT_INTDIR@/libnone.a" diff --git a/test/lit/deasm-barrier.ll b/test/lit/deasm-barrier.ll index 5cbe04e3..82f26625 100644 --- a/test/lit/deasm-barrier.ll +++ b/test/lit/deasm-barrier.ll @@ -2,7 +2,7 @@ ; __asm__ __volatile__ ("" ::: "memory") ; Which can be replaced with C11 'atomic_signal_fence(memory_order_acq_rel)' ; In LLVM IR that becomes (at least in my sample program) -; 'fence singlethread acq_rel' +; 'fence syncscope("singlethread") acq_rel' ; https://en.wikipedia.org/wiki/Memory_ordering#Compile-time_memory_barrier_implementation ; http://en.cppreference.com/w/c/atomic/atomic_signal_fence @@ -15,7 +15,7 @@ ; RUN: allopt -analyze -i %t llvm-dis |& FileCheck %s ; CHECK-NOT: call {{.*}} asm -; CHECK: fence singlethread acq_rel +; CHECK: fence syncscope("singlethread") acq_rel ; CHECK-NOT: call {{.*}} asm ; ModuleID = 'barrier.c' diff --git a/tools/all-info/CMakeLists.txt b/tools/all-info/CMakeLists.txt index 2396f782..c535b260 100644 --- a/tools/all-info/CMakeLists.txt +++ b/tools/all-info/CMakeLists.txt @@ -6,6 +6,6 @@ add_llvm_tool(all-info all-info.cpp ) -target_link_libraries(all-info liball ResourcePaths) +target_link_libraries(all-info PRIVATE liball ResourcePaths) add_definitions(${LLVM_DEFINITIONS}) diff --git a/tools/alld/CMakeLists.txt b/tools/alld/CMakeLists.txt index 21b7dd12..a73c4320 100644 --- a/tools/alld/CMakeLists.txt +++ b/tools/alld/CMakeLists.txt @@ -2,7 +2,7 @@ add_llvm_tool(alld alld.cpp ) -target_link_libraries(alld ResourcePaths lldELF lldConfig lldCore) +target_link_libraries(alld PRIVATE ResourcePaths lldELF lldCommon) llvm_config(alld # These are taken directly from lld/ELF/CMakeLists.txt: diff --git a/tools/alld/alld.cpp b/tools/alld/alld.cpp index 52de871f..fbc7ad49 100644 --- a/tools/alld/alld.cpp +++ b/tools/alld/alld.cpp @@ -7,7 +7,7 @@ // Linker wrapper for lld. // //===----------------------------------------------------------------------===// -#include +#include #include #include diff --git a/tools/alley/CMakeLists.txt b/tools/alley/CMakeLists.txt index e4d63f73..bf891e2e 100644 --- a/tools/alley/CMakeLists.txt +++ b/tools/alley/CMakeLists.txt @@ -16,6 +16,7 @@ add_llvm_tool(alley alley.cpp ) target_link_libraries(alley + PRIVATE liball AOTCompile Cache diff --git a/tools/alley/alley.cpp b/tools/alley/alley.cpp index a08529dd..adcc51ae 100644 --- a/tools/alley/alley.cpp +++ b/tools/alley/alley.cpp @@ -6,7 +6,8 @@ #include "allvm/ResourceAnchor.h" #include "allvm/ToolCommon.h" -#include +// XXX: Revisit this +//#include #include #include #include diff --git a/tools/allmux/CMakeLists.txt b/tools/allmux/CMakeLists.txt index a899c0c1..ced01d35 100644 --- a/tools/allmux/CMakeLists.txt +++ b/tools/allmux/CMakeLists.txt @@ -10,7 +10,7 @@ add_llvm_tool(allmux allmux.cpp CtorUtils.cpp ) -target_link_libraries(allmux liball Passes ResourcePaths) +target_link_libraries(allmux PRIVATE liball Passes ResourcePaths) set(MM_BC ${CMAKE_CURRENT_SOURCE_DIR}/main/mux_main.bc) install(FILES ${MM_BC} DESTINATION lib) diff --git a/tools/allmux/CtorUtils.cpp b/tools/allmux/CtorUtils.cpp index d0fe41e2..56411b52 100644 --- a/tools/allmux/CtorUtils.cpp +++ b/tools/allmux/CtorUtils.cpp @@ -102,8 +102,7 @@ Function *allvm::createCtorDtorFunc(ArrayRef Fns, Module &M, // TODO: Better handle case where function with this name already exists; // just create the function as whatever and then call setName() or something? auto NameS = Name.str(); - auto *F = cast( - M.getOrInsertFunction(NameS, Builder.getVoidTy(), nullptr)); + auto *F = cast(M.getOrInsertFunction(NameS, Builder.getVoidTy())); Builder.SetInsertPoint(BasicBlock::Create(C, "entry", F)); diff --git a/tools/allmux/allmux.cpp b/tools/allmux/allmux.cpp index a1396e25..efd6662b 100644 --- a/tools/allmux/allmux.cpp +++ b/tools/allmux/allmux.cpp @@ -155,7 +155,7 @@ Expected> genMain(ArrayRef Es, LLVMContext &C, assert(AtExit); auto getCtorDtorFn = [&](auto FName) { - return MuxMain->getOrInsertFunction(FName, Builder.getVoidTy(), nullptr); + return MuxMain->getOrInsertFunction(FName, Builder.getVoidTy()); }; auto callCtor = [&](auto FName) { Builder.CreateCall(getCtorDtorFn(FName)); diff --git a/tools/allopt/CMakeLists.txt b/tools/allopt/CMakeLists.txt index 74211d4b..30d70937 100644 --- a/tools/allopt/CMakeLists.txt +++ b/tools/allopt/CMakeLists.txt @@ -9,6 +9,6 @@ add_llvm_tool(allopt allopt.cpp ) -target_link_libraries(allopt liball ResourcePaths) +target_link_libraries(allopt PRIVATE liball ResourcePaths) add_definitions(${LLVM_DEFINITIONS}) diff --git a/tools/allopt/allopt.cpp b/tools/allopt/allopt.cpp index f2df039e..2c718160 100644 --- a/tools/allopt/allopt.cpp +++ b/tools/allopt/allopt.cpp @@ -60,7 +60,7 @@ Error runPipeline(StringRef Input, StringRef Output) { // Empty environment const char *env[] = {nullptr}; - const StringRef *redirects[] = {&Input, &Output, nullptr}; + Optional redirects[3] = {Input, Output, None}; // XXX: Make these cl::opt's? unsigned secondsToWait = 0; @@ -155,7 +155,7 @@ int main(int argc, const char *argv[]) { outs().write(OutData->getBufferStart(), OutData->getBufferSize()); } } else { - tool_output_file out(OutputFilename, EC, sys::fs::F_None); + ToolOutputFile out(OutputFilename, EC, sys::fs::F_None); ExitOnErr(errorCodeToError(EC)); auto OutData = ExitOnErr(errorOrToExpected(MemoryBuffer::getFile(TempOut))); diff --git a/tools/allready/CMakeLists.txt b/tools/allready/CMakeLists.txt index c502fbbe..c3a75eb5 100644 --- a/tools/allready/CMakeLists.txt +++ b/tools/allready/CMakeLists.txt @@ -16,6 +16,6 @@ set(LLVM_LINK_COMPONENTS add_llvm_tool(allready allready.cpp ) -target_link_libraries(allready liball AOTCompile Cache ExecutionYengine ResourcePaths) +target_link_libraries(allready PRIVATE liball AOTCompile Cache ExecutionYengine ResourcePaths) add_definitions(${LLVM_DEFINITIONS}) diff --git a/tools/allready/allready.cpp b/tools/allready/allready.cpp index 064a5e50..92f8ac26 100644 --- a/tools/allready/allready.cpp +++ b/tools/allready/allready.cpp @@ -16,7 +16,8 @@ #include "allvm/ResourceAnchor.h" #include "allvm/ToolCommon.h" -#include +// XXX: Revisit this! +//#include #include #include #include diff --git a/tools/alltogether/CMakeLists.txt b/tools/alltogether/CMakeLists.txt index 2486be34..476f1b04 100644 --- a/tools/alltogether/CMakeLists.txt +++ b/tools/alltogether/CMakeLists.txt @@ -11,6 +11,6 @@ set(LLVM_LINK_COMPONENTS add_llvm_tool(alltogether alltogether.cpp ) -target_link_libraries(alltogether liball ResourcePaths) +target_link_libraries(alltogether PRIVATE liball ResourcePaths) add_definitions(${LLVM_DEFINITIONS}) diff --git a/tools/alltogether/alltogether.cpp b/tools/alltogether/alltogether.cpp index 640f8403..52c72c16 100644 --- a/tools/alltogether/alltogether.cpp +++ b/tools/alltogether/alltogether.cpp @@ -14,8 +14,10 @@ #include "allvm/ResourceAnchor.h" #include "allvm/ToolCommon.h" +// XXX: Revisit this! +#include + #include -#include #include #include #include diff --git a/tools/bc2allvm/CMakeLists.txt b/tools/bc2allvm/CMakeLists.txt index a5e2239a..c3c78453 100644 --- a/tools/bc2allvm/CMakeLists.txt +++ b/tools/bc2allvm/CMakeLists.txt @@ -8,6 +8,6 @@ set(LLVM_LINK_COMPONENTS add_llvm_tool(bc2allvm bc2allvm.cpp ) -target_link_libraries(bc2allvm liball Passes ResourcePaths) +target_link_libraries(bc2allvm PRIVATE liball Passes ResourcePaths) add_definitions(${LLVM_DEFINITIONS}) diff --git a/tools/wllvm-dump/CMakeLists.txt b/tools/wllvm-dump/CMakeLists.txt index 8f5ff9df..a439099c 100644 --- a/tools/wllvm-dump/CMakeLists.txt +++ b/tools/wllvm-dump/CMakeLists.txt @@ -10,6 +10,6 @@ set(LLVM_LINK_COMPONENTS add_llvm_tool(wllvm-dump wllvm-dump.cpp ) -target_link_libraries(wllvm-dump wllvm) +target_link_libraries(wllvm-dump PRIVATE wllvm) add_definitions(${LLVM_DEFINITIONS}) diff --git a/tools/wllvm-extract/CMakeLists.txt b/tools/wllvm-extract/CMakeLists.txt index f13b97a5..5f8561ba 100644 --- a/tools/wllvm-extract/CMakeLists.txt +++ b/tools/wllvm-extract/CMakeLists.txt @@ -11,6 +11,6 @@ set(LLVM_LINK_COMPONENTS add_llvm_tool(wllvm-extract wllvm-extract.cpp ) -target_link_libraries(wllvm-extract liball ResourcePaths wllvm Passes) +target_link_libraries(wllvm-extract PRIVATE liball ResourcePaths wllvm Passes) add_definitions(${LLVM_DEFINITIONS}) diff --git a/tools/wllvm-extract/wllvm-extract.cpp b/tools/wllvm-extract/wllvm-extract.cpp index 44e93df4..243d6706 100644 --- a/tools/wllvm-extract/wllvm-extract.cpp +++ b/tools/wllvm-extract/wllvm-extract.cpp @@ -86,9 +86,9 @@ static std::string getDefaultSuffix(OutputKind K) { static Error writeAsSingleBC(const WLLVMFile &File, StringRef Filename) { // Initialize output file, error early if unavailable - std::unique_ptr Out; + std::unique_ptr Out; std::error_code EC; - Out.reset(new tool_output_file(Filename, EC, sys::fs::F_None)); + Out.reset(new ToolOutputFile(Filename, EC, sys::fs::F_None)); if (EC) return make_error( "error opening output file '" + Filename + "'", EC); @@ -109,7 +109,7 @@ static Error writeAsSingleBC(const WLLVMFile &File, StringRef Filename) { false, // ShouldPreserveUseListOrder nullptr, // ModuleSummaryIndex (ThinLTO) true // Generate Hash - ); + ); // We made it this far without error, keep the result. Out->keep(); return Error::success(); @@ -136,13 +136,8 @@ static Error writeAsBitcodeArchive(const WLLVMFile &File, StringRef Filename) { Twine(unique_id++) + "-" + sys::path::filename(BCFilename)); Members.push_back(std::move(*Member)); } - auto result = - writeArchive(Filename, Members, true /* writeSymTab */, Archive::K_GNU, - true /* deterministic */, false /* thin */); - if (result.second) - return make_error(result.first, result.second); - - return Error::success(); + return writeArchive(Filename, Members, true /* writeSymTab */, Archive::K_GNU, + true /* deterministic */, false /* thin */); } static Error writeAsAllexe(const WLLVMFile &File, StringRef Filename,