[llvm-commits] CVS: llvm/include/llvm/ModuleProvider.h

Misha Brukman brukman at cs.uiuc.edu
Mon Sep 22 18:36:01 PDT 2003


Changes in directory llvm/include/llvm:

ModuleProvider.h updated: 1.1 -> 1.2

---
Log message:

Materialize the module before releasing it.


---
Diffs of the changes:

Index: llvm/include/llvm/ModuleProvider.h
diff -u llvm/include/llvm/ModuleProvider.h:1.1 llvm/include/llvm/ModuleProvider.h:1.2
--- llvm/include/llvm/ModuleProvider.h:1.1	Thu Sep 18 11:16:32 2003
+++ llvm/include/llvm/ModuleProvider.h	Mon Sep 22 18:35:23 2003
@@ -11,17 +11,16 @@
 class Module;
 
 class AbstractModuleProvider {
-  Module *M;
-
 protected:
+  Module *TheModule;
   AbstractModuleProvider();
 
 public:
   virtual ~AbstractModuleProvider();
 
-  /// getModule - returns the module this provider is encapsulating
+  /// getModule - returns the module this provider is encapsulating.
   ///
-  Module* getModule() { return M; }
+  Module* getModule() { return TheModule; }
 
   /// materializeFunction - make sure the given function is fully read.
   ///
@@ -33,7 +32,13 @@
 
   /// releaseModule - no longer delete the Module* when provider is destroyed.
   ///
-  Module* releaseModule() { Module *tempM = M; M = 0; return tempM; }
+  virtual Module* releaseModule() { 
+    // Since we're losing control of this Module, we must hand it back complete
+    materializeModule();
+    Module *tempM = TheModule; 
+    TheModule = 0; 
+    return tempM; 
+  }
 
 };
 





More information about the llvm-commits mailing list