Changes to build successfully with GCC 3.02


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1503 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index 02e14b6..7f33fe2 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -18,6 +18,8 @@
 #include "Support/STLExtras.h"
 #include <map>
 #include <algorithm>
+#include <iostream>
+using std::cerr;
 
 #include "llvm/Assembly/Writer.h"
 
@@ -96,7 +98,8 @@
 }
 
 static Instruction *ConvertMallocToType(MallocInst *MI, const Type *Ty,
-                                        const string &Name, ValueMapCache &VMC){
+                                        const std::string &Name,
+                                        ValueMapCache &VMC){
   BasicBlock *BB = MI->getParent();
   BasicBlock::iterator It = BB->end();
 
@@ -270,7 +273,7 @@
     // index array.  If there are, check to see if removing them causes us to
     // get to the right type...
     //
-    vector<Value*> Indices = GEP->copyIndices();
+    std::vector<Value*> Indices = GEP->copyIndices();
     const Type *BaseType = GEP->getPointerOperand()->getType();
     const Type *ElTy = 0;
 
@@ -302,7 +305,7 @@
       // Check to see if 'N' is an expression that can be converted to
       // the appropriate size... if so, allow it.
       //
-      vector<Value*> Indices;
+      std::vector<Value*> Indices;
       const Type *ElTy = ConvertableToGEP(PTy, I->getOperand(1), Indices);
       if (ElTy) {
         assert(ElTy == PVTy && "Internal error, setup wrong!");
@@ -378,7 +381,7 @@
 
   BasicBlock *BB = I->getParent();
   BasicBlock::InstListType &BIL = BB->getInstList();
-  string Name = I->getName();  if (!Name.empty()) I->setName("");
+  std::string Name = I->getName();  if (!Name.empty()) I->setName("");
   Instruction *Res;     // Result of conversion
 
   ValueHandle IHandle(VMC, I);  // Prevent I from being removed!
@@ -460,7 +463,7 @@
     // index array.  If there are, check to see if removing them causes us to
     // get to the right type...
     //
-    vector<Value*> Indices = GEP->copyIndices();
+    std::vector<Value*> Indices = GEP->copyIndices();
     const Type *BaseType = GEP->getPointerOperand()->getType();
     const Type *PVTy = cast<PointerType>(Ty)->getElementType();
     Res = 0;
@@ -491,7 +494,7 @@
       // Check to see if 'N' is an expression that can be converted to
       // the appropriate size... if so, allow it.
       //
-      vector<Value*> Indices;
+      std::vector<Value*> Indices;
       const Type *ElTy = ConvertableToGEP(NewSrcTy, I->getOperand(1),
                                           Indices, &It);
       if (ElTy) {        
@@ -634,7 +637,7 @@
   case Instruction::Add:
     if (isa<PointerType>(Ty)) {
       Value *IndexVal = I->getOperand(V == I->getOperand(0) ? 1 : 0);
-      vector<Value*> Indices;
+      std::vector<Value*> Indices;
       if (const Type *ETy = ConvertableToGEP(Ty, IndexVal, Indices)) {
         const Type *RetTy = PointerType::get(ETy);
 
@@ -685,7 +688,7 @@
       // They could be loading the first element of a composite type...
       if (const CompositeType *CT = dyn_cast<CompositeType>(LoadedTy)) {
         unsigned Offset = 0;     // No offset, get first leaf.
-        vector<Value*> Indices;  // Discarded...
+        std::vector<Value*> Indices;  // Discarded...
         LoadedTy = getStructOffsetType(CT, Offset, Indices, false);
         assert(Offset == 0 && "Offset changed from zero???");
       }
@@ -751,7 +754,7 @@
       // Check to see if the second argument is an expression that can
       // be converted to the appropriate size... if so, allow it.
       //
-      vector<Value*> Indices;
+      std::vector<Value*> Indices;
       const Type *ElTy = ConvertableToGEP(Ty, Index, Indices);
       delete TempScale;   // Free our temporary multiply if we made it
 
@@ -823,7 +826,7 @@
 
   BasicBlock *BB = I->getParent();
   BasicBlock::InstListType &BIL = BB->getInstList();
-  string Name = I->getName();  if (!Name.empty()) I->setName("");
+  std::string Name = I->getName();  if (!Name.empty()) I->setName("");
   Instruction *Res;     // Result of conversion
 
   //cerr << endl << endl << "Type:\t" << Ty << "\nInst: " << I << "BB Before: " << BB << endl;
@@ -844,12 +847,12 @@
   case Instruction::Add:
     if (isa<PointerType>(NewTy)) {
       Value *IndexVal = I->getOperand(OldVal == I->getOperand(0) ? 1 : 0);
-      vector<Value*> Indices;
+      std::vector<Value*> Indices;
       BasicBlock::iterator It = find(BIL.begin(), BIL.end(), I);
 
       if (const Type *ETy = ConvertableToGEP(NewTy, IndexVal, Indices, &It)) {
         // If successful, convert the add to a GEP
-        const Type *RetTy = PointerType::get(ETy);
+        //const Type *RetTy = PointerType::get(ETy);
         // First operand is actually the given pointer...
         Res = new GetElementPtrInst(NewVal, Indices, Name);
         assert(cast<PointerType>(Res->getType())->getElementType() == ETy &&
@@ -892,7 +895,7 @@
     const Type *LoadedTy =
       cast<PointerType>(NewVal->getType())->getElementType();
 
-    vector<Value*> Indices;
+    std::vector<Value*> Indices;
     Indices.push_back(ConstantUInt::get(Type::UIntTy, 0));
 
     if (const CompositeType *CT = dyn_cast<CompositeType>(LoadedTy)) {
@@ -914,7 +917,7 @@
       Res->setOperand(1, ConvertExpressionToType(I->getOperand(1), NewPT, VMC));
     } else {                           // Replace the source pointer
       const Type *ValTy = cast<PointerType>(NewTy)->getElementType();
-      vector<Value*> Indices;
+      std::vector<Value*> Indices;
 #if 0
       Indices.push_back(ConstantUInt::get(Type::UIntTy, 0));
       while (ArrayType *AT = dyn_cast<ArrayType>(ValTy)) {
@@ -948,7 +951,7 @@
 
     // Perform the conversion now...
     //
-    vector<Value*> Indices;
+    std::vector<Value*> Indices;
     const Type *ElTy = ConvertableToGEP(NewVal->getType(), Index, Indices, &It);
     assert(ElTy != 0 && "GEP Conversion Failure!");
     Res = new GetElementPtrInst(NewVal, Indices, Name);
@@ -965,7 +968,7 @@
       // Check to see if the second argument is an expression that can
       // be converted to the appropriate size... if so, allow it.
       //
-      vector<Value*> Indices;
+      std::vector<Value*> Indices;
       const Type *ElTy = ConvertableToGEP(NewVal->getType(), I->getOperand(1),
                                           Indices, &It);
       assert(ElTy != 0 && "GEP Conversion Failure!");
@@ -1001,9 +1004,10 @@
 
   case Instruction::Call: {
     Value *Meth = I->getOperand(0);
-    vector<Value*> Params(I->op_begin()+1, I->op_end());
+    std::vector<Value*> Params(I->op_begin()+1, I->op_end());
 
-    vector<Value*>::iterator OI = find(Params.begin(), Params.end(), OldVal);
+    std::vector<Value*>::iterator OI =
+      find(Params.begin(), Params.end(), OldVal);
     assert (OI != Params.end() && "Not using value!");
 
     *OI = NewVal;
diff --git a/lib/Transforms/HoistPHIConstants.cpp b/lib/Transforms/HoistPHIConstants.cpp
index e28e8a2..43ed725 100644
--- a/lib/Transforms/HoistPHIConstants.cpp
+++ b/lib/Transforms/HoistPHIConstants.cpp
@@ -14,8 +14,8 @@
 #include <map>
 #include <vector>
 
-typedef pair<BasicBlock *, Value*> BBConstTy;
-typedef map<BBConstTy, CastInst *> CachedCopyMap;
+typedef std::pair<BasicBlock *, Value*> BBConstTy;
+typedef std::map<BBConstTy, CastInst *> CachedCopyMap;
 
 static Value *NormalizePhiOperand(PHINode *PN, Value *CPV,
                                   BasicBlock *Pred, CachedCopyMap &CopyCache) {
@@ -33,7 +33,7 @@
   
   // Create a copy instruction and add it to the cache...
   CastInst *Inst = new CastInst(CPV, CPV->getType());
-  CopyCache.insert(make_pair(BBConstTy(Pred, CPV), Inst));
+  CopyCache.insert(std::make_pair(BBConstTy(Pred, CPV), Inst));
     
   // Insert the copy just before the terminator inst of the predecessor BB
   assert(Pred->getTerminator() && "Degenerate BB encountered!");
@@ -52,7 +52,7 @@
   bool Changed = false;
   
   for (Method::iterator BI = M->begin(), BE = M->end(); BI != BE; ++BI) {
-    vector<PHINode*> phis;            // normalizing invalidates BB iterator
+    std::vector<PHINode*> phis;          // normalizing invalidates BB iterator
       
     for (BasicBlock::iterator II = (*BI)->begin(); II != (*BI)->end(); ++II) {
       if (PHINode *PN = dyn_cast<PHINode>(*II))
@@ -61,7 +61,7 @@
         break;                      // All PHIs occur at top of BB!
     }
       
-    for (vector<PHINode*>::iterator PI=phis.begin(); PI != phis.end(); ++PI)
+    for (std::vector<PHINode*>::iterator PI=phis.begin(); PI != phis.end();++PI)
       for (unsigned i = 0; i < (*PI)->getNumIncomingValues(); ++i) {
         Value *Op = (*PI)->getIncomingValue(i);
         
diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp
index 70e3437..ff2442d 100644
--- a/lib/Transforms/IPO/ConstantMerge.cpp
+++ b/lib/Transforms/IPO/ConstantMerge.cpp
@@ -23,7 +23,7 @@
 //
 static inline 
 bool mergeDuplicateConstants(Module *M, unsigned &ConstantNo,
-                             map<Constant*, GlobalVariable*> &CMap) {
+                             std::map<Constant*, GlobalVariable*> &CMap) {
   Module::GlobalListType &GList = M->getGlobalList();
   if (GList.size() <= ConstantNo) return false;   // No new constants
   bool MadeChanges = false;
@@ -35,10 +35,10 @@
       Constant *Init = GV->getInitializer();
 
       // Check to see if the initializer is already known...
-      map<Constant*, GlobalVariable*>::iterator I = CMap.find(Init);
+      std::map<Constant*, GlobalVariable*>::iterator I = CMap.find(Init);
 
       if (I == CMap.end()) {    // Nope, add it to the map
-        CMap.insert(make_pair(Init, GV));
+        CMap.insert(std::make_pair(Init, GV));
       } else {                  // Yup, this is a duplicate!
         // Make all uses of the duplicate constant use the cannonical version...
         GV->replaceAllUsesWith(I->second);
@@ -59,7 +59,7 @@
 // deal with passes.
 //
 bool ConstantMerge::mergeDuplicateConstants(Module *M) {
-  map<Constant*, GlobalVariable*> Constants;
+  std::map<Constant*, GlobalVariable*> Constants;
   unsigned LastConstantSeen = 0;
   return ::mergeDuplicateConstants(M, LastConstantSeen, Constants);
 }
diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp
index ec4c3fd..d5e9ea0 100644
--- a/lib/Transforms/IPO/DeadTypeElimination.cpp
+++ b/lib/Transforms/IPO/DeadTypeElimination.cpp
@@ -23,6 +23,10 @@
 #include "llvm/iTerminators.h"
 #include "llvm/iOther.h"
 #include <algorithm>
+#include <iostream>
+using std::vector;
+using std::string;
+using std::cerr;
 
 static const Type *PtrSByte = 0;    // 'sbyte*' type
 
@@ -78,7 +82,7 @@
   SymbolTable *ST = M->getSymbolTable();
   if (!ST) return false;
 
-  map<string, vector<Method*> > Methods;
+  std::map<string, vector<Method*> > Methods;
 
   // Loop over the entries in the symbol table. If an entry is a method pointer,
   // then add it to the Methods map.  We do a two pass algorithm here to avoid
@@ -86,7 +90,7 @@
   //
   for (SymbolTable::iterator I = ST->begin(), E = ST->end(); I != E; ++I)
     if (const PointerType *PT = dyn_cast<PointerType>(I->first))
-      if (const MethodType *MT = dyn_cast<MethodType>(PT->getElementType())) {
+      if (isa<MethodType>(PT->getElementType())) {
         SymbolTable::VarMap &Plane = I->second;
         for (SymbolTable::type_iterator PI = Plane.begin(), PE = Plane.end();
              PI != PE; ++PI) {
@@ -101,7 +105,7 @@
   // Now we have a list of all methods with a particular name.  If there is more
   // than one entry in a list, merge the methods together.
   //
-  for (map<string, vector<Method*> >::iterator I = Methods.begin(), 
+  for (std::map<string, vector<Method*> >::iterator I = Methods.begin(), 
          E = Methods.end(); I != E; ++I) {
     vector<Method*> &Methods = I->second;
     Method *Implementation = 0;     // Find the implementation
@@ -145,7 +149,7 @@
         cerr << "Warning: Found methods types that are not compatible:\n";
         for (unsigned i = 0; i < Methods.size(); ++i) {
           cerr << "\t" << Methods[i]->getType()->getDescription() << " %"
-               << Methods[i]->getName() << endl;
+               << Methods[i]->getName() << "\n";
         }
         cerr << "  No linkage of methods named '" << Methods[0]->getName()
              << "' performed!\n";
@@ -185,7 +189,7 @@
                   ++i;
                 }
               } else {
-                cerr << "Cannot convert use of method: " << U << endl;
+                cerr << "Cannot convert use of method: " << U << "\n";
                 ++i;
               }
             }
@@ -201,7 +205,7 @@
 // ShouldNukSymtabEntry - Return true if this module level symbol table entry
 // should be eliminated.
 //
-static inline bool ShouldNukeSymtabEntry(const pair<string, Value*> &E) {
+static inline bool ShouldNukeSymtabEntry(const std::pair<string, Value*> &E) {
   // Nuke all names for primitive types!
   if (cast<Type>(E.second)->isPrimitiveType()) return true;
 
@@ -357,8 +361,8 @@
       Value *Src = CI->getOperand(0);
 
       // Move the cast instruction to the current insert position...
-      --InsertPos;            // New position for cast to go...
-      swap(*InsertPos, *I);   // Cast goes down, PHI goes up
+      --InsertPos;                 // New position for cast to go...
+      std::swap(*InsertPos, *I);   // Cast goes down, PHI goes up
 
       if (isa<PHINode>(Src) &&                                // Handle case #1
           cast<PHINode>(Src)->getParent() == BB) {
@@ -561,7 +565,7 @@
 
   if (M->hasSymbolTable()) {
     SymbolTable *ST = M->getSymbolTable();
-    const set<const Type *> &UsedTypes = FUT.getTypes();
+    const std::set<const Type *> &UsedTypes = FUT.getTypes();
 
     // Check the symbol table for superfluous type entries that aren't used in
     // the program
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp
index 7395bab..dacd329 100644
--- a/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/lib/Transforms/IPO/GlobalDCE.cpp
@@ -18,14 +18,14 @@
   // Calculate which methods are reachable from the external methods in the call
   // graph.
   //
-  set<cfg::CallGraphNode*> ReachableNodes(df_begin(&CallGraph),
-					  df_end(&CallGraph));
+  std::set<cfg::CallGraphNode*> ReachableNodes(df_begin(&CallGraph),
+                                               df_end(&CallGraph));
 
   // Loop over the methods in the module twice.  The first time is used to drop
   // references that methods have to each other before they are deleted.  The
   // second pass removes the methods that need to be removed.
   //
-  vector<cfg::CallGraphNode*> MethodsToDelete;   // Track unused methods
+  std::vector<cfg::CallGraphNode*> MethodsToDelete;   // Track unused methods
   for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
     cfg::CallGraphNode *N = CallGraph[*I];
     if (!ReachableNodes.count(N)) {              // Not reachable??
@@ -45,7 +45,7 @@
   // Unreachables methods have been found and should have no references to them,
   // delete them now.
   //
-  for (vector<cfg::CallGraphNode*>::iterator I = MethodsToDelete.begin(),
+  for (std::vector<cfg::CallGraphNode*>::iterator I = MethodsToDelete.begin(),
 	 E = MethodsToDelete.end(); I != E; ++I)
     delete CallGraph.removeMethodFromModule(*I);
 
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 40b98bd..9d86c86 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -27,6 +27,8 @@
 #include "llvm/iOther.h"
 #include <algorithm>
 #include <map>
+#include <iostream>
+using std::cerr;
 
 #include "llvm/Assembly/Writer.h"
 
@@ -36,7 +38,7 @@
 // current values into those specified by ValueMap.
 //
 static inline void RemapInstruction(Instruction *I, 
-				    map<const Value *, Value*> &ValueMap) {
+				    std::map<const Value *, Value*> &ValueMap) {
 
   for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) {
     const Value *Op = I->getOperand(op);
@@ -45,8 +47,8 @@
       continue;  // Globals and constants don't get relocated
 
     if (!V) {
-      cerr << "Val = " << endl << Op << "Addr = " << (void*)Op << endl;
-      cerr << "Inst = " << I;
+      cerr << "Val = \n" << Op << "Addr = " << (void*)Op;
+      cerr << "\nInst = " << I;
     }
     assert(V && "Referenced value not in value map!");
     I->setOperand(op, V);
@@ -72,10 +74,9 @@
   const Method *CalledMeth = CI->getCalledMethod();
   if (CalledMeth == 0 ||   // Can't inline external method or indirect call!
       CalledMeth->isExternal()) return false;
-  Method *CurrentMeth = CI->getParent()->getParent();
 
   //cerr << "Inlining " << CalledMeth->getName() << " into " 
-  //     << CurrentMeth->getName() << endl;
+  //     << CurrentMeth->getName() << "\n";
 
   BasicBlock *OrigBB = CI->getParent();
 
@@ -111,7 +112,7 @@
   // code's values.  This includes all of: Method arguments, instruction values,
   // constant pool entries, and basic blocks.
   //
-  map<const Value *, Value*> ValueMap;
+  std::map<const Value *, Value*> ValueMap;
 
   // Add the method arguments to the mapping: (start counting at 1 to skip the
   // method reference itself)
diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp
index c91c00c..df2b67e 100644
--- a/lib/Transforms/IPO/MutateStructTypes.cpp
+++ b/lib/Transforms/IPO/MutateStructTypes.cpp
@@ -21,6 +21,9 @@
 #include "llvm/iTerminators.h"
 #include "llvm/iOther.h"
 #include <algorithm>
+using std::map;
+using std::make_pair;
+using std::vector;
 
 // To enable debugging, uncomment this...
 //#define DEBUG_MST(x) x
@@ -37,7 +40,7 @@
 struct ValuePlaceHolder : public Instruction {
   ValuePlaceHolder(const Type *Ty) : Instruction(Ty, UserOp1, "") {}
 
-  virtual Instruction *clone() const { abort(); }
+  virtual Instruction *clone() const { abort(); return 0; }
   virtual const char *getOpcodeName() const { return "placeholder"; }
 };
 
@@ -291,8 +294,8 @@
 // of the methods and global variables that we no longer need.
 bool MutateStructTypes::doPassFinalization(Module *M) {
   // The first half of the methods in the module have to go.
-  unsigned NumMethods = M->size();
-  unsigned NumGVars   = M->gsize();
+  //unsigned NumMethods = M->size();
+  //unsigned NumGVars   = M->gsize();
 
   // Prepare for deletion of globals by dropping their interdependencies...
   for(Module::iterator I = M->begin(); I != M->end(); ++I) {
@@ -436,12 +439,11 @@
           AdjustIndices(cast<CompositeType>(PTy), Indices);
         }
 
-        if (const LoadInst *LI = dyn_cast<LoadInst>(I)) {
+        if (isa<LoadInst>(I)) {
           NewI = new LoadInst(NewPtr, Indices);
-        } else if (const StoreInst *SI = dyn_cast<StoreInst>(I)) {
+        } else if (isa<StoreInst>(I)) {
           NewI = new StoreInst(ConvertValue(I->getOperand(0)), NewPtr, Indices);
-        } else if (const GetElementPtrInst *GEP =
-                   dyn_cast<GetElementPtrInst>(I)) {
+        } else if (isa<GetElementPtrInst>(I)) {
           NewI = new GetElementPtrInst(NewPtr, Indices);
         } else {
           assert(0 && "Unknown memory access inst!!!");
diff --git a/lib/Transforms/IPO/SimpleStructMutation.cpp b/lib/Transforms/IPO/SimpleStructMutation.cpp
index d938545..d0b8bb2 100644
--- a/lib/Transforms/IPO/SimpleStructMutation.cpp
+++ b/lib/Transforms/IPO/SimpleStructMutation.cpp
@@ -12,9 +12,14 @@
 #include "llvm/Analysis/FindUnsafePointerTypes.h"
 #include "TransformInternals.h"
 #include <algorithm>
+#include <iostream>
+using std::vector;
+using std::set;
+using std::pair;
 
 #include "llvm/Assembly/Writer.h"
 
+
 // PruneTypes - Given a type Ty, make sure that neither it, or one of its
 // subtypes, occur in TypesToModify.
 //
@@ -26,7 +31,7 @@
   // If the element is in TypesToModify, remove it now...
   if (const StructType *ST = dyn_cast<StructType>(Ty)) {
     TypesToModify.erase(ST);  // This doesn't fail if the element isn't present
-    cerr << "Unable to swap type: " << ST << endl;
+    std::cerr << "Unable to swap type: " << ST << "\n";
   }
 
   // Remove all types that this type contains as well... do not remove types
@@ -69,7 +74,8 @@
 
     // Build mapping from index to size
     for (unsigned i = 0; i < NumElements; ++i)
-      ElList.push_back(make_pair(i, TD.getTypeSize(ST->getElementTypes()[i])));
+      ElList.push_back(
+              std::make_pair(i, TD.getTypeSize(ST->getElementTypes()[i])));
 
     sort(ElList.begin(), ElList.end(), ptr_fun(FirstLess));
 
@@ -118,14 +124,14 @@
   set<const Type*> ProcessedTypes;
   for (set<PointerType*>::const_iterator I = UnsafePTys.begin(),
          E = UnsafePTys.end(); I != E; ++I) {
-    //cerr << "Pruning type: " << *I << endl;
+    //cerr << "Pruning type: " << *I << "\n";
     PruneTypes(*I, TypesToModify, ProcessedTypes);
   }
 
 
   // Build up a set of structure types that we are going to modify, and
   // information describing how to modify them.
-  map<const StructType*, vector<int> > Transforms;
+  std::map<const StructType*, vector<int> > Transforms;
 
   for (set<const StructType*>::iterator I = TypesToModify.begin(),
          E = TypesToModify.end(); I != E; ++I) {
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index 7948266..00acac8 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -18,7 +18,8 @@
 #include "llvm/Assembly/Writer.h"
 #include "Support/StringExtras.h"
 #include <sstream>
-
+using std::vector;
+using std::string;
 
 // Add a prototype for printf if it is not already in the program.
 //
@@ -110,8 +111,6 @@
   // Escape Message by replacing all % characters with %% chars.
   unsigned Offset = 0;
   while ((Offset = Message.find('%', Offset)) != string::npos) {
-    string::iterator Offs = Message.begin()+Offset;
-    //Message.replace(Offs, Offs+1, "%%");
     Message.replace(Offset, 2, "%%");
     Offset += 2;  // Skip over the new %'s
   }
@@ -140,7 +139,7 @@
 static void InsertVerbosePrintInst(Value *V, BasicBlock *BB,
                                    BasicBlock::iterator &BBI,
                                    const string &Message, Method *Printf) {
-  ostringstream OutStr;
+  std::ostringstream OutStr;
   if (V) WriteAsOperand(OutStr, V);
   InsertPrintInst(V, BB, BBI, Message+OutStr.str()+" = ", Printf);
 }
@@ -184,7 +183,7 @@
   // Copy all of the instructions into a vector to avoid problems with Setcc
   const vector<Instruction*> Insts(BB->begin(), InsertPos);
 
-  ostringstream OutStr;
+  std::ostringstream OutStr;
   WriteAsOperand(OutStr, BB, false);
   InsertPrintInst(0, BB, InsertPos, "LEAVING BB:" + OutStr.str(), Printf);
 
@@ -211,7 +210,7 @@
   BasicBlock *BB = M->getEntryNode();
   BasicBlock::iterator BBI = BB->begin();
 
-  ostringstream OutStr;
+  std::ostringstream OutStr;
   WriteAsOperand(OutStr, M, true);
   InsertPrintInst(0, BB, BBI, "ENTERING METHOD: " + OutStr.str(), Printf);
 
@@ -231,7 +230,7 @@
   BasicBlock::iterator BBI = BB->end()-1;
   ReturnInst *Ret = cast<ReturnInst>(*BBI);
   
-  ostringstream OutStr;
+  std::ostringstream OutStr;
   WriteAsOperand(OutStr, BB->getParent(), true);
   InsertPrintInst(0, BB, BBI, "LEAVING  METHOD: " + OutStr.str(), Printf);
   
@@ -249,8 +248,6 @@
   vector<Instruction*> valuesStoredInMethod;
   vector<BasicBlock*>  exitBlocks;
 
-  Module *module = M->getParent();
- 
   if (traceMethodEvents)
     InsertCodeToShowMethodEntry(M, Printf);
   
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index e47eb90..f140676 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -75,7 +75,7 @@
     }
   }
 
-  vector<Value*> Indices;
+  std::vector<Value*> Indices;
   Value *Src = CI->getOperand(0);
   const Type *Result = ConvertableToGEP(DestPTy, Src, Indices, &BI);
   if (Result == 0) return false;  // Not convertable...
@@ -137,7 +137,7 @@
   if (!CompTy || !SrcPtr || !OffsetVal->getType()->isIntegral())
     return false;
 
-  vector<Value*> Indices;
+  std::vector<Value*> Indices;
   if (!ConvertableToGEP(SrcPtr->getType(), OffsetVal, Indices, &BI))
     return false;  // Not convertable... perhaps next time
 
@@ -174,7 +174,7 @@
       PRINT_PEEPHOLE1("cast-of-self-ty", CI);
       CI->replaceAllUsesWith(Src);
       if (!Src->hasName() && CI->hasName()) {
-        string Name = CI->getName();
+        std::string Name = CI->getName();
         CI->setName("");
         Src->setName(Name, BB->getParent()->getSymbolTable());
       }
@@ -299,7 +299,7 @@
           const Type *ElTy = 0;
 
           // Build the index vector, full of all zeros
-          vector<Value*> Indices;
+          std::vector<Value*> Indices;
           Indices.push_back(ConstantUInt::get(Type::UIntTy, 0));
           while (CurCTy && !isa<PointerType>(CurCTy)) {
             if (const StructType *CurSTy = dyn_cast<StructType>(CurCTy)) {
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index a38dbc5..45a57a2 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -17,6 +17,8 @@
 #include "Support/DepthFirstIterator.h"
 #include <set>
 #include <algorithm>
+#include <iostream>
+using std::cerr;
 
 #define DEBUG_ADCE 1
 
@@ -28,8 +30,8 @@
 //
 class ADCE {
   Method *M;                            // The method that we are working on...
-  vector<Instruction*>   WorkList;      // Instructions that just became live
-  set<Instruction*>      LiveSet;       // The set of live instructions
+  std::vector<Instruction*> WorkList;   // Instructions that just became live
+  std::set<Instruction*>    LiveSet;    // The set of live instructions
   bool MadeChanges;
 
   //===--------------------------------------------------------------------===//
@@ -66,8 +68,8 @@
   // fixupCFG - Walk the CFG in depth first order, eliminating references to 
   // dead blocks.
   //
-  BasicBlock *fixupCFG(BasicBlock *Head, set<BasicBlock*> &VisitedBlocks,
-		       const set<BasicBlock*> &AliveBlocks);
+  BasicBlock *fixupCFG(BasicBlock *Head, std::set<BasicBlock*> &VisitedBlocks,
+		       const std::set<BasicBlock*> &AliveBlocks);
 };
 
 
@@ -121,7 +123,7 @@
   // AliveBlocks - Set of basic blocks that we know have instructions that are
   // alive in them...
   //
-  set<BasicBlock*> AliveBlocks;
+  std::set<BasicBlock*> AliveBlocks;
 
   // Process the work list of instructions that just became live... if they
   // became live, then that means that all of their operands are neccesary as
@@ -169,7 +171,7 @@
   // After the worklist is processed, recursively walk the CFG in depth first
   // order, patching up references to dead blocks...
   //
-  set<BasicBlock*> VisitedBlocks;
+  std::set<BasicBlock*> VisitedBlocks;
   BasicBlock *EntryBlock = fixupCFG(M->front(), VisitedBlocks, AliveBlocks);
   if (EntryBlock && EntryBlock != M->front()) {
     if (isa<PHINode>(EntryBlock->front())) {
@@ -194,7 +196,7 @@
     } else {
       // We need to move the new entry block to be the first bb of the method.
       Method::iterator EBI = find(M->begin(), M->end(), EntryBlock);
-      swap(*EBI, *M->begin());  // Exchange old location with start of method
+      std::swap(*EBI, *M->begin());// Exchange old location with start of method
       MadeChanges = true;
     }
   }
@@ -242,8 +244,8 @@
 //        been in the alive set).
 //   3. Return the nonnull child, or 0 if no non-null children.
 //
-BasicBlock *ADCE::fixupCFG(BasicBlock *BB, set<BasicBlock*> &VisitedBlocks,
-			   const set<BasicBlock*> &AliveBlocks) {
+BasicBlock *ADCE::fixupCFG(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks,
+			   const std::set<BasicBlock*> &AliveBlocks) {
   if (VisitedBlocks.count(BB)) return 0;   // Revisiting a node? No update.
   VisitedBlocks.insert(BB);                // We have now visited this node!
 
diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp
index c267d95..a961bad 100644
--- a/lib/Transforms/Scalar/ConstantProp.cpp
+++ b/lib/Transforms/Scalar/ConstantProp.cpp
@@ -159,7 +159,7 @@
 bool opt::ConstantPropogation::doConstantPropogation(BasicBlock *BB,
 						     BasicBlock::iterator &II) {
   Instruction *Inst = *II;
-  if (BinaryOperator *BInst = dyn_cast<BinaryOperator>(Inst)) {
+  if (isa<BinaryOperator>(Inst)) {
     Constant *D1 = dyn_cast<Constant>(Inst->getOperand(0));
     Constant *D2 = dyn_cast<Constant>(Inst->getOperand(1));
 
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp
index 6c4e3d2..eadf7b1 100644
--- a/lib/Transforms/Scalar/DCE.cpp
+++ b/lib/Transforms/Scalar/DCE.cpp
@@ -117,7 +117,7 @@
   // If there is more than one predecessor, and there are PHI nodes in
   // the successor, then we need to add incoming edges for the PHI nodes
   //
-  const vector<BasicBlock*> BBPreds(BB->pred_begin(), BB->pred_end());
+  const std::vector<BasicBlock*> BBPreds(BB->pred_begin(), BB->pred_end());
 
   // Check to see if one of the predecessors of BB is already a predecessor of
   // Succ.  If so, we cannot do the transformation!
@@ -134,7 +134,7 @@
     Value *OldVal = PN->removeIncomingValue(BB);
     assert(OldVal && "No entry in PHI for Pred BB!");
 
-    for (vector<BasicBlock*>::const_iterator PredI = BBPreds.begin(), 
+    for (std::vector<BasicBlock*>::const_iterator PredI = BBPreds.begin(), 
 	   End = BBPreds.end(); PredI != End; ++PredI) {
       // Add an incoming value for each of the new incoming values...
       PN->addIncoming(OldVal, *PredI);
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index d03b4f3..35844ca 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -35,7 +35,7 @@
   // Transform all subloops before this loop...
   bool Changed = reduce_apply_bool(Loop->getSubLoops().begin(),
                                    Loop->getSubLoops().end(),
-                                   std::bind1st(ptr_fun(TransformLoop), Loops));
+                              std::bind1st(std::ptr_fun(TransformLoop), Loops));
   // Get the header node for this loop.  All of the phi nodes that could be
   // induction variables must live in this basic block.
   BasicBlock *Header = (BasicBlock*)Loop->getBlocks().front();
@@ -44,7 +44,7 @@
   // induction variables that they represent... stuffing the induction variable
   // info into a vector...
   //
-  vector<InductionVariable> IndVars;    // Induction variables for block
+  std::vector<InductionVariable> IndVars;    // Induction variables for block
   for (BasicBlock::iterator I = Header->begin(); 
        PHINode *PN = dyn_cast<PHINode>(*I); ++I)
     IndVars.push_back(InductionVariable(PN, Loops));
@@ -133,7 +133,7 @@
       Instruction *Val = IterCount;
       if (!isa<ConstantInt>(IV->Step) ||   // If the step != 1
           !cast<ConstantInt>(IV->Step)->equalsInt(1)) {
-        string Name;   // Create a scale by the step value...
+        std::string Name;   // Create a scale by the step value...
         if (IV->Phi->hasName()) Name = IV->Phi->getName()+"-scale";
 
         // If the types are not compatible, insert a cast now...
@@ -148,7 +148,7 @@
 
       if (!isa<Constant>(IV->Start) ||   // If the start != 0
           !cast<Constant>(IV->Start)->isNullValue()) {
-        string Name;   // Create a offset by the start value...
+        std::string Name;   // Create a offset by the start value...
         if (IV->Phi->hasName()) Name = IV->Phi->getName()+"-offset";
 
         // If the types are not compatible, insert a cast now...
@@ -170,7 +170,7 @@
       IV->Phi->replaceAllUsesWith(Val);
 
       // Move the PHI name to it's new equivalent value...
-      string OldName = IV->Phi->getName();
+      std::string OldName = IV->Phi->getName();
       IV->Phi->setName("");
       Val->setName(OldName);
 
diff --git a/lib/Transforms/Scalar/InductionVars.cpp b/lib/Transforms/Scalar/InductionVars.cpp
index d4b7bc5..93ab189 100644
--- a/lib/Transforms/Scalar/InductionVars.cpp
+++ b/lib/Transforms/Scalar/InductionVars.cpp
@@ -27,6 +27,8 @@
 #include "llvm/iPHINode.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
+#include <iostream>
+using std::cerr;
 
 #include "llvm/Analysis/LoopDepth.h"
 
@@ -176,7 +178,7 @@
 // present induction variables (instead of always using uint)
 //
 static PHINode *InjectSimpleInductionVariable(cfg::Interval *Int) {
-  string PHIName, AddName;
+  std::string PHIName, AddName;
 
   BasicBlock *Header = Int->getHeaderNode();
   Method *M = Header->getParent();
@@ -205,7 +207,7 @@
   assert(++PI == Header->pred_end() && "Header node should have 2 preds!");
 
   // Make Pred1 be the loop entrance predecessor, Pred2 be the Loop predecessor
-  if (Int->contains(Pred1)) swap(Pred1, Pred2);
+  if (Int->contains(Pred1)) std::swap(Pred1, Pred2);
 
   assert(!Int->contains(Pred1) && "Pred1 should be loop entrance!");
   assert( Int->contains(Pred2) && "Pred2 should be looping edge!");
@@ -250,7 +252,7 @@
 static bool ProcessInterval(cfg::Interval *Int) {
   if (!Int->isLoop()) return false;  // Not a loop?  Ignore it!
 
-  vector<PHINode *> InductionVars;
+  std::vector<PHINode *> InductionVars;
 
   BasicBlock *Header = Int->getHeaderNode();
   // Loop over all of the PHI nodes in the interval header...
@@ -278,7 +280,7 @@
       if (isLoopInvariant(Int, V2)) {
 	// They *are* loop invariant.  Exchange BB1/BB2 and V1/V2 so that
 	// V1 is always the loop invariant computation.
-	swap(V1, V2); swap(BB1, BB2);
+	std::swap(V1, V2); std::swap(BB1, BB2);
       } else {
 	// Neither value is loop invariant.  Must not be an induction variable.
 	// This case can happen if there is an unreachable loop in the CFG that
@@ -292,7 +294,7 @@
     // anything about BB2/V2.  Check now to see if V2 is a linear induction
     // variable.
     //
-    cerr << "Found loop invariant computation: " << V1 << endl;
+    cerr << "Found loop invariant computation: " << V1 << "\n";
     
     if (!isLinearInductionVariable(Int, V2, PN))
       continue;         // No, it is not a linear ind var, ignore the PHI node.
@@ -308,7 +310,7 @@
   if (InductionVars.empty()) return false;
 
   // Search to see if there is already a "simple" induction variable.
-  vector<PHINode*>::iterator It = 
+  std::vector<PHINode*>::iterator It = 
     find_if(InductionVars.begin(), InductionVars.end(), isSimpleInductionVar);
   
   PHINode *PrimaryIndVar;
@@ -329,7 +331,7 @@
 	   "How could Primary IndVar not be in the header!?!!?");
 
     if (i != Header->begin())
-      iter_swap(i, Header->begin());
+      std::iter_swap(i, Header->begin());
   }
 
   // Now we know that there is a simple induction variable PrimaryIndVar.
@@ -364,7 +366,7 @@
   // variables in intervals that represent loops.
   //
   return reduce_apply(IP.begin(), IP.end(), bitwise_or<bool>(), false,
-		      ptr_fun(ProcessInterval));
+		      std::ptr_fun(ProcessInterval));
 }
 
 // DoInductionVariableCannonicalize - Simplify induction variables in loops.
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 87f8ed1..795418f 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -76,7 +76,7 @@
     dyn_cast<GetElementPtrInst>(MAI->getPointerOperand());
   if (!Src) return 0;
 
-  vector<Value *> Indices;
+  std::vector<Value *> Indices;
   
   // Only special case we have to watch out for is pointer arithmetic on the
   // 0th index of MAI. 
@@ -128,7 +128,7 @@
 
 bool InstructionCombining::doit(Method *M) {
   // Start the worklist out with all of the instructions in the method in it.
-  vector<Instruction*> WorkList(M->inst_begin(), M->inst_end());
+  std::vector<Instruction*> WorkList(M->inst_begin(), M->inst_end());
 
   while (!WorkList.empty()) {
     Instruction *I = WorkList.back();  // Get an instruction from the worklist
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 26a52d6..68be844 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -30,6 +30,8 @@
 #include <algorithm>
 #include <map>
 #include <set>
+#include <iostream>
+using std::cerr;
 
 // InstVal class - This class represents the different lattice values that an 
 // instruction may occupy.  It is a simple class with value semantics.  The
@@ -84,13 +86,13 @@
 // It's public interface consists of a constructor and a doSCCP() method.
 //
 class SCCP {
-  Method *M;                            // The method that we are working on...
+  Method *M;                             // The method that we are working on...
 
-  set<BasicBlock*>       BBExecutable;  // The basic blocks that are executable
-  map<Value*, InstVal>   ValueState;    // The state each value is in...
+  std::set<BasicBlock*>     BBExecutable;// The basic blocks that are executable
+  std::map<Value*, InstVal> ValueState;  // The state each value is in...
 
-  vector<Instruction*>   InstWorkList;  // The instruction work list
-  vector<BasicBlock*>    BBWorkList;    // The BasicBlock work list
+  std::vector<Instruction*> InstWorkList;// The instruction work list
+  std::vector<BasicBlock*>  BBWorkList;  // The BasicBlock work list
 
   //===--------------------------------------------------------------------===//
   // The public interface for this class
@@ -144,7 +146,7 @@
   // Instruction object, then use this accessor to get its value from the map.
   //
   inline InstVal &getValueState(Value *V) {
-    map<Value*, InstVal>::iterator I = ValueState.find(V);
+    std::map<Value*, InstVal>::iterator I = ValueState.find(V);
     if (I != ValueState.end()) return I->second;  // Common case, in the map
       
     if (Constant *CPV = dyn_cast<Constant>(V)) {  // Constants are constant
diff --git a/lib/Transforms/Scalar/SymbolStripping.cpp b/lib/Transforms/Scalar/SymbolStripping.cpp
index bb4f01c..417376b 100644
--- a/lib/Transforms/Scalar/SymbolStripping.cpp
+++ b/lib/Transforms/Scalar/SymbolStripping.cpp
@@ -24,7 +24,7 @@
   bool RemovedSymbol = false;
 
   for (SymbolTable::iterator I = SymTab->begin(); I != SymTab->end(); ++I) {
-    map<const string, Value *> &Plane = I->second;
+    std::map<const std::string, Value *> &Plane = I->second;
     
     SymbolTable::type_iterator B;
     while ((B = Plane.begin()) != Plane.end()) {   // Found nonempty type plane!
diff --git a/lib/Transforms/TransformInternals.cpp b/lib/Transforms/TransformInternals.cpp
index cd62885..6c7f856 100644
--- a/lib/Transforms/TransformInternals.cpp
+++ b/lib/Transforms/TransformInternals.cpp
@@ -82,7 +82,7 @@
 // false if you want a leaf
 //
 const Type *getStructOffsetType(const Type *Ty, unsigned &Offset,
-                                vector<Value*> &Offsets,
+                                std::vector<Value*> &Offsets,
                                 bool StopEarly = true) {
   if (Offset == 0 && StopEarly && !Offsets.empty())
     return Ty;    // Return the leaf type
@@ -130,7 +130,7 @@
 // instruction.  The type returned is the root type that the GEP would point to
 //
 const Type *ConvertableToGEP(const Type *Ty, Value *OffsetVal,
-                             vector<Value*> &Indices,
+                             std::vector<Value*> &Indices,
                              BasicBlock::iterator *BI = 0) {
   const CompositeType *CompTy = dyn_cast<CompositeType>(Ty);
   if (CompTy == 0) return 0;
diff --git a/lib/Transforms/TransformInternals.h b/lib/Transforms/TransformInternals.h
index 200a4d7..7bc3df4 100644
--- a/lib/Transforms/TransformInternals.h
+++ b/lib/Transforms/TransformInternals.h
@@ -24,7 +24,7 @@
 //
 extern const TargetData TD;
 
-static int getConstantValue(const ConstantInt *CPI) {
+static inline int getConstantValue(const ConstantInt *CPI) {
   if (const ConstantSInt *CSI = dyn_cast<ConstantSInt>(CPI))
     return CSI->getValue();
   return cast<ConstantUInt>(CPI)->getValue();
@@ -65,25 +65,26 @@
 // If BI is nonnull, cast instructions are inserted as appropriate for the
 // arguments of the getelementptr.
 //
-const Type *ConvertableToGEP(const Type *Ty, Value *V, vector<Value*> &Indices,
+const Type *ConvertableToGEP(const Type *Ty, Value *V,
+                             std::vector<Value*> &Indices,
                              BasicBlock::iterator *BI = 0);
 
 
 // ------------- Expression Conversion ---------------------
 
-typedef map<const Value*, const Type*>         ValueTypeCache;
+typedef std::map<const Value*, const Type*>         ValueTypeCache;
 
 struct ValueMapCache {
   // Operands mapped - Contains an entry if the first value (the user) has had
   // the second value (the operand) mapped already.
   //
-  set<const User*> OperandsMapped;
+  std::set<const User*> OperandsMapped;
 
   // Expression Map - Contains an entry from the old value to the new value of
   // an expression that has been converted over.
   //
-  map<const Value *, Value *> ExprMap;
-  typedef map<const Value *, Value *> ExprMapTy;
+  std::map<const Value *, Value *> ExprMap;
+  typedef std::map<const Value *, Value *> ExprMapTy;
 };
 
 
@@ -137,7 +138,7 @@
 // false if you want a leaf
 //
 const Type *getStructOffsetType(const Type *Ty, unsigned &Offset,
-                                vector<Value*> &Offsets,
+                                std::vector<Value*> &Offsets,
                                 bool StopEarly = true);
 
 #endif
diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp
index f04c8a4..e162252 100644
--- a/lib/Transforms/Utils/Linker.cpp
+++ b/lib/Transforms/Utils/Linker.cpp
@@ -17,6 +17,10 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/iOther.h"
 #include "llvm/ConstantVals.h"
+#include <iostream>
+using std::cerr;
+using std::string;
+using std::map;
 
 // Error - Simple wrapper function to conditionally assign to E and return true.
 // This just makes error return conditions a little bit simpler...
@@ -70,7 +74,7 @@
   for (map<const Value*, Value*>::const_iterator I = M.begin(), E = M.end();
        I != E; ++I) {
     cerr << " Fr: " << (void*)I->first << " " << I->first 
-         << " To: " << (void*)I->second << " " << I->second << endl;
+         << " To: " << (void*)I->second << " " << I->second << "\n";
   }
 }
 
@@ -97,15 +101,15 @@
     Constant *Result = 0;
 
     if (ConstantArray *CPA = dyn_cast<ConstantArray>(CPV)) {
-      const vector<Use> &Ops = CPA->getValues();
-      vector<Constant*> Operands(Ops.size());
+      const std::vector<Use> &Ops = CPA->getValues();
+      std::vector<Constant*> Operands(Ops.size());
       for (unsigned i = 0; i < Ops.size(); ++i)
         Operands[i] = 
           cast<Constant>(RemapOperand(Ops[i], LocalMap, GlobalMap));
       Result = ConstantArray::get(cast<ArrayType>(CPA->getType()), Operands);
     } else if (ConstantStruct *CPS = dyn_cast<ConstantStruct>(CPV)) {
-      const vector<Use> &Ops = CPS->getValues();
-      vector<Constant*> Operands(Ops.size());
+      const std::vector<Use> &Ops = CPS->getValues();
+      std::vector<Constant*> Operands(Ops.size());
       for (unsigned i = 0; i < Ops.size(); ++i)
         Operands[i] = 
           cast<Constant>(RemapOperand(Ops[i], LocalMap, GlobalMap));
@@ -120,7 +124,7 @@
     }
 
     // Cache the mapping in our local map structure...
-    LocalMap.insert(make_pair(In, CPV));
+    LocalMap.insert(std::make_pair(In, CPV));
     return Result;
   }
 
@@ -132,7 +136,7 @@
     PrintMap(*GlobalMap);
   }
 
-  cerr << "Couldn't remap value: " << (void*)In << " " << In << endl;
+  cerr << "Couldn't remap value: " << (void*)In << " " << In << "\n";
   assert(0 && "Couldn't remap value!");
   return 0;
 }
@@ -172,7 +176,7 @@
                      " - Global variables differ in const'ness");
 
       // Okay, everything is cool, remember the mapping...
-      ValueMap.insert(make_pair(SGV, DGV));
+      ValueMap.insert(std::make_pair(SGV, DGV));
     } else {
       // No linking to be performed, simply create an identical version of the
       // symbol over in the dest module... the initializer will be filled in
@@ -186,7 +190,7 @@
       Dest->getGlobalList().push_back(DGV);
 
       // Make sure to remember this mapping...
-      ValueMap.insert(make_pair(SGV, DGV));
+      ValueMap.insert(std::make_pair(SGV, DGV));
     }
   }
   return false;
@@ -262,7 +266,7 @@
                      SM->getName() + "\" - Method is already defined!");
 
       // Otherwise, just remember this mapping...
-      ValueMap.insert(make_pair(SM, DM));
+      ValueMap.insert(std::make_pair(SM, DM));
     } else {
       // Method does not already exist, simply insert an external method
       // signature identical to SM into the dest module...
@@ -273,7 +277,7 @@
       Dest->getMethodList().push_back(DM);
 
       // ... and remember this mapping...
-      ValueMap.insert(make_pair(SM, DM));
+      ValueMap.insert(std::make_pair(SM, DM));
     }
   }
   return false;
@@ -300,7 +304,7 @@
     Dest->getArgumentList().push_back(DMA);
 
     // Add a mapping to our local map
-    LocalMap.insert(make_pair(SMA, DMA));
+    LocalMap.insert(std::make_pair(SMA, DMA));
   }
 
   // Loop over all of the basic blocks, copying the instructions over...
@@ -310,7 +314,7 @@
 
     // Create new basic block and add to mapping and the Dest method...
     BasicBlock *DBB = new BasicBlock(SBB->getName(), Dest);
-    LocalMap.insert(make_pair(SBB, DBB));
+    LocalMap.insert(std::make_pair(SBB, DBB));
 
     // Loop over all of the instructions in the src basic block, copying them
     // over.  Note that this is broken in a strict sense because the cloned
@@ -324,7 +328,7 @@
       Instruction *DI = SI->clone();
       DI->setName(SI->getName());
       DBB->getInstList().push_back(DI);
-      LocalMap.insert(make_pair(SI, DI));
+      LocalMap.insert(std::make_pair(SI, DI));
     }
   }
 
diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp
index 666b6d9..ca1085e 100644
--- a/lib/Transforms/Utils/LowerAllocations.cpp
+++ b/lib/Transforms/Utils/LowerAllocations.cpp
@@ -14,6 +14,8 @@
 #include "llvm/iOther.h"
 #include "llvm/SymbolTable.h"
 #include "llvm/ConstantVals.h"
+using std::vector;
+
 
 // doPassInitialization - For the lower allocations pass, this ensures that a
 // module contains a declaration for a malloc and a free function.
diff --git a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
index efc7676..56c4b20 100644
--- a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
+++ b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
@@ -11,6 +11,7 @@
 #include "llvm/iTerminators.h"
 #include "llvm/iPHINode.h"
 #include "llvm/Type.h"
+using std::vector;
 
 // UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new
 // BasicBlock, and converting all returns to unconditional branches to this