diff options
author | Chris Lattner <sabre@nondot.org> | 2003-07-23 15:30:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-07-23 15:30:06 +0000 |
commit | 949a3628024248db01d5b13e03c415e0c88e90e4 (patch) | |
tree | 20016aa1bfe0b2a217ac5c604879bee62f0321ea /lib | |
parent | c07736a397012499e337c994f7f952b07c709544 (diff) | |
download | llvm-949a3628024248db01d5b13e03c415e0c88e90e4.tar.gz llvm-949a3628024248db01d5b13e03c415e0c88e90e4.tar.bz2 llvm-949a3628024248db01d5b13e03c415e0c88e90e4.tar.xz |
Remove redundant const qualifiers from cast<> expressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 20 | ||||
-rw-r--r-- | lib/Bytecode/Reader/ConstantReader.cpp | 4 | ||||
-rw-r--r-- | lib/Bytecode/Writer/SlotCalculator.cpp | 2 | ||||
-rw-r--r-- | lib/Target/SparcV9/SparcV9AsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/TargetData.cpp | 4 | ||||
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 38 | ||||
-rw-r--r-- | lib/VMCore/SlotCalculator.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/SymbolTable.cpp | 8 | ||||
-rw-r--r-- | lib/VMCore/Type.cpp | 12 |
9 files changed, 46 insertions, 46 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index ae394df615..a06a4b7fc2 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<const Type>(N); + return cast<Type>(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<const Type>(Existing)) { + if (const Type *Ty = dyn_cast<Type>(Existing)) { if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Ty)) { // We ARE replacing an opaque type! ((OpaqueType*)OpTy)->refineAbstractTypeTo(cast<Type>(V)); @@ -519,7 +519,7 @@ static bool setValueName(Value *V, char *NameStr) { if (const Type *Ty = dyn_cast<Type>(Existing)) { if (Ty == cast<Type>(V)) return true; // Yes, it's equal. // std::cerr << "Type: " << Ty->getDescription() << " != " - // << cast<const Type>(V)->getDescription() << "!\n"; + // << cast<Type>(V)->getDescription() << "!\n"; } else if (const Constant *C = dyn_cast<Constant>(Existing)) { if (C == V) return true; // Constants are equal to themselves } else if (GlobalVariable *EGV = dyn_cast<GlobalVariable>(Existing)) { @@ -875,7 +875,7 @@ ArgTypeListI : TypeListI // ResolvedVal, ValueRef and ConstValueRef productions. // ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr - const ArrayType *ATy = dyn_cast<const ArrayType>($1->get()); + const ArrayType *ATy = dyn_cast<ArrayType>($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<const ArrayType>($1->get()); + const ArrayType *ATy = dyn_cast<ArrayType>($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<const ArrayType>($1->get()); + const ArrayType *ATy = dyn_cast<ArrayType>($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<const StructType>($1->get()); + const StructType *STy = dyn_cast<StructType>($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<const StructType>($1->get()); + const StructType *STy = dyn_cast<StructType>($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<const PointerType>($1->get()); + const PointerType *PTy = dyn_cast<PointerType>($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<const PointerType>($1->get()); + const PointerType *Ty = dyn_cast<PointerType>($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 8877fe39e3..d52e5a67cc 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<const ArrayType>(Ty); + const ArrayType *AT = cast<ArrayType>(Ty); unsigned NumElements = AT->getNumElements(); std::vector<Constant*> Elements; @@ -310,7 +310,7 @@ bool BytecodeParser::parseConstantValue(const unsigned char *&Buf, } case Type::PointerTyID: { - const PointerType *PT = cast<const PointerType>(Ty); + const PointerType *PT = cast<PointerType>(Ty); unsigned SubClass; if (HasImplicitZeroInitializer) SubClass = 1; diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index c9560c1d8c..005c5c1658 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<const Type>(D)) { + if (const Type *TheTy = dyn_cast<Type>(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 019d447e50..1094a484a1 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<const BasicBlock>(Val)) + if (const BasicBlock *BB = dyn_cast<BasicBlock>(Val)) toAsm << getID(BB); else if (const Function *M = dyn_cast<Function>(Val)) toAsm << getID(M); diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index 8aa1851a18..e86e51f542 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 Type>((const Value *)T); + const Type *Ty = cast<Type>((const Value *)T); assert(isa<StructType>(Ty) && "Can only create StructLayout annotation on structs!"); - return new StructLayout((const StructType *)Ty, TD); + return new StructLayout(cast<StructType>(Ty), TD); } //===----------------------------------------------------------------------===// diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 545349a6f5..2ebce7243b 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<const Argument>(V)) + if (const Argument *MA = dyn_cast<Argument>(V)) return MA->getParent() ? MA->getParent()->getParent() : 0; - else if (const BasicBlock *BB = dyn_cast<const BasicBlock>(V)) + else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V)) return BB->getParent() ? BB->getParent()->getParent() : 0; - else if (const Instruction *I = dyn_cast<const Instruction>(V)) { + else if (const Instruction *I = dyn_cast<Instruction>(V)) { const Function *M = I->getParent() ? I->getParent()->getParent() : 0; return M ? M->getParent() : 0; - } else if (const GlobalValue *GV = dyn_cast<const GlobalValue>(V)) + } else if (const GlobalValue *GV = dyn_cast<GlobalValue>(V)) return GV->getParent(); return 0; } static SlotCalculator *createSlotCalculator(const Value *V) { assert(!isa<Type>(V) && "Can't create an SC for a type!"); - if (const Argument *FA = dyn_cast<const Argument>(V)) { + if (const Argument *FA = dyn_cast<Argument>(V)) { return new SlotCalculator(FA->getParent(), true); - } else if (const Instruction *I = dyn_cast<const Instruction>(V)) { + } else if (const Instruction *I = dyn_cast<Instruction>(V)) { return new SlotCalculator(I->getParent()->getParent(), true); - } else if (const BasicBlock *BB = dyn_cast<const BasicBlock>(V)) { + } else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V)) { return new SlotCalculator(BB->getParent(), true); - } else if (const GlobalVariable *GV = dyn_cast<const GlobalVariable>(V)){ + } else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)){ return new SlotCalculator(GV->getParent(), true); - } else if (const Function *Func = dyn_cast<const Function>(V)) { + } else if (const Function *Func = dyn_cast<Function>(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<const Type>(I->second); + const Type *Ty = cast<Type>(I->second); if (!isa<PointerType>(Ty) || !cast<PointerType>(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<const FunctionType>(Ty); + const FunctionType *FTy = cast<FunctionType>(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<const StructType>(Ty); + const StructType *STy = cast<StructType>(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<const PointerType>(Ty)->getElementType(), + Result = calcTypeName(cast<PointerType>(Ty)->getElementType(), TypeStack, TypeNames) + "*"; break; case Type::ArrayTyID: { - const ArrayType *ATy = cast<const ArrayType>(Ty); + const ArrayType *ATy = cast<ArrayType>(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<const Constant>(V)) { + if (const Constant *CV = dyn_cast<Constant>(V)) { WriteConstantInt(Out, CV, PrintName, TypeTable, Table); } else { int Slot; if (Table) { Slot = Table->getValSlot(V); } else { - if (const Type *Ty = dyn_cast<const Type>(V)) { + if (const Type *Ty = dyn_cast<Type>(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<const Constant>(V)) { + if (const Constant *CPV = dyn_cast<Constant>(V)) { printConstant(CPV); - } else if (const Type *Ty = dyn_cast<const Type>(V)) { + } else if (const Type *Ty = dyn_cast<Type>(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<const Type>(V)); break; + case Value::TypeVal: AW->write(cast<Type>(V)); break; case Value::InstructionVal: AW->write(cast<Instruction>(V)); break; case Value::BasicBlockVal: AW->write(cast<BasicBlock>(V)); break; case Value::FunctionVal: AW->write(cast<Function>(V)); break; diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp index c9560c1d8c..005c5c1658 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<const Type>(D)) { + if (const Type *TheTy = dyn_cast<Type>(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 12c87981b8..ddd769d075 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<const Type>(I->second); + const Type *Ty = cast<Type>(I->second); if (Ty->isAbstract()) // If abstract, drop the reference... cast<DerivedType>(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<const Type>(Result); + const Type *T = cast<Type>(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<const Type>(V); + const Type *T = cast<Type>(V); if (T->isAbstract()) { cast<DerivedType>(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<const DerivedType>(NewType)->addAbstractTypeUser(this); + cast<DerivedType>(NewType)->addAbstractTypeUser(this); } } } diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 28ed4f366e..d74433a974 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<const FunctionType>(Ty); + const FunctionType *MTy = cast<FunctionType>(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<const StructType>(Ty); + const StructType *STy = cast<StructType>(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<const PointerType>(Ty); + const PointerType *PTy = cast<PointerType>(Ty); Result = getTypeProps(PTy->getElementType(), TypeStack, isAbstract, isRecursive) + " *"; break; } case Type::ArrayTyID: { - const ArrayType *ATy = cast<const ArrayType>(Ty); + const ArrayType *ATy = cast<ArrayType>(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<ArrayType>(Ty)) { - if (ATy->getNumElements() != cast<const ArrayType>(Ty2)->getNumElements()) + if (ATy->getNumElements() != cast<ArrayType>(Ty2)->getNumElements()) return false; } else if (const FunctionType *MTy = dyn_cast<FunctionType>(Ty)) { - if (MTy->isVarArg() != cast<const FunctionType>(Ty2)->isVarArg()) + if (MTy->isVarArg() != cast<FunctionType>(Ty2)->isVarArg()) return false; } |