MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / openInputFile

Function openInputFile

llvm_util/utils.cpp:530–543  ·  view source on GitHub ↗

adapted from llvm-dis.cpp

Source from the content-addressed store, hash-verified

528
529// adapted from llvm-dis.cpp
530std::unique_ptr<llvm::Module> openInputFile(llvm::LLVMContext &Context,
531 const string &InputFilename) {
532 auto MB =
533 ExitOnErr(errorOrToExpected(llvm::MemoryBuffer::getFile(InputFilename)));
534 llvm::SMDiagnostic Diag;
535 auto M = getLazyIRModule(std::move(MB), Diag, Context,
536 /*ShouldLazyLoadMetadata=*/true);
537 if (!M) {
538 Diag.print("", llvm::errs(), false);
539 return 0;
540 }
541 ExitOnErr(M->materializeAll());
542 return M;
543}
544
545llvm::Function *findFunction(llvm::Module &M, const string &FName) {
546 auto F = M.getFunction(FName);

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 1

printMethod · 0.45

Tested by

no test coverage detected