MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / linkBitcodeString

Method linkBitcodeString

src/compiler/llvm-to-backend/LLVMToBackend.cpp:563–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561}
562
563bool LLVMToBackendTranslator::linkBitcodeString(llvm::Module &M, const std::string &Bitcode,
564 const std::string &ForcedTriple,
565 const std::string &ForcedDataLayout,
566 bool LinkOnlyNeeded) {
567 std::unique_ptr<llvm::Module> OtherModule;
568 auto err = loadModuleFromString(Bitcode, M.getContext(), OtherModule);
569
570 if (err) {
571 this->registerError("LLVMToBackend: Could not load LLVM module");
572 llvm::handleAllErrors(std::move(err), [&](llvm::ErrorInfoBase &EIB) {
573 this->registerError(EIB.message());
574 });
575 return false;
576 }
577
578 llvm::Linker::Flags F = llvm::Linker::None;
579 if(LinkOnlyNeeded)
580 F = llvm::Linker::LinkOnlyNeeded;
581
582 if(!linkBitcode(M, std::move(OtherModule), ForcedTriple, ForcedDataLayout, F)) {
583 this->registerError("LLVMToBackend: Linking module failed");
584 return false;
585 }
586
587 return true;
588}
589
590bool LLVMToBackendTranslator::linkBitcodeFile(llvm::Module &M, const std::string &BitcodeFile,
591 const std::string &ForcedTriple,

Callers 1

Calls 5

registerErrorMethod · 0.95
loadModuleFromStringFunction · 0.85
linkBitcodeFunction · 0.85
moveFunction · 0.50
messageMethod · 0.45

Tested by

no test coverage detected