[patch] Deprecate LLVMModuleProviderRef

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 19 13:57:35 PST 2015


It has been the same thing as LLVMModuleRef for a 5 years.

Cheers,
Rafael
-------------- next part --------------
diff --git a/bindings/go/llvm/ir.go b/bindings/go/llvm/ir.go
index b8ea28d..d3840e5 100644
--- a/bindings/go/llvm/ir.go
+++ b/bindings/go/llvm/ir.go
@@ -43,9 +43,6 @@ type (
 	Builder struct {
 		C C.LLVMBuilderRef
 	}
-	ModuleProvider struct {
-		C C.LLVMModuleProviderRef
-	}
 	MemoryBuffer struct {
 		C C.LLVMMemoryBufferRef
 	}
@@ -75,7 +72,6 @@ func (c Type) IsNil() bool           { return c.C == nil }
 func (c Value) IsNil() bool          { return c.C == nil }
 func (c BasicBlock) IsNil() bool     { return c.C == nil }
 func (c Builder) IsNil() bool        { return c.C == nil }
-func (c ModuleProvider) IsNil() bool { return c.C == nil }
 func (c MemoryBuffer) IsNil() bool   { return c.C == nil }
 func (c PassManager) IsNil() bool    { return c.C == nil }
 func (c Use) IsNil() bool            { return c.C == nil }
@@ -1757,13 +1753,13 @@ func (b Builder) CreateResume(ex Value) (v Value) {
 
 // Changes the type of M so it can be passed to FunctionPassManagers and the
 // JIT. They take ModuleProviders for historical reasons.
-func NewModuleProviderForModule(m Module) (mp ModuleProvider) {
+func NewModuleProviderForModule(m Module) (mp Module) {
 	mp.C = C.LLVMCreateModuleProviderForExistingModule(m.C)
 	return
 }
 
 // Destroys the module M.
-func (mp ModuleProvider) Dispose() { C.LLVMDisposeModuleProvider(mp.C) }
+func (mp Module) Dispose() { C.LLVMDisposeModuleProvider(mp.C) }
 
 //-------------------------------------------------------------------------
 // llvm.MemoryBuffer
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index 8b33b6b..f40d721 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -49,6 +49,9 @@ Non-comprehensive list of changes in this release
    * Destroys the source instead of only damaging it.
    * Does not record a message. Use the diagnostic handler instead.
 
+* The C API type LLVMModuleProviderRef has been deprecated. It will be removed
+  in the 3.9 release.
+
 * The C API functions LLVMParseBitcode, LLVMParseBitcodeInContext,
   LLVMGetBitcodeModuleInContext and LLVMGetBitcodeModule have been deprecated.
   They will be removed in 3.9. Please migrate to the versions with a 2 suffix.
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h
index c8fda15..ca6a74a 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -2792,16 +2792,14 @@ LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op,
  */
 
 /**
- * Changes the type of M so it can be passed to FunctionPassManagers and the
- * JIT.  They take ModuleProviders for historical reasons.
+ * This is a nop.
  */
-LLVMModuleProviderRef
-LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M);
+LLVMModuleRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M);
 
 /**
  * Destroys the module M.
  */
-void LLVMDisposeModuleProvider(LLVMModuleProviderRef M);
+void LLVMDisposeModuleProvider(LLVMModuleRef M);
 
 /**
  * @}
@@ -2865,7 +2863,7 @@ LLVMPassManagerRef LLVMCreatePassManager(void);
 LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M);
 
 /** Deprecated: Use LLVMCreateFunctionPassManagerForModule instead. */
-LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP);
+LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleRef MP);
 
 /** Initializes, executes on the provided module, and finalizes all of the
     passes scheduled in the pass manager. Returns 1 if any of the passes
diff --git a/include/llvm-c/Types.h b/include/llvm-c/Types.h
index 1902958..1fe8d2a 100644
--- a/include/llvm-c/Types.h
+++ b/include/llvm-c/Types.h
@@ -90,11 +90,9 @@ typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
 typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
 
 /**
- * Interface used to provide a module to JIT or interpreter.
- * This is now just a synonym for llvm::Module, but we have to keep using the
- * different type to keep binary compatibility.
+ * Deprecated.
  */
-typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
+typedef LLVMModuleRef LLVMModuleProviderRef;
 
 /** @see llvm::PassManagerBase */
 typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
diff --git a/include/llvm/IR/Module.h b/include/llvm/IR/Module.h
index 942f685..8165669 100644
--- a/include/llvm/IR/Module.h
+++ b/include/llvm/IR/Module.h
@@ -647,14 +647,6 @@ inline raw_ostream &operator<<(raw_ostream &O, const Module &M) {
 
 // Create wrappers for C Binding types (see CBindingWrapping.h).
 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module, LLVMModuleRef)
-
-/* LLVMModuleProviderRef exists for historical reasons, but now just holds a
- * Module.
- */
-inline Module *unwrap(LLVMModuleProviderRef MP) {
-  return reinterpret_cast<Module*>(MP);
-}
-
 } // End llvm namespace
 
 #endif
diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp
index 7f39c80..aeb7a22 100644
--- a/lib/IR/Core.cpp
+++ b/lib/IR/Core.cpp
@@ -2827,15 +2827,11 @@ LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B,LLVMAtomicRMWBinOp op,
 
 /*===-- Module providers --------------------------------------------------===*/
 
-LLVMModuleProviderRef
-LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M) {
-  return reinterpret_cast<LLVMModuleProviderRef>(M);
-}
-
-void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP) {
-  delete unwrap(MP);
+LLVMModuleRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M) {
+  return M;
 }
 
+void LLVMDisposeModuleProvider(LLVMModuleRef MP) { delete unwrap(MP); }
 
 /*===-- Memory buffers ----------------------------------------------------===*/
 
@@ -2913,7 +2909,7 @@ LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M) {
   return wrap(new legacy::FunctionPassManager(unwrap(M)));
 }
 
-LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P) {
+LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleRef P) {
   return LLVMCreateFunctionPassManagerForModule(
                                             reinterpret_cast<LLVMModuleRef>(P));
 }


More information about the llvm-commits mailing list