aboutsummaryrefslogtreecommitdiff
path: root/include/llvm-c
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2007-12-12 01:04:30 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2007-12-12 01:04:30 +0000
commit1ae6135fa37eb061499d079b9b33dc82dcc1283f (patch)
tree2b885952bef39a4e82c353bd5880762d77517054 /include/llvm-c
parent772de516b6851e679d3da9e5171712b9c3122019 (diff)
Add (very basic) bindings for ModuleProvider.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm-c')
-rw-r--r--include/llvm-c/BitReader.h7
-rw-r--r--include/llvm-c/Core.h27
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) */