[llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReadConst.cpp ReadInst.cpp Reader.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Mar 6 10:34:01 PST 2003


Changes in directory llvm/lib/Bytecode/Reader:

ReadConst.cpp updated: 1.40 -> 1.41
ReadInst.cpp updated: 1.39 -> 1.40
Reader.cpp updated: 1.41 -> 1.42

---
Log message:

Use the std namespace explicitly


---
Diffs of the changes:

Index: llvm/lib/Bytecode/Reader/ReadConst.cpp
diff -u llvm/lib/Bytecode/Reader/ReadConst.cpp:1.40 llvm/lib/Bytecode/Reader/ReadConst.cpp:1.41
--- llvm/lib/Bytecode/Reader/ReadConst.cpp:1.40	Sun Oct 13 22:33:02 2002
+++ llvm/lib/Bytecode/Reader/ReadConst.cpp	Thu Mar  6 10:32:25 2003
@@ -13,8 +13,6 @@
 #include "llvm/Constants.h"
 #include <algorithm>
 
-using std::make_pair;
-
 const Type *BytecodeParser::parseTypeConstant(const uchar *&Buf,
 					      const uchar *EndBuf) {
   unsigned PrimType;
@@ -336,7 +334,7 @@
         if (!(GV = dyn_cast<GlobalValue>(Val))) return true;
         BCR_TRACE(5, "Value Found in ValueTable!\n");
       } else {         // Nope... find or create a forward ref. for it
-        GlobalRefsType::iterator I = GlobalRefs.find(make_pair(PT, Slot));
+        GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PT, Slot));
 
         if (I != GlobalRefs.end()) {
           BCR_TRACE(5, "Previous forward ref found!\n");
@@ -349,7 +347,7 @@
             new GlobalVariable(PT->getElementType(), false, true);
           
 	  // Keep track of the fact that we have a forward ref to recycle it
-          GlobalRefs.insert(make_pair(make_pair(PT, Slot), GVar));
+          GlobalRefs.insert(std::make_pair(std::make_pair(PT, Slot), GVar));
           
           // Must temporarily push this value into the module table...
           TheModule->getGlobalList().push_back(GVar);


Index: llvm/lib/Bytecode/Reader/ReadInst.cpp
diff -u llvm/lib/Bytecode/Reader/ReadInst.cpp:1.39 llvm/lib/Bytecode/Reader/ReadInst.cpp:1.40
--- llvm/lib/Bytecode/Reader/ReadInst.cpp:1.39	Sun Oct 13 14:39:10 2002
+++ llvm/lib/Bytecode/Reader/ReadInst.cpp	Thu Mar  6 10:32:25 2003
@@ -16,8 +16,6 @@
 #include "llvm/iMemory.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
-using std::vector;
-using std::cerr;
 
 bool BytecodeParser::ParseRawInst(const uchar *&Buf, const uchar *EndBuf, 
 				  RawInst &Result) {
@@ -78,7 +76,7 @@
 
     switch (Result.NumOperands) {
     case 0: 
-      cerr << "Zero Arg instr found!\n"; 
+      std::cerr << "Zero Arg instr found!\n"; 
       return true;  // This encoding is invalid!
     case 1: 
       if (read_vbr(Buf, EndBuf, Result.Arg1)) return true;
@@ -97,7 +95,7 @@
 	  read_vbr(Buf, EndBuf, Result.Arg2)) return true;
 
       // Allocate a vector to hold arguments 3, 4, 5, 6 ...
-      Result.VarArgs = new vector<unsigned>(Result.NumOperands-2);
+      Result.VarArgs = new std::vector<unsigned>(Result.NumOperands-2);
       for (unsigned a = 0; a < Result.NumOperands-2; a++)
 	if (read_vbr(Buf, EndBuf, (*Result.VarArgs)[a])) return true;
       break;
@@ -107,9 +105,9 @@
   }
 
 #if 0
-  cerr << "NO: "  << Result.NumOperands   << " opcode: " << Result.Opcode 
-       << " Ty: " << Result.Ty->getDescription() << " arg1: "   << Result.Arg1 
-       << " arg2: "   << Result.Arg2 << " arg3: "   << Result.Arg3 << "\n";
+  std::cerr << "NO: "  << Result.NumOperands   << " opcode: " << Result.Opcode 
+            << " Ty: " << Result.Ty->getDescription() << " arg1: "<< Result.Arg1
+            << " arg2: "   << Result.Arg2 << " arg3: "   << Result.Arg3 << "\n";
 #endif
   return false;
 }
