llvm::parseIRFile

If the given file holds a bitcode image, return a Module for it. Otherwise, attempt to parse it as LLVM Assembly and return a Module for it.

Synopsis

Declared in <llvm/IRReader/IRReader.h>

std::unique_ptr<Module>
parseIRFile(
    StringRef Filename,
    SMDiagnostic& Err,
    LLVMContext& Context,
    ParserCallbacks Callbacks = {},
    AsmParserContext* ParserContext = nullptr);

Return Value

A Module for the file contents, or nullptr on error.

Parameters

NameDescription
FilenamePath to the file containing bitcode or LLVM assembly.
ErrError result info.
ContextContext in which to allocate globals info.
CallbacksOptional parser customization callbacks.
ParserContextOptional context that records source locations.