llvm::object::createBinary

Create a Binary by reading the file at Path, autodetecting its type.

Synopsis

Declared in <llvm/Object/Binary.h>

Expected<OwningBinary<Binary>>
createBinary(
    StringRef Path,
    LLVMContext* Context = nullptr,
    bool InitContent = true);

Return Value

An OwningBinary wrapping the created Binary, or an error.

Parameters

NameDescription
PathPath to the file to read.
ContextOptional LLVM IR context used when the file is bitcode; may be null.
InitContentIf true, run format-specific content initialization.