@@ -135,7 +133,7 @@
   case Instruction::Cast: {
     V = getValue(Raw.Ty, Raw.Arg1);
     const Type *Ty = getType(Raw.Arg2);
-    if (V == 0 || Ty == 0) { cerr << "Invalid cast!\n"; return true; }
+    if (V == 0 || Ty == 0) { std::cerr << "Invalid cast!\n"; return true; }
     Res = new CastInst(V, Ty);
     return false;
   }
@@ -144,7 +142,7 @@
     switch (Raw.NumOperands) {
     case 0: 
     case 1: 
-    case 3: cerr << "Invalid phi node encountered!\n"; 
+    case 3: std::cerr << "Invalid phi node encountered!\n"; 
             delete PN; 
 	    return true;
     case 2: PN->addIncoming(getValue(Raw.Ty, Raw.Arg1),
@@ -154,11 +152,11 @@
       PN->addIncoming(getValue(Raw.Ty, Raw.Arg1), 
 		      cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg2)));
       if (Raw.VarArgs->size() & 1) {
-	cerr << "PHI Node with ODD number of arguments!\n";
+	std::cerr << "PHI Node with ODD number of arguments!\n";
 	delete PN;
 	return true;
       } else {
-        vector<unsigned> &args = *Raw.VarArgs;
+        std::vector<unsigned> &args = *Raw.VarArgs;
         for (unsigned i = 0; i < args.size(); i+=2)
           PN->addIncoming(getValue(Raw.Ty, args[i]),
 			  cast<BasicBlock>(getValue(Type::LabelTy, args[i+1])));
@@ -204,12 +202,12 @@
     if (Raw.NumOperands < 3) return false;  // No destinations?  Wierd.
 
     if (Raw.NumOperands == 3 || Raw.VarArgs->size() & 1) {
-      cerr << "Switch statement with odd number of arguments!\n";
+      std::cerr << "Switch statement with odd number of arguments!\n";
       delete I;
       return true;
     }      
     
-    vector<unsigned> &args = *Raw.VarArgs;
+    std::vector<unsigned> &args = *Raw.VarArgs;
     for (unsigned i = 0; i < args.size(); i += 2)
       I->dest_push_back(cast<Constant>(getValue(Raw.Ty, args[i])),
                         cast<BasicBlock>(getValue(Type::LabelTy, args[i+1])));
@@ -228,14 +226,14 @@
     const FunctionType *MTy = dyn_cast<FunctionType>(PTy->getElementType());
     if (MTy == 0) return true;
 
-    vector<Value *> Params;
+    std::vector<Value *> Params;
     const FunctionType::ParamTypes &PL = MTy->getParamTypes();
 
     if (!MTy->isVarArg()) {
       FunctionType::ParamTypes::const_iterator It = PL.begin();
 
       switch (Raw.NumOperands) {
-      case 0: cerr << "Invalid call instruction encountered!\n";
+      case 0: std::cerr << "Invalid call instruction encountered!\n";
 	return true;
       case 1: break;
       case 2: Params.push_back(getValue(*It++, Raw.Arg2)); break;
@@ -245,7 +243,7 @@
       default:
 	Params.push_back(getValue(*It++, Raw.Arg2));
 	{
-	  vector<unsigned> &args = *Raw.VarArgs;
+	  std::vector<unsigned> &args = *Raw.VarArgs;
 	  for (unsigned i = 0; i < args.size(); i++) {
 	    if (It == PL.end()) return true;
 	    // TODO: Check getValue for null!
@@ -257,7 +255,7 @@
       if (It != PL.end()) return true;
     } else {
       if (Raw.NumOperands > 2) {
-	vector<unsigned> &args = *Raw.VarArgs;
+	std::vector<unsigned> &args = *Raw.VarArgs;
 	if (args.size() < 1) return true;
 
 	if ((args.size() & 1) != 0)
@@ -288,9 +286,9 @@
     const FunctionType *MTy = dyn_cast<FunctionType>(PTy->getElementType());
     if (MTy == 0) return true;
 
-    vector<Value *> Params;
+    std::vector<Value *> Params;
     const FunctionType::ParamTypes &PL = MTy->getParamTypes();
-    vector<unsigned> &args = *Raw.VarArgs;
+    std::vector<unsigned> &args = *Raw.VarArgs;
 
     BasicBlock *Normal, *Except;
 
@@ -352,12 +350,12 @@
 
   case Instruction::Load:
   case Instruction::GetElementPtr: {
-    vector<Value*> Idx;
+    std::vector<Value*> Idx;
     if (!isa<PointerType>(Raw.Ty)) return true;
     const CompositeType *TopTy = dyn_cast<CompositeType>(Raw.Ty);
 
     switch (Raw.NumOperands) {
-    case 0: cerr << "Invalid load encountered!\n"; return true;
+    case 0: std::cerr << "Invalid load encountered!\n"; return true;
     case 1: break;
     case 2:
       if (!TopTy) return true;
@@ -382,7 +380,7 @@
       Idx.push_back(V = getValue(TopTy->getIndexType(), Raw.Arg2));
       if (!V) return true;
 
-      vector<unsigned> &args = *Raw.VarArgs;
+      std::vector<unsigned> &args = *Raw.VarArgs;
       for (unsigned i = 0, E = args.size(); i != E; ++i) {
         const Type *ETy = GetElementPtrInst::getIndexedType(Raw.Ty, Idx, true);
         const CompositeType *ElTy = dyn_cast_or_null<CompositeType>(ETy);
@@ -397,8 +395,8 @@
     if (Raw.Opcode == Instruction::Load) {
       Value *Src = getValue(Raw.Ty, Raw.Arg1);
       if (!Idx.empty()) {
-        cerr << "WARNING: Bytecode contains load instruction with indices.  "
-             << "Replacing with getelementptr/load pair\n";
+        std::cerr << "WARNING: Bytecode contains load instruction with indices."
+                  << "  Replacing with getelementptr/load pair\n";
         assert(GetElementPtrInst::getIndexedType(Raw.Ty, Idx) && 
                "Bad indices for Load!");
         Src = new GetElementPtrInst(Src, Idx);
@@ -414,13 +412,13 @@
     return false;
   }
   case Instruction::Store: {
-    vector<Value*> Idx;
+    std::vector<Value*> Idx;
     if (!isa<PointerType>(Raw.Ty)) return true;
     const CompositeType *TopTy = dyn_cast<CompositeType>(Raw.Ty);
 
     switch (Raw.NumOperands) {
     case 0: 
-    case 1: cerr << "Invalid store encountered!\n"; return true;
+    case 1: std::cerr << "Invalid store encountered!\n"; return true;
     case 2: break;
     case 3:
       if (!TopTy) return true;
@@ -428,7 +426,7 @@
       if (!V) return true;
       break;
     default:
-      vector<unsigned> &args = *Raw.VarArgs;
+      std::vector<unsigned> &args = *Raw.VarArgs;
       const CompositeType *ElTy = TopTy;
       unsigned i, E;
       for (i = 0, E = args.size(); ElTy && i != E; ++i) {
@@ -447,8 +445,8 @@
 
     Value *Ptr = getValue(Raw.Ty, Raw.Arg2);
     if (!Idx.empty()) {
-      cerr << "WARNING: Bytecode contains load instruction with indices.  "
-           << "Replacing with getelementptr/load pair\n";
+      std::cerr << "WARNING: Bytecode contains load instruction with indices.  "
+                << "Replacing with getelementptr/load pair\n";
 
       const Type *ElType = GetElementPtrInst::getIndexedType(Raw.Ty, Idx);
       if (ElType == 0) return true;
@@ -465,7 +463,7 @@
   }
   }  // end switch(Raw.Opcode) 
 
-  cerr << "Unrecognized instruction! " << Raw.Opcode 
-       << " ADDR = 0x" << (void*)Buf << "\n";
+  std::cerr << "Unrecognized instruction! " << Raw.Opcode 
+            << " ADDR = 0x" << (void*)Buf << "\n";
   return true;
 }


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.41 llvm/lib/Bytecode/Reader/Reader.cpp:1.42
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.41	Wed Nov 20 12:31:59 2002
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Thu Mar  6 10:32:25 2003
@@ -23,9 +23,6 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <algorithm>
-using std::cerr;
-using std::pair;
-using std::make_pair;
 
 bool BytecodeParser::getTypeSlot(const Type *Ty, unsigned &Slot) {
   if (Ty->isPrimitiveType()) {
@@ -115,8 +112,8 @@
   Value *d = 0;
   switch (Ty->getPrimitiveID()) {
   case Type::FunctionTyID:
-    cerr << "Creating method pholder! : " << type << ":" << oNum << " " 
-	 << Ty->getName() << "\n";
+    std::cerr << "Creating method pholder! : " << type << ":" << oNum << " " 
+              << Ty->getName() << "\n";
     d = new FunctionPHolder(Ty, oNum);
     if (insertValue(d, LateResolveModuleValues) == -1) return 0;
     return d;
@@ -143,7 +140,7 @@
   if (Value *V = getValue(Ty, Slot, false))
     return dyn_cast<Constant>(V);      // If we already have the value parsed...
 
-  GlobalRefsType::iterator I = GlobalRefs.find(make_pair(Ty, Slot));
+  GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(Ty, Slot));
   if (I != GlobalRefs.end()) {
     BCR_TRACE(5, "Previous forward ref found!\n");
     return cast<Constant>(I->second);
@@ -154,7 +151,7 @@
     Constant *C = new ConstPHolder(Ty, Slot);
     
     // Keep track of the fact that we have a forward ref to recycle it
-    GlobalRefs.insert(make_pair(make_pair(Ty, Slot), C));
+    GlobalRefs.insert(std::make_pair(std::make_pair(Ty, Slot), C));
     return C;
   }
 }
@@ -175,8 +172,8 @@
       Value *NewDef = getValue(D->getType(), IDNumber, false);
       if (NewDef == 0) {
 	Error = true;  // Unresolved thinger
-	cerr << "Unresolvable reference found: <"
-	      << D->getType()->getDescription() << ">:" << IDNumber << "!\n";
+	std::cerr << "Unresolvable reference found: <"
+                  << D->getType()->getDescription() << ">:" << IDNumber <<"!\n";
       } else {
 	// Fixup all of the uses of this placeholder def...
         D->replaceAllUsesWith(NewDef);
@@ -241,7 +238,7 @@
 	return true;
       }
       BCR_TRACE(4, "Map: '" << Name << "' to #" << slot << ":" << D;
-		if (!isa<Instruction>(D)) cerr << "\n");
+		if (!isa<Instruction>(D)) std::cerr << "\n");
 
       D->setName(Name, ST);
     }
@@ -252,7 +249,8 @@
 }
 
 void BytecodeParser::ResolveReferencesToValue(Value *NewV, unsigned Slot) {
-  GlobalRefsType::iterator I = GlobalRefs.find(make_pair(NewV->getType(),Slot));
+  GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(NewV->getType(),
+                                                              Slot));
   if (I == GlobalRefs.end()) return;   // Never forward referenced?
 
   BCR_TRACE(3, "Mutating forward refs!\n");
@@ -476,7 +474,7 @@
     // methods are loaded...
     //
     FunctionSignatureList.push_back(
-           make_pair(cast<const PointerType>(Val->getType()), SlotNo));
+           std::make_pair(cast<const PointerType>(Val->getType()), SlotNo));
     if (read_vbr(Buf, End, FnSignature)) return true;
     BCR_TRACE(2, "Function of type: " << Ty << "\n");
   }





More information about the llvm-commits mailing list