[llvm-commits] [poolalloc] r47092 - /poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp

John Criswell criswell at uiuc.edu
Wed Feb 13 14:22:22 PST 2008


Author: criswell
Date: Wed Feb 13 16:22:22 2008
New Revision: 47092

URL: http://llvm.org/viewvc/llvm-project?rev=47092&view=rev
Log:
Fix compilation when SAFECODE is defined.
Due to some strange errors when the C++ compiler tries to create a copy
constructor for struct FuncInfo, I cannot make ValueMap in struct FuncInfo a
DenseMap.  I cannot change the DenseMap to a std::map either because the 
CloneFunctionInto() function expects a DenseMap.  For now, I have just copied the data from the std::map into the DenseMap.

Modified:
    poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp

Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=47092&r1=47091&r2=47092&view=diff

==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Wed Feb 13 16:22:22 2008
@@ -410,10 +410,11 @@
 
   // Map the existing arguments of the old function to the corresponding
   // arguments of the new function, and copy over the names.
-#ifdef SAFECODE  
-  DenseMap<const Value*, Value*> &ValueMap = FI.ValueMap;
-#else
   DenseMap<const Value*, Value*> ValueMap;
+#ifdef SAFECODE  
+  for (std::map<const Value*, Value*>::iterator I = FI.ValueMap.begin(),
+         E = FI.ValueMap.end(); I != E; ++I)
+    ValueMap.insert(std::make_pair(I->first, I->second));
 #endif  
   for (Function::arg_iterator I = F.arg_begin();
        NI != New->arg_end(); ++I, ++NI) {





More information about the llvm-commits mailing list