diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-02 03:41:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-02 03:41:24 +0000 |
commit | b00c582b6d40e6b9ff2d1ed4f5eaf7930e792ace (patch) | |
tree | 44b5f879c16e7ecb2e9334ad120e3454270e1bb3 /lib/Bytecode | |
parent | 1d87bcf4909b06dcd86320722653341f08b8b396 (diff) |
Commit more code over to new cast style
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r-- | lib/Bytecode/Reader/ConstantReader.cpp | 6 | ||||
-rw-r--r-- | lib/Bytecode/Reader/InstructionReader.cpp | 22 | ||||
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 4 | ||||
-rw-r--r-- | lib/Bytecode/Writer/ConstantWriter.cpp | 10 |
4 files changed, 21 insertions, 21 deletions
diff --git a/lib/Bytecode/Reader/ConstantReader.cpp b/lib/Bytecode/Reader/ConstantReader.cpp index aaecedddfa..4c7f7c9ac2 100644 --- a/lib/Bytecode/Reader/ConstantReader.cpp +++ b/lib/Bytecode/Reader/ConstantReader.cpp @@ -229,7 +229,7 @@ bool BytecodeParser::parseConstPoolValue(const uchar *&Buf, abort(); case Type::ArrayTyID: { - const ArrayType *AT = (const ArrayType*)Ty; + const ArrayType *AT = cast<const ArrayType>(Ty); unsigned NumElements; if (AT->isSized()) // Sized array, # elements stored in type! NumElements = (unsigned)AT->getNumElements(); @@ -249,7 +249,7 @@ bool BytecodeParser::parseConstPoolValue(const uchar *&Buf, } case Type::StructTyID: { - const StructType *ST = Ty->castStructType(); + const StructType *ST = cast<StructType>(Ty); const StructType::ElementTypes &ET = ST->getElementTypes(); vector<ConstPoolVal *> Elements; @@ -267,7 +267,7 @@ bool BytecodeParser::parseConstPoolValue(const uchar *&Buf, } case Type::PointerTyID: { - const PointerType *PT = Ty->castPointerType(); + const PointerType *PT = cast<const PointerType>(Ty); unsigned SubClass; if (read_vbr(Buf, EndBuf, SubClass)) return failure(true); if (SubClass != 0) return failure(true); diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp index 300c40999e..b6eec66491 100644 --- a/lib/Bytecode/Reader/InstructionReader.cpp +++ b/lib/Bytecode/Reader/InstructionReader.cpp @@ -122,11 +122,11 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, delete PN; return failure(true); case 2: PN->addIncoming(getValue(Raw.Ty, Raw.Arg1), - (BasicBlock*)getValue(Type::LabelTy, Raw.Arg2)); + cast<BasicBlock>(getValue(Type::LabelTy,Raw.Arg2))); break; default: PN->addIncoming(getValue(Raw.Ty, Raw.Arg1), - (BasicBlock*)getValue(Type::LabelTy, Raw.Arg2)); + cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg2))); if (Raw.VarArgs->size() & 1) { cerr << "PHI Node with ODD number of arguments!\n"; delete PN; @@ -135,7 +135,7 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, vector<unsigned> &args = *Raw.VarArgs; for (unsigned i = 0; i < args.size(); i+=2) PN->addIncoming(getValue(Raw.Ty, args[i]), - (BasicBlock*)getValue(Type::LabelTy, args[i+1])); + cast<BasicBlock>(getValue(Type::LabelTy, args[i+1]))); } delete Raw.VarArgs; break; @@ -160,12 +160,12 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, case Instruction::Br: if (Raw.NumOperands == 1) { - Res = new BranchInst((BasicBlock*)getValue(Type::LabelTy, Raw.Arg1)); + Res = new BranchInst(cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg1))); return false; } else if (Raw.NumOperands == 3) { - Res = new BranchInst((BasicBlock*)getValue(Type::LabelTy, Raw.Arg1), - (BasicBlock*)getValue(Type::LabelTy, Raw.Arg2), - getValue(Type::BoolTy , Raw.Arg3)); + Res = new BranchInst(cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg1)), + cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg2)), + getValue(Type::BoolTy , Raw.Arg3)); return false; } break; @@ -173,7 +173,7 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, case Instruction::Switch: { SwitchInst *I = new SwitchInst(getValue(Raw.Ty, Raw.Arg1), - (BasicBlock*)getValue(Type::LabelTy, Raw.Arg2)); + cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg2))); Res = I; if (Raw.NumOperands < 3) return false; // No destinations? Wierd. @@ -185,15 +185,15 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, vector<unsigned> &args = *Raw.VarArgs; for (unsigned i = 0; i < args.size(); i += 2) - I->dest_push_back((ConstPoolVal*)getValue(Raw.Ty, args[i]), - (BasicBlock*)getValue(Type::LabelTy, args[i+1])); + I->dest_push_back(cast<ConstPoolVal>(getValue(Raw.Ty, args[i])), + cast<BasicBlock>(getValue(Type::LabelTy, args[i+1]))); delete Raw.VarArgs; return false; } case Instruction::Call: { - Method *M = (Method*)getValue(Raw.Ty, Raw.Arg1); + Method *M = cast<Method>(getValue(Raw.Ty, Raw.Arg1)); if (M == 0) return failure(true); vector<Value *> Params; diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 0e4883034e..14e89e2d20 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -338,7 +338,7 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End, unsigned InitSlot; if (read_vbr(Buf, End, InitSlot)) return failure(true); - Value *V = getValue(Ty->castPointerType()->getValueType(), + Value *V = getValue(cast<const PointerType>(Ty)->getValueType(), InitSlot, false); if (V == 0) return failure(true); Initializer = cast<ConstPoolVal>(V); @@ -382,7 +382,7 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End, // Keep track of this information in a linked list that is emptied as // methods are loaded... // - MethodSignatureList.push_back(make_pair((const MethodType*)Ty, SlotNo)); + MethodSignatureList.push_back(make_pair(cast<const MethodType>(Ty),SlotNo)); if (read_vbr(Buf, End, MethSignature)) return failure(true); BCR_TRACE(2, "Method of type: " << Ty << endl); } diff --git a/lib/Bytecode/Writer/ConstantWriter.cpp b/lib/Bytecode/Writer/ConstantWriter.cpp index dde47d52b1..d0c58f1ae6 100644 --- a/lib/Bytecode/Writer/ConstantWriter.cpp +++ b/lib/Bytecode/Writer/ConstantWriter.cpp @@ -23,7 +23,7 @@ void BytecodeWriter::outputType(const Type *T) { switch (T->getPrimitiveID()) { // Handle derived types now. case Type::MethodTyID: { - const MethodType *MT = (const MethodType*)T; + const MethodType *MT = cast<const MethodType>(T); int Slot = Table.getValSlot(MT->getReturnType()); assert(Slot != -1 && "Type used but not available!!"); output_vbr((unsigned)Slot, Out); @@ -46,7 +46,7 @@ void BytecodeWriter::outputType(const Type *T) { } case Type::ArrayTyID: { - const ArrayType *AT = (const ArrayType*)T; + const ArrayType *AT = cast<const ArrayType>(T); int Slot = Table.getValSlot(AT->getElementType()); assert(Slot != -1 && "Type used but not available!!"); output_vbr((unsigned)Slot, Out); @@ -57,7 +57,7 @@ void BytecodeWriter::outputType(const Type *T) { } case Type::StructTyID: { - const StructType *ST = (const StructType*)T; + const StructType *ST = cast<const StructType>(T); // Output all of the element types... StructType::ElementTypes::const_iterator I = ST->getElementTypes().begin(); @@ -73,7 +73,7 @@ void BytecodeWriter::outputType(const Type *T) { } case Type::PointerTyID: { - const PointerType *PT = (const PointerType*)T; + const PointerType *PT = cast<const PointerType>(T); int Slot = Table.getValSlot(PT->getValueType()); assert(Slot != -1 && "Type used but not available!!"); output_vbr((unsigned)Slot, Out); @@ -91,7 +91,7 @@ void BytecodeWriter::outputType(const Type *T) { bool BytecodeWriter::outputConstant(const ConstPoolVal *CPV) { switch (CPV->getType()->getPrimitiveID()) { case Type::BoolTyID: // Boolean Types - if (((const ConstPoolBool*)CPV)->getValue()) + if (cast<const ConstPoolBool>(CPV)->getValue()) output_vbr((unsigned)1, Out); else output_vbr((unsigned)0, Out); |