47 *OutMessage = strdup(Message.c_str());
53 *OutModule =
wrap(ModuleOrErr.
get().release());
65 std::unique_ptr<MemoryBuffer> Owner(
unwrap(MemBuf));
71 if (std::error_code EC = ModuleOrErr.
getError()) {
74 *OutMessage = strdup(EC.message().c_str());
78 *OutM =
wrap(ModuleOrErr.
get().release());
96 reinterpret_cast<LLVMModuleRef*>(OutMP),
std::error_code getError() const
Represents either an error or a value T.
A Module instance is used to store all the information related to an LLVM module. ...
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
Used to pass regions of memory through LLVM interfaces.
LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule, char **OutMessage)
LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf, LLVMModuleProviderRef *OutMP, char **OutMessage)
Deprecated: Use LLVMGetBitcodeModule instead.
LLVMBool LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleProviderRef *OutMP, char **OutMessage)
Deprecated: Use LLVMGetBitcodeModuleInContext instead.
struct LLVMOpaqueModuleProvider * LLVMModuleProviderRef
Interface used to provide a module to JIT or interpreter.
LLVMTargetDataRef wrap(const DataLayout *P)
LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule, char **OutMessage)
DataLayout * unwrap(LLVMTargetDataRef P)
This is the base abstract class for diagnostic reporting in the backend.
This is an important class for using LLVM in a threaded context.
ErrorOr< std::unique_ptr< Module > > parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context, DiagnosticHandlerFunction DiagnosticHandler=nullptr)
Read the specified bitcode file, returning the module.
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM, char **OutMessage)
virtual void print(DiagnosticPrinter &DP) const =0
Print using the given DP a user-friendly message.
Module.h This file contains the declarations for the Module class.
Basic diagnostic printer that uses an underlying raw_ostream.
LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM, char **OutMessage)
Reads a module from the specified path, returning via the OutMP parameter a module provider which per...
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
A raw_ostream that writes to an std::string.
ErrorOr< std::unique_ptr< Module > > getLazyBitcodeModule(std::unique_ptr< MemoryBuffer > &&Buffer, LLVMContext &Context, DiagnosticHandlerFunction DiagnosticHandler=nullptr, bool ShouldLazyLoadMetadata=false)
Read the header of the specified bitcode buffer and prepare for lazy deserialization of function bodi...
LLVMContextRef LLVMGetGlobalContext(void)
Obtain the global context instance.
LLVMContext & getGlobalContext()
getGlobalContext - Returns a global context.