13#include "llvm/Bitcode/BitcodeReader.h"
14#include "llvm/IR/Module.h"
20 if (!LinkModules.empty())
28 << F.Filename << BCBuf.getError().message();
34 llvm::getOwningLazyBitcodeModule(std::move(*BCBuf), Ctx);
36 llvm::handleAllErrors(
37 ModuleOrErr.takeError(), [&](llvm::ErrorInfoBase &EIB) {
38 CI.getDiagnostics().Report(diag::err_cannot_open_file)
39 << F.Filename << EIB.message();
45 LinkModules.push_back({std::move(ModuleOrErr.get()), F.PropagateAttrs,
46 F.Internalize, F.LinkFlags});
std::vector< BitcodeFileToLink > LinkBitcodeFiles
The files specified here are linked in to the module before optimizations.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
DiagnosticsEngine & getDiagnostics() const
Get the current diagnostics engine.
FileManager & getFileManager() const
Return the current file manager to the caller.
CodeGenOptions & getCodeGenOpts()
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > getBufferForFile(FileEntryRef Entry, bool isVolatile=false, bool RequiresNullTerminator=true, std::optional< int64_t > MaybeLimit=std::nullopt, bool IsText=true)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
The JSON file list parser is used to communicate input to InstallAPI.
bool loadLinkModules(CompilerInstance &CI, llvm::LLVMContext &Ctx, llvm::SmallVectorImpl< LinkModule > &LinkModules)
Load every bitcode file listed in CodeGenOpts.LinkBitcodeFiles into LinkModules.