Add (very basic) bindings for ModuleProvider.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44899 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm-c/BitReader.h b/include/llvm-c/BitReader.h
index edd5ffa..ba77988 100644
--- a/include/llvm-c/BitReader.h
+++ b/include/llvm-c/BitReader.h
@@ -32,6 +32,13 @@
 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 d3308ef..696ef6a 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -51,6 +51,7 @@
 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 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 @@
   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) */