diff --git a/include/llvm/Analysis/InstForest.h b/include/llvm/Analysis/InstForest.h index 56a918bd439..f49fa98ff37 100644 --- a/include/llvm/Analysis/InstForest.h +++ b/include/llvm/Analysis/InstForest.h @@ -76,13 +76,13 @@ public: return cast(getValue()); } inline const Constant *getConstant() const { - return cast(getValue()); + return cast(getValue()); } inline BasicBlock *getBasicBlock() { return cast(getValue()); } inline const BasicBlock *getBasicBlock() const { - return cast(getValue()); + return cast(getValue()); } inline Instruction *getInstruction() { assert(isInstruction() && "getInstruction() on non instruction node!"); diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index 76a4e0f8ac2..efccc74a4f4 100644 --- a/include/llvm/DerivedTypes.h +++ b/include/llvm/DerivedTypes.h @@ -139,7 +139,7 @@ public: return T->getPrimitiveID() == FunctionTyID; } static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); + return isa(V) && classof(cast(V)); } }; @@ -172,7 +172,7 @@ public: T->getPrimitiveID() == PointerTyID; } static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); + return isa(V) && classof(cast(V)); } }; @@ -228,7 +228,7 @@ public: return T->getPrimitiveID() == StructTyID; } static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); + return isa(V) && classof(cast(V)); } }; @@ -279,7 +279,7 @@ public: T->getPrimitiveID() == PointerTyID; } static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); + return isa(V) && classof(cast(V)); } }; @@ -314,7 +314,7 @@ public: return T->getPrimitiveID() == ArrayTyID; } static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); + return isa(V) && classof(cast(V)); } }; @@ -347,7 +347,7 @@ public: return T->getPrimitiveID() == PointerTyID; } static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); + return isa(V) && classof(cast(V)); } }; diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index ae394df6153..a06a4b7fc27 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -242,7 +242,7 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { } D.destroy(); // Free old strdup'd memory... - return cast(N); + return cast(N); } default: ThrowException("Internal parser error: Invalid symbol type reference!"); @@ -506,7 +506,7 @@ static bool setValueName(Value *V, char *NameStr) { if (Existing) { // Inserting a name that is already defined??? // There is only one case where this is allowed: when we are refining an // opaque type. In this case, Existing will be an opaque type. - if (const Type *Ty = dyn_cast(Existing)) { + if (const Type *Ty = dyn_cast(Existing)) { if (const OpaqueType *OpTy = dyn_cast(Ty)) { // We ARE replacing an opaque type! ((OpaqueType*)OpTy)->refineAbstractTypeTo(cast(V)); @@ -519,7 +519,7 @@ static bool setValueName(Value *V, char *NameStr) { if (const Type *Ty = dyn_cast(Existing)) { if (Ty == cast(V)) return true; // Yes, it's equal. // std::cerr << "Type: " << Ty->getDescription() << " != " - // << cast(V)->getDescription() << "!\n"; + // << cast(V)->getDescription() << "!\n"; } else if (const Constant *C = dyn_cast(Existing)) { if (C == V) return true; // Constants are equal to themselves } else if (GlobalVariable *EGV = dyn_cast(Existing)) { @@ -875,7 +875,7 @@ ArgTypeListI : TypeListI // ResolvedVal, ValueRef and ConstValueRef productions. // ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr - const ArrayType *ATy = dyn_cast($1->get()); + const ArrayType *ATy = dyn_cast($1->get()); if (ATy == 0) ThrowException("Cannot make array constant with type: '" + (*$1)->getDescription() + "'!"); @@ -900,7 +900,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr delete $1; delete $3; } | Types '[' ']' { - const ArrayType *ATy = dyn_cast($1->get()); + const ArrayType *ATy = dyn_cast($1->get()); if (ATy == 0) ThrowException("Cannot make array constant with type: '" + (*$1)->getDescription() + "'!"); @@ -913,7 +913,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr delete $1; } | Types 'c' STRINGCONSTANT { - const ArrayType *ATy = dyn_cast($1->get()); + const ArrayType *ATy = dyn_cast($1->get()); if (ATy == 0) ThrowException("Cannot make array constant with type: '" + (*$1)->getDescription() + "'!"); @@ -941,7 +941,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr delete $1; } | Types '{' ConstVector '}' { - const StructType *STy = dyn_cast($1->get()); + const StructType *STy = dyn_cast($1->get()); if (STy == 0) ThrowException("Cannot make struct constant with type: '" + (*$1)->getDescription() + "'!"); @@ -961,7 +961,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr delete $1; delete $3; } | Types '{' '}' { - const StructType *STy = dyn_cast($1->get()); + const StructType *STy = dyn_cast($1->get()); if (STy == 0) ThrowException("Cannot make struct constant with type: '" + (*$1)->getDescription() + "'!"); @@ -973,7 +973,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr delete $1; } | Types NULL_TOK { - const PointerType *PTy = dyn_cast($1->get()); + const PointerType *PTy = dyn_cast($1->get()); if (PTy == 0) ThrowException("Cannot make null pointer constant with type: '" + (*$1)->getDescription() + "'!"); @@ -982,7 +982,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr delete $1; } | Types SymbolicValueRef { - const PointerType *Ty = dyn_cast($1->get()); + const PointerType *Ty = dyn_cast($1->get()); if (Ty == 0) ThrowException("Global const reference must be a pointer type!"); diff --git a/lib/Bytecode/Reader/ConstantReader.cpp b/lib/Bytecode/Reader/ConstantReader.cpp index 8877fe39e37..d52e5a67cc0 100644 --- a/lib/Bytecode/Reader/ConstantReader.cpp +++ b/lib/Bytecode/Reader/ConstantReader.cpp @@ -277,7 +277,7 @@ bool BytecodeParser::parseConstantValue(const unsigned char *&Buf, abort(); case Type::ArrayTyID: { - const ArrayType *AT = cast(Ty); + const ArrayType *AT = cast(Ty); unsigned NumElements = AT->getNumElements(); std::vector Elements; @@ -310,7 +310,7 @@ bool BytecodeParser::parseConstantValue(const unsigned char *&Buf, } case Type::PointerTyID: { - const PointerType *PT = cast(Ty); + const PointerType *PT = cast(Ty); unsigned SubClass; if (HasImplicitZeroInitializer) SubClass = 1; diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index c9560c1d8c2..005c5c1658d 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/SlotCalculator.cpp @@ -262,7 +262,7 @@ int SlotCalculator::insertVal(const Value *D, bool dontIgnore) { } // If it's a type, make sure that all subtypes of the type are included... - if (const Type *TheTy = dyn_cast(D)) { + if (const Type *TheTy = dyn_cast(D)) { // Insert the current type before any subtypes. This is important because // recursive types elements are inserted in a bottom up order. Changing diff --git a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp index 019d447e502..1094a484a11 100644 --- a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp +++ b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp @@ -413,7 +413,7 @@ SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &mop, const Value *Val = mop.getVRegValue(); assert(Val && "\tNULL Value in SparcFunctionAsmPrinter"); - if (const BasicBlock *BB = dyn_cast(Val)) + if (const BasicBlock *BB = dyn_cast(Val)) toAsm << getID(BB); else if (const Function *M = dyn_cast(Val)) toAsm << getID(M); diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index 8aa1851a181..e86e51f5428 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -69,10 +69,10 @@ Annotation *TargetData::TypeAnFactory(AnnotationID AID, const Annotable *T, void *D) { const TargetData &TD = *(const TargetData*)D; assert(AID == TD.AID && "Target data annotation ID mismatch!"); - const Type *Ty = cast((const Value *)T); + const Type *Ty = cast((const Value *)T); assert(isa(Ty) && "Can only create StructLayout annotation on structs!"); - return new StructLayout((const StructType *)Ty, TD); + return new StructLayout(cast(Ty), TD); } //===----------------------------------------------------------------------===// diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 545349a6f5f..2ebce7243bc 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -36,29 +36,29 @@ static void WriteAsOperandInternal(std::ostream &Out, const Value *V, SlotCalculator *Table); static const Module *getModuleFromVal(const Value *V) { - if (const Argument *MA = dyn_cast(V)) + if (const Argument *MA = dyn_cast(V)) return MA->getParent() ? MA->getParent()->getParent() : 0; - else if (const BasicBlock *BB = dyn_cast(V)) + else if (const BasicBlock *BB = dyn_cast(V)) return BB->getParent() ? BB->getParent()->getParent() : 0; - else if (const Instruction *I = dyn_cast(V)) { + else if (const Instruction *I = dyn_cast(V)) { const Function *M = I->getParent() ? I->getParent()->getParent() : 0; return M ? M->getParent() : 0; - } else if (const GlobalValue *GV = dyn_cast(V)) + } else if (const GlobalValue *GV = dyn_cast(V)) return GV->getParent(); return 0; } static SlotCalculator *createSlotCalculator(const Value *V) { assert(!isa(V) && "Can't create an SC for a type!"); - if (const Argument *FA = dyn_cast(V)) { + if (const Argument *FA = dyn_cast(V)) { return new SlotCalculator(FA->getParent(), true); - } else if (const Instruction *I = dyn_cast(V)) { + } else if (const Instruction *I = dyn_cast(V)) { return new SlotCalculator(I->getParent()->getParent(), true); - } else if (const BasicBlock *BB = dyn_cast(V)) { + } else if (const BasicBlock *BB = dyn_cast(V)) { return new SlotCalculator(BB->getParent(), true); - } else if (const GlobalVariable *GV = dyn_cast(V)){ + } else if (const GlobalVariable *GV = dyn_cast(V)){ return new SlotCalculator(GV->getParent(), true); - } else if (const Function *Func = dyn_cast(V)) { + } else if (const Function *Func = dyn_cast(V)) { return new SlotCalculator(Func, true); } return 0; @@ -79,7 +79,7 @@ static void fillTypeNameTable(const Module *M, // As a heuristic, don't insert pointer to primitive types, because // they are used too often to have a single useful name. // - const Type *Ty = cast(I->second); + const Type *Ty = cast(I->second); if (!isa(Ty) || !cast(Ty)->getElementType()->isPrimitiveType()) TypeNames.insert(std::make_pair(Ty, "%"+I->first)); @@ -114,7 +114,7 @@ static std::string calcTypeName(const Type *Ty, std::string Result; switch (Ty->getPrimitiveID()) { case Type::FunctionTyID: { - const FunctionType *FTy = cast(Ty); + const FunctionType *FTy = cast(Ty); Result = calcTypeName(FTy->getReturnType(), TypeStack, TypeNames) + " ("; for (FunctionType::ParamTypes::const_iterator I = FTy->getParamTypes().begin(), @@ -131,7 +131,7 @@ static std::string calcTypeName(const Type *Ty, break; } case Type::StructTyID: { - const StructType *STy = cast(Ty); + const StructType *STy = cast(Ty); Result = "{ "; for (StructType::ElementTypes::const_iterator I = STy->getElementTypes().begin(), @@ -144,11 +144,11 @@ static std::string calcTypeName(const Type *Ty, break; } case Type::PointerTyID: - Result = calcTypeName(cast(Ty)->getElementType(), + Result = calcTypeName(cast(Ty)->getElementType(), TypeStack, TypeNames) + "*"; break; case Type::ArrayTyID: { - const ArrayType *ATy = cast(Ty); + const ArrayType *ATy = cast(Ty); Result = "[" + utostr(ATy->getNumElements()) + " x "; Result += calcTypeName(ATy->getElementType(), TypeStack, TypeNames) + "]"; break; @@ -377,14 +377,14 @@ static void WriteAsOperandInternal(std::ostream &Out, const Value *V, if (PrintName && V->hasName()) { Out << "%" << V->getName(); } else { - if (const Constant *CV = dyn_cast(V)) { + if (const Constant *CV = dyn_cast(V)) { WriteConstantInt(Out, CV, PrintName, TypeTable, Table); } else { int Slot; if (Table) { Slot = Table->getValSlot(V); } else { - if (const Type *Ty = dyn_cast(V)) { + if (const Type *Ty = dyn_cast(V)) { Out << Ty->getDescription(); return; } @@ -580,9 +580,9 @@ void AssemblyWriter::printSymbolTable(const SymbolTable &ST) { for (; I != End; ++I) { const Value *V = I->second; - if (const Constant *CPV = dyn_cast(V)) { + if (const Constant *CPV = dyn_cast(V)) { printConstant(CPV); - } else if (const Type *Ty = dyn_cast(V)) { + } else if (const Type *Ty = dyn_cast(V)) { Out << "\t%" << I->first << " = type "; // Make sure we print out at least one level of the type structure, so @@ -959,7 +959,7 @@ CachedWriter &CachedWriter::operator<<(const Value *V) { switch (V->getValueType()) { case Value::ConstantVal: case Value::ArgumentVal: AW->writeOperand(V, true, true); break; - case Value::TypeVal: AW->write(cast(V)); break; + case Value::TypeVal: AW->write(cast(V)); break; case Value::InstructionVal: AW->write(cast(V)); break; case Value::BasicBlockVal: AW->write(cast(V)); break; case Value::FunctionVal: AW->write(cast(V)); break; diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp index c9560c1d8c2..005c5c1658d 100644 --- a/lib/VMCore/SlotCalculator.cpp +++ b/lib/VMCore/SlotCalculator.cpp @@ -262,7 +262,7 @@ int SlotCalculator::insertVal(const Value *D, bool dontIgnore) { } // If it's a type, make sure that all subtypes of the type are included... - if (const Type *TheTy = dyn_cast(D)) { + if (const Type *TheTy = dyn_cast(D)) { // Insert the current type before any subtypes. This is important because // recursive types elements are inserted in a bottom up order. Changing diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp index 12c87981b8e..ddd769d075f 100644 --- a/lib/VMCore/SymbolTable.cpp +++ b/lib/VMCore/SymbolTable.cpp @@ -19,7 +19,7 @@ SymbolTable::~SymbolTable() { if (TyPlane != end()) { VarMap &TyP = TyPlane->second; for (VarMap::iterator I = TyP.begin(), E = TyP.end(); I != E; ++I) { - const Type *Ty = cast(I->second); + const Type *Ty = cast(I->second); if (Ty->isAbstract()) // If abstract, drop the reference... cast(Ty)->removeAbstractTypeUser(this); } @@ -122,7 +122,7 @@ Value *SymbolTable::removeEntry(iterator Plane, type_iterator Entry) { // If we are removing an abstract type, remove the symbol table from it's use // list... if (Ty == Type::TypeTy) { - const Type *T = cast(Result); + const Type *T = cast(Result); if (T->isAbstract()) { #if DEBUG_ABSTYPE std::cerr << "Removing abs type from symtab" << T->getDescription()<<"\n"; @@ -179,7 +179,7 @@ void SymbolTable::insertEntry(const std::string &Name, const Type *VTy, // If we are adding an abstract type, add the symbol table to it's use list. if (VTy == Type::TypeTy) { - const Type *T = cast(V); + const Type *T = cast(V); if (T->isAbstract()) { cast(T)->addAbstractTypeUser(this); #if DEBUG_ABSTYPE @@ -311,7 +311,7 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType, #if DEBUG_ABSTYPE std::cerr << "Added type " << NewType->getDescription() << "\n"; #endif - cast(NewType)->addAbstractTypeUser(this); + cast(NewType)->addAbstractTypeUser(this); } } } diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 28ed4f366e5..d74433a9748 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -293,7 +293,7 @@ static std::string getTypeProps(const Type *Ty, switch (Ty->getPrimitiveID()) { case Type::FunctionTyID: { - const FunctionType *MTy = cast(Ty); + const FunctionType *MTy = cast(Ty); Result = getTypeProps(MTy->getReturnType(), TypeStack, isAbstract, isRecursive)+" ("; for (FunctionType::ParamTypes::const_iterator @@ -311,7 +311,7 @@ static std::string getTypeProps(const Type *Ty, break; } case Type::StructTyID: { - const StructType *STy = cast(Ty); + const StructType *STy = cast(Ty); Result = "{ "; for (StructType::ElementTypes::const_iterator I = STy->getElementTypes().begin(), @@ -324,13 +324,13 @@ static std::string getTypeProps(const Type *Ty, break; } case Type::PointerTyID: { - const PointerType *PTy = cast(Ty); + const PointerType *PTy = cast(Ty); Result = getTypeProps(PTy->getElementType(), TypeStack, isAbstract, isRecursive) + " *"; break; } case Type::ArrayTyID: { - const ArrayType *ATy = cast(Ty); + const ArrayType *ATy = cast(Ty); unsigned NumElements = ATy->getNumElements(); Result = "["; Result += utostr(NumElements) + " x "; @@ -400,10 +400,10 @@ static bool TypesEqual(const Type *Ty, const Type *Ty2, // algorithm is the fact that arraytypes have sizes that differentiates types, // and that method types can be varargs or not. Consider this now. if (const ArrayType *ATy = dyn_cast(Ty)) { - if (ATy->getNumElements() != cast(Ty2)->getNumElements()) + if (ATy->getNumElements() != cast(Ty2)->getNumElements()) return false; } else if (const FunctionType *MTy = dyn_cast(Ty)) { - if (MTy->isVarArg() != cast(Ty2)->isVarArg()) + if (MTy->isVarArg() != cast(Ty2)->isVarArg()) return false; }