[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp SlotCalculator.cpp SymbolTable.cpp Type.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Jul 23 10:31:11 PDT 2003
Changes in directory llvm/lib/VMCore:
AsmWriter.cpp updated: 1.92 -> 1.93
SlotCalculator.cpp updated: 1.26 -> 1.27
SymbolTable.cpp updated: 1.29 -> 1.30
Type.cpp updated: 1.48 -> 1.49
---
Log message:
Remove redundant const qualifiers from cast<> expressions
---
Diffs of the changes:
Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.92 llvm/lib/VMCore/AsmWriter.cpp:1.93
--- llvm/lib/VMCore/AsmWriter.cpp:1.92 Wed Jul 23 10:22:26 2003
+++ llvm/lib/VMCore/AsmWriter.cpp Wed Jul 23 10:30:06 2003
@@ -36,29 +36,29 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
Index: llvm/lib/VMCore/SlotCalculator.cpp
diff -u llvm/lib/VMCore/SlotCalculator.cpp:1.26 llvm/lib/VMCore/SlotCalculator.cpp:1.27
--- llvm/lib/VMCore/SlotCalculator.cpp:1.26 Wed Mar 19 14:57:22 2003
+++ llvm/lib/VMCore/SlotCalculator.cpp Wed Jul 23 10:30:06 2003
@@ -262,7 +262,7 @@
}
// 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
Index: llvm/lib/VMCore/SymbolTable.cpp
diff -u llvm/lib/VMCore/SymbolTable.cpp:1.29 llvm/lib/VMCore/SymbolTable.cpp:1.30
--- llvm/lib/VMCore/SymbolTable.cpp:1.29 Thu May 22 16:47:17 2003
+++ llvm/lib/VMCore/SymbolTable.cpp Wed Jul 23 10:30:06 2003
@@ -19,7 +19,7 @@
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 @@
// 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 @@
// 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 @@
#if DEBUG_ABSTYPE
std::cerr << "Added type " << NewType->getDescription() << "\n";
#endif
- cast<const DerivedType>(NewType)->addAbstractTypeUser(this);
+ cast<DerivedType>(NewType)->addAbstractTypeUser(this);
}
}
}
Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.48 llvm/lib/VMCore/Type.cpp:1.49
--- llvm/lib/VMCore/Type.cpp:1.48 Wed Jun 18 14:22:28 2003
+++ llvm/lib/VMCore/Type.cpp Wed Jul 23 10:30:06 2003
@@ -293,7 +293,7 @@
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 @@
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 @@
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 @@
// 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;
}
More information about the llvm-commits
mailing list