diff options
Diffstat (limited to 'include/llvm-c')
-rw-r--r-- | include/llvm-c/BitReader.h | 7 | ||||
-rw-r--r-- | include/llvm-c/Core.h | 27 |
2 files changed, 34 insertions, 0 deletions
diff --git a/include/llvm-c/BitReader.h b/include/llvm-c/BitReader.h index edd5ffa3f1..ba77988a74 100644 --- a/include/llvm-c/BitReader.h +++ b/include/llvm-c/BitReader.h @@ -32,6 +32,13 @@ extern "C" { int LLVMReadBitcodeFromFile(const char *Path, LLVMModuleRef *OutModule, char **OutMessage); +/* Reads a module from the specified path, returning a reference to a lazy + module provider via the OutModule parameter. Returns 0 on success. Optionally + returns a human-readable error message. */ +int LLVMCreateModuleProviderFromFile(const char *Path, + LLVMModuleProviderRef *OutMP, + char **OutMessage); + /* Disposes of the message allocated by the bitcode reader, if any. */ void LLVMDisposeBitcodeReaderMessage(char *Message); diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index d3308eff63..696ef6a168 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -51,6 +51,7 @@ typedef struct LLVMOpaqueTypeHandle *LLVMTypeHandleRef; typedef struct LLVMOpaqueValue *LLVMValueRef; typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef; typedef struct LLVMOpaqueBuilder *LLVMBuilderRef; +typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef; typedef enum { LLVMVoidTypeKind, /* type with no size */ @@ -489,10 +490,26 @@ LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef, LLVMValueRef V1, LLVMValueRef V2, LLVMValueRef Mask, const char *Name); +/*===-- Module providers --------------------------------------------------===*/ + +/* Encapsulates the module M in a module provider, taking ownership of the + * module. + * See the constructor llvm::ExistingModuleProvider::ExistingModuleProvider. + */ +LLVMModuleProviderRef +LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M); + +/* Destroys the module provider MP as well as the contained module. + * See the destructor llvm::ModuleProvider::~ModuleProvider. + */ +void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP); + #ifdef __cplusplus } namespace llvm { + class ModuleProvider; + /* Opaque module conversions */ inline Module *unwrap(LLVMModuleRef M) { @@ -587,6 +604,16 @@ namespace llvm { inline LLVMTypeHandleRef wrap(PATypeHolder *B) { return reinterpret_cast<LLVMTypeHandleRef>(B); } + + /* Opaque module provider conversions. + */ + inline ModuleProvider *unwrap(LLVMModuleProviderRef P) { + return reinterpret_cast<ModuleProvider*>(P); + } + + inline LLVMModuleProviderRef wrap(ModuleProvider *P) { + return reinterpret_cast<LLVMModuleProviderRef>(P); + } } #endif /* !defined(__cplusplus) */ |