diff options
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 16 | ||||
-rw-r--r-- | lib/VMCore/BasicBlock.cpp | 4 | ||||
-rw-r--r-- | lib/VMCore/Constants.cpp | 53 | ||||
-rw-r--r-- | lib/VMCore/Dominators.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Function.cpp | 8 | ||||
-rw-r--r-- | lib/VMCore/InstrTypes.cpp | 6 | ||||
-rw-r--r-- | lib/VMCore/Instruction.cpp | 6 | ||||
-rw-r--r-- | lib/VMCore/Linker.cpp | 32 | ||||
-rw-r--r-- | lib/VMCore/Module.cpp | 6 | ||||
-rw-r--r-- | lib/VMCore/SlotCalculator.cpp | 5 | ||||
-rw-r--r-- | lib/VMCore/SymbolTable.cpp | 15 | ||||
-rw-r--r-- | lib/VMCore/Type.cpp | 8 | ||||
-rw-r--r-- | lib/VMCore/Value.cpp | 8 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 3 | ||||
-rw-r--r-- | lib/VMCore/iBranch.cpp | 3 | ||||
-rw-r--r-- | lib/VMCore/iCall.cpp | 9 | ||||
-rw-r--r-- | lib/VMCore/iMemory.cpp | 18 | ||||
-rw-r--r-- | lib/VMCore/iOperators.cpp | 16 |
18 files changed, 131 insertions, 87 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 2b3a1c4c22..c218c0fcd0 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -26,6 +26,10 @@ #include "Support/STLExtras.h" #include <algorithm> #include <map> +using std::string; +using std::map; +using std::vector; +using std::ostream; static const Module *getModuleFromVal(const Value *V) { if (const MethodArgument *MA =dyn_cast<const MethodArgument>(V)) @@ -112,7 +116,7 @@ static void fillTypeNameTable(const Module *M, const Type *Ty = cast<const Type>(I->second); if (!isa<PointerType>(Ty) || !cast<PointerType>(Ty)->getElementType()->isPrimitiveType()) - TypeNames.insert(make_pair(Ty, "%"+I->first)); + TypeNames.insert(std::make_pair(Ty, "%"+I->first)); } } } @@ -215,7 +219,7 @@ static ostream &printTypeInt(ostream &Out, const Type *Ty, // vector<const Type *> TypeStack; string TypeName = calcTypeName(Ty, TypeStack, TypeNames); - TypeNames.insert(make_pair(Ty, TypeName)); // Cache type name for later use + TypeNames.insert(std::make_pair(Ty, TypeName));//Cache type name for later use return Out << TypeName; } @@ -331,7 +335,7 @@ void AssemblyWriter::printGlobal(const GlobalVariable *GV) { writeOperand(GV->getInitializer(), false, false); printInfoComment(GV); - Out << endl; + Out << "\n"; } @@ -348,7 +352,7 @@ void AssemblyWriter::printSymbolTable(const SymbolTable &ST) { if (const Constant *CPV = dyn_cast<const Constant>(V)) { printConstant(CPV); } else if (const Type *Ty = dyn_cast<const Type>(V)) { - Out << "\t%" << I->first << " = type " << Ty->getDescription() << endl; + Out << "\t%" << I->first << " = type " << Ty->getDescription() << "\n"; } } } @@ -378,7 +382,7 @@ void AssemblyWriter::printConstant(const Constant *CPV) { else Out << "<badref>"; } - Out << endl; + Out << "\n"; } // printMethod - Print all aspects of a method. @@ -614,7 +618,7 @@ void AssemblyWriter::printInstruction(const Instruction *I) { } printInfoComment(I); - Out << endl; + Out << "\n"; } diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index 861aea43c2..df999b84bf 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -18,7 +18,7 @@ // template class ValueHolder<Instruction, BasicBlock, Method>; -BasicBlock::BasicBlock(const string &name, Method *Parent) +BasicBlock::BasicBlock(const std::string &name, Method *Parent) : Value(Type::LabelTy, Value::BasicBlockVal, name), InstList(this, 0), machineInstrVec(new MachineCodeForBasicBlock) { if (Parent) @@ -32,7 +32,7 @@ BasicBlock::~BasicBlock() { } // Specialize setName to take care of symbol table majik -void BasicBlock::setName(const string &name, SymbolTable *ST) { +void BasicBlock::setName(const std::string &name, SymbolTable *ST) { Method *P; assert((ST == 0 || (!getParent() || ST == getParent()->getSymbolTable())) && "Invalid symtab argument!"); diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 257bd7622c..d9a2fa7431 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -15,6 +15,10 @@ #include <algorithm> #include <assert.h> +using std::map; +using std::pair; +using std::make_pair; + ConstantBool *ConstantBool::True = new ConstantBool(true); ConstantBool *ConstantBool::False = new ConstantBool(false); @@ -24,7 +28,7 @@ ConstantBool *ConstantBool::False = new ConstantBool(false); //===----------------------------------------------------------------------===// // Specialize setName to take care of symbol table majik -void Constant::setName(const string &Name, SymbolTable *ST) { +void Constant::setName(const std::string &Name, SymbolTable *ST) { assert(ST && "Type::setName - Must provide symbol table argument!"); if (Name.size()) ST->insert(Name, this); @@ -56,6 +60,7 @@ Constant *Constant::getNullConstant(const Type *Ty) { #ifndef NDEBUG #include "llvm/Assembly/Writer.h" +using std::cerr; #endif void Constant::destroyConstantImpl() { @@ -70,8 +75,8 @@ void Constant::destroyConstantImpl() { Value *V = use_back(); #ifndef NDEBUG // Only in -g mode... if (!isa<Constant>(V)) { - cerr << "While deleting: " << this << endl; - cerr << "Use still stuck around after Def is destroyed: " << V << endl; + cerr << "While deleting: " << this << "\n"; + cerr << "Use still stuck around after Def is destroyed: " << V << "\n"; } #endif assert(isa<Constant>(V) && "References remain to ConstantPointerRef!"); @@ -115,7 +120,7 @@ ConstantFP::ConstantFP(const Type *Ty, double V) : Constant(Ty) { } ConstantArray::ConstantArray(const ArrayType *T, - const vector<Constant*> &V) : Constant(T) { + const std::vector<Constant*> &V) : Constant(T) { for (unsigned i = 0; i < V.size(); i++) { assert(V[i]->getType() == T->getElementType()); Operands.push_back(Use(V[i], this)); @@ -123,7 +128,7 @@ ConstantArray::ConstantArray(const ArrayType *T, } ConstantStruct::ConstantStruct(const StructType *T, - const vector<Constant*> &V) : Constant(T) { + const std::vector<Constant*> &V) : Constant(T) { const StructType::ElementTypes &ETypes = T->getElementTypes(); for (unsigned i = 0; i < V.size(); i++) { @@ -142,24 +147,24 @@ ConstantPointerRef::ConstantPointerRef(GlobalValue *GV) //===----------------------------------------------------------------------===// // getStrValue implementations -string ConstantBool::getStrValue() const { +std::string ConstantBool::getStrValue() const { return Val ? "true" : "false"; } -string ConstantSInt::getStrValue() const { +std::string ConstantSInt::getStrValue() const { return itostr(Val.Signed); } -string ConstantUInt::getStrValue() const { +std::string ConstantUInt::getStrValue() const { return utostr(Val.Unsigned); } -string ConstantFP::getStrValue() const { +std::string ConstantFP::getStrValue() const { return ftostr(Val); } -string ConstantArray::getStrValue() const { - string Result; +std::string ConstantArray::getStrValue() const { + std::string Result; // As a special case, print the array as a string if it is an array of // ubytes or an array of sbytes with positive values. @@ -208,8 +213,8 @@ string ConstantArray::getStrValue() const { return Result; } -string ConstantStruct::getStrValue() const { - string Result = "{"; +std::string ConstantStruct::getStrValue() const { + std::string Result = "{"; if (Operands.size()) { Result += " " + Operands[0]->getType()->getDescription() + " " + cast<Constant>(Operands[0])->getStrValue(); @@ -221,11 +226,11 @@ string ConstantStruct::getStrValue() const { return Result + " }"; } -string ConstantPointerNull::getStrValue() const { +std::string ConstantPointerNull::getStrValue() const { return "null"; } -string ConstantPointerRef::getStrValue() const { +std::string ConstantPointerRef::getStrValue() const { const GlobalValue *V = getValue(); if (V->hasName()) return "%" + V->getName(); @@ -233,7 +238,7 @@ string ConstantPointerRef::getStrValue() const { int Slot = Table->getValSlot(V); delete Table; - if (Slot >= 0) return string(" %") + itostr(Slot); + if (Slot >= 0) return std::string(" %") + itostr(Slot); else return "<pointer reference badref>"; } @@ -337,7 +342,7 @@ unsigned ConstantFP::hash(const Type *Ty, double V) { } unsigned ConstantArray::hash(const ArrayType *Ty, - const vector<Constant*> &V) { + const std::vector<Constant*> &V) { unsigned Result = (Ty->getUniqueID() << 5) ^ (Ty->getUniqueID() * 7); for (unsigned i = 0; i < V.size(); ++i) Result ^= V[i]->getHash() << (i & 7); @@ -345,7 +350,7 @@ unsigned ConstantArray::hash(const ArrayType *Ty, } unsigned ConstantStruct::hash(const StructType *Ty, - const vector<Constant*> &V) { + const std::vector<Constant*> &V) { unsigned Result = (Ty->getUniqueID() << 5) ^ (Ty->getUniqueID() * 7); for (unsigned i = 0; i < V.size(); ++i) Result ^= V[i]->getHash() << (i & 7); @@ -418,10 +423,10 @@ ConstantFP *ConstantFP::get(const Type *Ty, double V) { //---- ConstantArray::get() implementation... // -static ValueMap<vector<Constant*>, ConstantArray> ArrayConstants; +static ValueMap<std::vector<Constant*>, ConstantArray> ArrayConstants; ConstantArray *ConstantArray::get(const ArrayType *Ty, - const vector<Constant*> &V) { + const std::vector<Constant*> &V) { ConstantArray *Result = ArrayConstants.get(Ty, V); if (!Result) // If no preexisting value, create one now... ArrayConstants.add(Ty, V, Result = new ConstantArray(Ty, V)); @@ -432,8 +437,8 @@ ConstantArray *ConstantArray::get(const ArrayType *Ty, // contain the specified string. A null terminator is added to the specified // string so that it may be used in a natural way... // -ConstantArray *ConstantArray::get(const string &Str) { - vector<Constant*> ElementVals; +ConstantArray *ConstantArray::get(const std::string &Str) { + std::vector<Constant*> ElementVals; for (unsigned i = 0; i < Str.length(); ++i) ElementVals.push_back(ConstantSInt::get(Type::SByteTy, Str[i])); @@ -455,10 +460,10 @@ void ConstantArray::destroyConstant() { //---- ConstantStruct::get() implementation... // -static ValueMap<vector<Constant*>, ConstantStruct> StructConstants; +static ValueMap<std::vector<Constant*>, ConstantStruct> StructConstants; ConstantStruct *ConstantStruct::get(const StructType *Ty, - const vector<Constant*> &V) { + const std::vector<Constant*> &V) { ConstantStruct *Result = StructConstants.get(Ty, V); if (!Result) // If no preexisting value, create one now... StructConstants.add(Ty, V, Result = new ConstantStruct(Ty, V)); diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index 2ed02dbed2..2e4f6e4df1 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -10,6 +10,8 @@ #include "Support/DepthFirstIterator.h" #include "Support/STLExtras.h" #include <algorithm> +using std::set; + //===----------------------------------------------------------------------===// // Helper Template diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 4b38ce1196..e7d10c1496 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -25,7 +25,7 @@ template class ValueHolder<MethodArgument, Method, Method>; template class ValueHolder<BasicBlock , Method, Method>; -Method::Method(const MethodType *Ty, bool isInternal, const string &name) +Method::Method(const MethodType *Ty, bool isInternal, const std::string &name) : GlobalValue(PointerType::get(Ty), Value::MethodVal, isInternal, name), SymTabValue(this), BasicBlocks(this), ArgumentList(this, this) { assert(::isa<MethodType>(Ty) && "Method signature must be of method type!"); @@ -45,7 +45,7 @@ Method::~Method() { } // Specialize setName to take care of symbol table majik -void Method::setName(const string &name, SymbolTable *ST) { +void Method::setName(const std::string &name, SymbolTable *ST) { Module *P; assert((ST == 0 || (!getParent() || ST == getParent()->getSymbolTable())) && "Invalid symtab argument!"); @@ -87,14 +87,14 @@ void Method::dropAllReferences() { GlobalVariable::GlobalVariable(const Type *Ty, bool constant, bool isIntern, Constant *Initializer = 0, - const string &Name = "") + const std::string &Name = "") : GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, isIntern, Name), isConstantGlobal(constant) { if (Initializer) Operands.push_back(Use((Value*)Initializer, this)); } // Specialize setName to take care of symbol table majik -void GlobalVariable::setName(const string &name, SymbolTable *ST) { +void GlobalVariable::setName(const std::string &name, SymbolTable *ST) { Module *P; assert((ST == 0 || (!getParent() || ST == getParent()->getSymbolTable())) && "Invalid symtab argument!"); diff --git a/lib/VMCore/InstrTypes.cpp b/lib/VMCore/InstrTypes.cpp index 69a703c0c7..a4c8212632 100644 --- a/lib/VMCore/InstrTypes.cpp +++ b/lib/VMCore/InstrTypes.cpp @@ -21,7 +21,7 @@ TerminatorInst::TerminatorInst(Instruction::TermOps iType) } TerminatorInst::TerminatorInst(const Type *Ty, Instruction::TermOps iType, - const string &Name = "") + const std::string &Name = "") : Instruction(Ty, iType, Name) { } @@ -31,7 +31,7 @@ TerminatorInst::TerminatorInst(const Type *Ty, Instruction::TermOps iType, //===----------------------------------------------------------------------===// // Specialize setName to take care of symbol table majik -void MethodArgument::setName(const string &name, SymbolTable *ST) { +void MethodArgument::setName(const std::string &name, SymbolTable *ST) { Method *P; assert((ST == 0 || (!getParent() || ST == getParent()->getSymbolTable())) && "Invalid symtab argument!"); @@ -45,7 +45,7 @@ void MethodArgument::setName(const string &name, SymbolTable *ST) { // PHINode Class //===----------------------------------------------------------------------===// -PHINode::PHINode(const Type *Ty, const string &name) +PHINode::PHINode(const Type *Ty, const std::string &name) : Instruction(Ty, Instruction::PHINode, name) { } diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index 8b37510d35..186c85007e 100644 --- a/lib/VMCore/Instruction.cpp +++ b/lib/VMCore/Instruction.cpp @@ -10,7 +10,7 @@ #include "llvm/SymbolTable.h" #include "llvm/CodeGen/MachineInstr.h" -Instruction::Instruction(const Type *ty, unsigned it, const string &Name) +Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name) : User(ty, Value::InstructionVal, Name), machineInstrVec(new MachineCodeForVMInstr) { Parent = 0; @@ -23,7 +23,7 @@ Instruction::~Instruction() { } // Specialize setName to take care of symbol table majik -void Instruction::setName(const string &name, SymbolTable *ST) { +void Instruction::setName(const std::string &name, SymbolTable *ST) { BasicBlock *P = 0; Method *PP = 0; assert((ST == 0 || !getParent() || !getParent()->getParent() || ST == getParent()->getParent()->getSymbolTable()) && @@ -44,7 +44,7 @@ void Instruction::addMachineInstruction(MachineInstr* minstr) { // sequence of forward declarations. Trying to fix that will // cause a serious circularity in link order. // -const vector<Value*> &Instruction::getTempValuesForMachineCode() const { +const std::vector<Value*> &Instruction::getTempValuesForMachineCode() const { return machineInstrVec->getTempValues(); } #endif diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp index f04c8a46a3..e1622529c2 100644 --- a/lib/VMCore/Linker.cpp +++ b/lib/VMCore/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 @@ static void PrintMap(const map<const Value*, Value*> &M) { 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 @@ static Value *RemapOperand(const Value *In, map<const Value*, Value*> &LocalMap, 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 @@ static Value *RemapOperand(const Value *In, map<const Value*, Value*> &LocalMap, } // 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 @@ static Value *RemapOperand(const Value *In, map<const Value*, Value*> &LocalMap, 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 @@ static bool LinkGlobals(Module *Dest, const Module *Src, " - 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 @@ static bool LinkGlobals(Module *Dest, const Module *Src, 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 @@ static bool LinkMethodProtos(Module *Dest, const Module *Src, 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 @@ static bool LinkMethodProtos(Module *Dest, const Module *Src, 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 @@ static bool LinkMethodBody(Method *Dest, const Method *Src, 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 @@ static bool LinkMethodBody(Method *Dest, const Method *Src, // 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 @@ static bool LinkMethodBody(Method *Dest, const Method *Src, 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/VMCore/Module.cpp b/lib/VMCore/Module.cpp index a42535580b..606d3aef14 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -24,7 +24,7 @@ template class ValueHolder<Method, Module, Module>; // Define the GlobalValueRefMap as a struct that wraps a map so that we don't // have Module.h depend on <map> // -struct GlobalValueRefMap : public map<GlobalValue*, ConstantPointerRef*>{ +struct GlobalValueRefMap : public std::map<GlobalValue*, ConstantPointerRef*>{ }; @@ -97,7 +97,7 @@ ConstantPointerRef *Module::getConstantPointerRef(GlobalValue *V){ if (I != GVRefMap->end()) return I->second; ConstantPointerRef *Ref = new ConstantPointerRef(V); - GVRefMap->insert(make_pair(V, Ref)); + GVRefMap->insert(std::make_pair(V, Ref)); return Ref; } @@ -112,5 +112,5 @@ void Module::mutateConstantPointerRef(GlobalValue *OldGV, GlobalValue *NewGV) { GVRefMap->erase(I); // Insert the new entry... - GVRefMap->insert(make_pair(NewGV, Ref)); + GVRefMap->insert(std::make_pair(NewGV, Ref)); } diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp index ede822846d..4738f712a1 100644 --- a/lib/VMCore/SlotCalculator.cpp +++ b/lib/VMCore/SlotCalculator.cpp @@ -196,7 +196,8 @@ void SlotCalculator::purgeMethod() { while (CurPlane.size() != ModuleSize) { //SC_DEBUG(" Removing [" << i << "] Value=" << CurPlane.back() << "\n"); - map<const Value *, unsigned>::iterator NI = NodeMap.find(CurPlane.back()); + std::map<const Value *, unsigned>::iterator NI = + NodeMap.find(CurPlane.back()); assert(NI != NodeMap.end() && "Node not in nodemap?"); NodeMap.erase(NI); // Erase from nodemap CurPlane.pop_back(); // Shrink plane @@ -223,7 +224,7 @@ void SlotCalculator::purgeMethod() { } int SlotCalculator::getValSlot(const Value *D) const { - map<const Value*, unsigned>::const_iterator I = NodeMap.find(D); + std::map<const Value*, unsigned>::const_iterator I = NodeMap.find(D); if (I == NodeMap.end()) return -1; return (int)I->second; diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp index dd6329fc97..ab98a73184 100644 --- a/lib/VMCore/SymbolTable.cpp +++ b/lib/VMCore/SymbolTable.cpp @@ -10,6 +10,14 @@ #include "llvm/Module.h" #include "llvm/Method.h" #include "Support/StringExtras.h" +#include <iostream> + +using std::string; +using std::pair; +using std::make_pair; +using std::map; +using std::cerr; +using std::cout; #define DEBUG_SYMBOL_TABLE 0 #define DEBUG_ABSTYPE 0 @@ -35,7 +43,8 @@ SymbolTable::~SymbolTable() { for (type_iterator I = i->second.begin(); I != i->second.end(); ++I) if (!isa<Constant>(I->second) && !isa<Type>(I->second)) { cerr << "Value still in symbol table! Type = '" - << i->first->getDescription() << "' Name = '" << I->first << "'\n"; + << i->first->getDescription() << "' Name = '" + << I->first << "'\n"; LeftoverValues = false; } } @@ -305,11 +314,11 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType, #include <algorithm> static void DumpVal(const pair<const string, Value *> &V) { - cout << " '" << V.first << "' = " << V.second << endl; + cout << " '" << V.first << "' = " << V.second << "\n"; } static void DumpPlane(const pair<const Type *, map<const string, Value *> >&P) { - cout << " Plane: " << P.first << endl; + cout << " Plane: " << P.first << "\n"; for_each(P.second.begin(), P.second.end(), DumpVal); } diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index cbcdf3f37d..316f97d439 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -8,6 +8,14 @@ #include "llvm/SymbolTable.h" #include "Support/StringExtras.h" #include "Support/STLExtras.h" +#include <iostream> + +using std::vector; +using std::string; +using std::map; +using std::swap; +using std::make_pair; +using std::cerr; // DEBUG_MERGE_TYPES - Enable this #define to see how and when derived types are // created and later destroyed, all in an effort to make sure that there is only diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index 0ac7205104..af9d2e4f62 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -11,6 +11,8 @@ #include "llvm/Type.h" #ifndef NDEBUG // Only in -g mode... #include "llvm/Assembly/Writer.h" +#include <iostream> +using std::cerr; #endif #include <algorithm> @@ -23,7 +25,7 @@ static inline const Type *checkType(const Type *Ty) { return Ty; } -Value::Value(const Type *ty, ValueTy vty, const string &name = "") +Value::Value(const Type *ty, ValueTy vty, const std::string &name = "") : Name(name), Ty(checkType(ty), this) { VTy = vty; } @@ -39,7 +41,7 @@ Value::~Value() { if (Uses.begin() != Uses.end()) { cerr << "While deleting: " << this; for (use_const_iterator I = Uses.begin(); I != Uses.end(); ++I) - cerr << "Use still stuck around after Def is destroyed:" << *I << endl; + cerr << "Use still stuck around after Def is destroyed:" << *I << "\n"; } #endif assert(Uses.begin() == Uses.end()); @@ -98,7 +100,7 @@ void Value::dump() const { // User Class //===----------------------------------------------------------------------===// -User::User(const Type *Ty, ValueTy vty, const string &name) +User::User(const Type *Ty, ValueTy vty, const std::string &name) : Value(Ty, vty, name) { } diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 55424fc478..0702e85f0e 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -34,6 +34,9 @@ #include "llvm/Module.h" #include "llvm/BasicBlock.h" #include "llvm/Type.h" +using std::string; +using std::vector; + // Error - Define a macro to do the common task of pushing a message onto the // end of the error list and setting Bad to true. diff --git a/lib/VMCore/iBranch.cpp b/lib/VMCore/iBranch.cpp index d0f437e293..f020ab6213 100644 --- a/lib/VMCore/iBranch.cpp +++ b/lib/VMCore/iBranch.cpp @@ -10,6 +10,7 @@ #ifndef NDEBUG #include "llvm/Type.h" // Only used for assertions... #include "llvm/Assembly/Writer.h" +#include <iostream> #endif BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond) @@ -27,7 +28,7 @@ BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond) #ifndef NDEBUG if (Cond != 0 && Cond->getType() != Type::BoolTy) - cerr << "Bad Condition: " << Cond << endl; + std::cerr << "Bad Condition: " << Cond << "\n"; #endif assert((Cond == 0 || Cond->getType() == Type::BoolTy) && "May only branch on boolean predicates!!!!"); diff --git a/lib/VMCore/iCall.cpp b/lib/VMCore/iCall.cpp index 7f4efaf7b2..37eb24e86c 100644 --- a/lib/VMCore/iCall.cpp +++ b/lib/VMCore/iCall.cpp @@ -13,8 +13,8 @@ // CallInst Implementation //===----------------------------------------------------------------------===// -CallInst::CallInst(Value *Meth, const vector<Value*> ¶ms, - const string &Name) +CallInst::CallInst(Value *Meth, const std::vector<Value*> ¶ms, + const std::string &Name) : Instruction(cast<MethodType>(cast<PointerType>(Meth->getType()) ->getElementType())->getReturnType(), Instruction::Call, Name) { @@ -44,8 +44,9 @@ CallInst::CallInst(const CallInst &CI) //===----------------------------------------------------------------------===// InvokeInst::InvokeInst(Value *Meth, BasicBlock *IfNormal, \ - BasicBlock *IfException, const vector<Value*>¶ms, - const string &Name) + BasicBlock *IfException, + const std::vector<Value*> ¶ms, + const std::string &Name) : TerminatorInst(cast<MethodType>(cast<PointerType>(Meth->getType()) ->getElementType())->getReturnType(), Instruction::Invoke, Name) { diff --git a/lib/VMCore/iMemory.cpp b/lib/VMCore/iMemory.cpp index c845fd9936..4226a69615 100644 --- a/lib/VMCore/iMemory.cpp +++ b/lib/VMCore/iMemory.cpp @@ -22,7 +22,7 @@ static inline const Type *checkType(const Type *Ty) { // pointer type. // const Type* MemAccessInst::getIndexedType(const Type *Ptr, - const vector<Value*> &Idx, + const std::vector<Value*> &Idx, bool AllowCompositeLeaf = false) { if (!Ptr->isPointerType()) return 0; // Type isn't a pointer type! @@ -48,8 +48,8 @@ const Type* MemAccessInst::getIndexedType(const Type *Ptr, // LoadInst Implementation //===----------------------------------------------------------------------===// -LoadInst::LoadInst(Value *Ptr, const vector<Value*> &Idx, - const string &Name = "") +LoadInst::LoadInst(Value *Ptr, const std::vector<Value*> &Idx, + const std::string &Name = "") : MemAccessInst(checkType(getIndexedType(Ptr->getType(), Idx)), Load, Name) { assert(getIndexedType(Ptr->getType(), Idx) && "Load operands invalid!"); Operands.reserve(1+Idx.size()); @@ -60,7 +60,7 @@ LoadInst::LoadInst(Value *Ptr, const vector<Value*> &Idx, } -LoadInst::LoadInst(Value *Ptr, const string &Name = "") +LoadInst::LoadInst(Value *Ptr, const std::string &Name = "") : MemAccessInst(cast<PointerType>(Ptr->getType())->getElementType(), Load, Name) { Operands.reserve(1); @@ -72,8 +72,8 @@ LoadInst::LoadInst(Value *Ptr, const string &Name = "") // StoreInst Implementation //===----------------------------------------------------------------------===// -StoreInst::StoreInst(Value *Val, Value *Ptr, const vector<Value*> &Idx, - const string &Name = "") +StoreInst::StoreInst(Value *Val, Value *Ptr, const std::vector<Value*> &Idx, + const std::string &Name = "") : MemAccessInst(Type::VoidTy, Store, Name) { assert(getIndexedType(Ptr->getType(), Idx) && "Store operands invalid!"); @@ -85,7 +85,7 @@ StoreInst::StoreInst(Value *Val, Value *Ptr, const vector<Value*> &Idx, Operands.push_back(Use(Idx[i], this)); } -StoreInst::StoreInst(Value *Val, Value *Ptr, const string &Name = "") +StoreInst::StoreInst(Value *Val, Value *Ptr, const std::string &Name = "") : MemAccessInst(Type::VoidTy, Store, Name) { Operands.reserve(2); @@ -98,8 +98,8 @@ StoreInst::StoreInst(Value *Val, Value *Ptr, const string &Name = "") // |