Sorry, typo :)
[oota-llvm.git] / lib / Bitcode / Reader / BitcodeReader.h
index 3e0f807d9d2f6565a41867d0767ee2e45b4630df..0655a1a91c2be875e5d7da5aac18472bca7c3748 100644 (file)
@@ -39,6 +39,10 @@ public:
     ++NumOperands;
   }
   
+  void clear() {
+    std::vector<Use>().swap(Uses);
+  }
+  
   Value *operator[](unsigned i) const { return getOperand(i); }
   
   Value *back() const { return Uses.back(); }
@@ -98,6 +102,11 @@ class BitcodeReader : public ModuleProvider {
   // When reading the module header, this list is populated with functions that
   // have bodies later in the file.
   std::vector<Function*> FunctionsWithBodies;
+
+  // When intrinsic functions are encountered which require upgrading they are 
+  // stored here with their replacement function.
+  typedef std::vector<std::pair<Function*, Function*> > UpgradedIntrinsicMap;
+  UpgradedIntrinsicMap UpgradedIntrinsics;
   
   // After the module header has been read, the FunctionsWithBodies list is 
   // reversed.  This keeps track of whether we've done this yet.
@@ -111,8 +120,11 @@ public:
   BitcodeReader(MemoryBuffer *buffer) : Buffer(buffer), ErrorString(0) {
     HasReversedFunctionsWithBodies = false;
   }
-  ~BitcodeReader();
+  ~BitcodeReader() {
+    FreeState();
+  }
   
+  void FreeState();
   
   /// releaseMemoryBuffer - This causes the reader to completely forget about
   /// the memory buffer it contains, which prevents the buffer from being
@@ -124,6 +136,7 @@ public:
   virtual bool materializeFunction(Function *F, std::string *ErrInfo = 0);
   virtual Module *materializeModule(std::string *ErrInfo = 0);
   virtual void dematerializeFunction(Function *F);
+  virtual Module *releaseModule(std::string *ErrInfo = 0);
 
   bool Error(const char *Str) {
     ErrorString = Str;