diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-01 18:26:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-01 18:26:53 +0000 |
commit | cfe26c930ae691ff3012736555846c45087e1a9e (patch) | |
tree | b68b70097da64da9be4a068f62d7ae3d43e05896 /lib/VMCore | |
parent | 9636a91649f168f41b477cba705287665e054f79 (diff) | |
download | external_llvm-cfe26c930ae691ff3012736555846c45087e1a9e.zip external_llvm-cfe26c930ae691ff3012736555846c45087e1a9e.tar.gz external_llvm-cfe26c930ae691ff3012736555846c45087e1a9e.tar.bz2 |
Add more support for new style casts
Convert more code to use them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@695 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 4 | ||||
-rw-r--r-- | lib/VMCore/ConstPoolVals.cpp | 8 | ||||
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/SlotCalculator.cpp | 6 | ||||
-rw-r--r-- | lib/VMCore/SymbolTable.cpp | 20 |
5 files changed, 18 insertions, 22 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index e40006c..3c67c2c 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -143,9 +143,9 @@ void AssemblyWriter::processSymbolTable(const SymbolTable &ST) { for (; I != End; ++I) { const Value *V = I->second; - if (const ConstPoolVal *CPV = V->castConstant()) { + if (const ConstPoolVal *CPV = cast<const ConstPoolVal>(V)) { processConstant(CPV); - } else if (const Type *Ty = V->castType()) { + } else if (const Type *Ty = cast<const Type>(V)) { Out << "\t%" << I->first << " = type " << Ty->getDescription() << endl; } } diff --git a/lib/VMCore/ConstPoolVals.cpp b/lib/VMCore/ConstPoolVals.cpp index 152209d..374c583 100644 --- a/lib/VMCore/ConstPoolVals.cpp +++ b/lib/VMCore/ConstPoolVals.cpp @@ -127,10 +127,10 @@ string ConstPoolArray::getStrValue() const { string Result = "["; if (Operands.size()) { Result += " " + Operands[0]->getType()->getDescription() + - " " + Operands[0]->castConstantAsserting()->getStrValue(); + " " + cast<ConstPoolVal>(Operands[0])->getStrValue(); for (unsigned i = 1; i < Operands.size(); i++) Result += ", " + Operands[i]->getType()->getDescription() + - " " + Operands[i]->castConstantAsserting()->getStrValue(); + " " + cast<ConstPoolVal>(Operands[i])->getStrValue(); } return Result + " ]"; @@ -140,10 +140,10 @@ string ConstPoolStruct::getStrValue() const { string Result = "{"; if (Operands.size()) { Result += " " + Operands[0]->getType()->getDescription() + - " " + Operands[0]->castConstantAsserting()->getStrValue(); + " " + cast<ConstPoolVal>(Operands[0])->getStrValue(); for (unsigned i = 1; i < Operands.size(); i++) Result += ", " + Operands[i]->getType()->getDescription() + - " " + Operands[i]->castConstantAsserting()->getStrValue(); + " " + cast<ConstPoolVal>(Operands[i])->getStrValue(); } return Result + " }"; diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 3974bf3..c899d7d 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -238,7 +238,7 @@ struct DirectRules // Annotation *ConstRules::find(AnnotationID AID, const Annotable *TyA, void *) { assert(AID == ConstRules::AID && "Bad annotation for factory!"); - const Type *Ty = ((const Value*)TyA)->castTypeAsserting(); + const Type *Ty = cast<Type>((const Value*)TyA); switch (Ty->getPrimitiveID()) { case Type::BoolTyID: return new BoolRules(); diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp index cac8f2e..d0f37fb 100644 --- a/lib/VMCore/SlotCalculator.cpp +++ b/lib/VMCore/SlotCalculator.cpp @@ -250,13 +250,13 @@ int SlotCalculator::insertVal(const Value *D, bool dontIgnore = false) { if (!dontIgnore) // Don't ignore nonignorables! if (D->getType() == Type::VoidTy || // Ignore void type nodes (IgnoreNamedNodes && // Ignore named and constants - (D->hasName() || D->isConstant()) && !D->isType())) { + (D->hasName() || isa<ConstPoolVal>(D)) && !isa<Type>(D))) { SC_DEBUG("ignored value " << D << endl); return -1; // We do need types unconditionally though } // If it's a type, make sure that all subtypes of the type are included... - if (const Type *TheTy = D->castType()) { + if (const Type *TheTy = dyn_cast<const Type>(D)) { SC_DEBUG(" Inserted type: " << TheTy->getDescription() << endl); // Loop over any contained types in the definition... in reverse depth first @@ -289,7 +289,7 @@ int SlotCalculator::doInsertVal(const Value *D) { // Used for debugging DefSlot=-1 assertion... //if (Typ == Type::TypeTy) - // cerr << "Inserting type '" << D->castTypeAsserting()->getDescription() << "'!\n"; + // cerr << "Inserting type '" << cast<Type>(D)->getDescription() << "'!\n"; if (Typ->isDerivedType()) { int DefSlot = getValSlot(Typ); diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp index 491d7ad..12bf0c7 100644 --- a/lib/VMCore/SymbolTable.cpp +++ b/lib/VMCore/SymbolTable.cpp @@ -8,10 +8,6 @@ #include "llvm/InstrTypes.h" #include "llvm/Support/StringExtras.h" #include "llvm/DerivedTypes.h" -#ifndef NDEBUG -#include "llvm/BasicBlock.h" // Required for assertions to work. -#include "llvm/Type.h" -#endif SymbolTable::~SymbolTable() { // Drop all abstract type references in the type plane... @@ -19,16 +15,16 @@ SymbolTable::~SymbolTable() { if (TyPlane != end()) { VarMap &TyP = TyPlane->second; for (VarMap::iterator I = TyP.begin(), E = TyP.end(); I != E; ++I) { - const Type *Ty = I->second->castTypeAsserting(); + const Type *Ty = cast<const Type>(I->second); if (Ty->isAbstract()) // If abstract, drop the reference... - Ty->castDerivedTypeAsserting()->removeAbstractTypeUser(this); + cast<DerivedType>(Ty)->removeAbstractTypeUser(this); } } #ifndef NDEBUG // Only do this in -g mode... bool LeftoverValues = true; for (iterator i = begin(); i != end(); ++i) { for (type_iterator I = i->second.begin(); I != i->second.end(); ++I) - if (!I->second->isConstant() && !I->second->isType()) { + if (!isa<ConstPoolVal>(I->second) && !isa<Type>(I->second)) { cerr << "Value still in symbol table! Type = '" << i->first->getDescription() << "' Name = '" << I->first << "'\n"; LeftoverValues = false; @@ -112,9 +108,9 @@ Value *SymbolTable::type_remove(const type_iterator &It) { // If we are removing an abstract type, remove the symbol table from it's use // list... if (Ty == Type::TypeTy) { - const Type *T = Result->castTypeAsserting(); + const Type *T = cast<const Type>(Result); if (T->isAbstract()) - T->castDerivedTypeAsserting()->removeAbstractTypeUser(this); + cast<DerivedType>(T)->removeAbstractTypeUser(this); } return Result; @@ -149,9 +145,9 @@ void SymbolTable::insertEntry(const string &Name, Value *V) { // If we are adding an abstract type, add the symbol table to it's use list. if (VTy == Type::TypeTy) { - const Type *T = V->castTypeAsserting(); + const Type *T = cast<const Type>(V); if (T->isAbstract()) - T->castDerivedTypeAsserting()->addAbstractTypeUser(this); + cast<DerivedType>(T)->addAbstractTypeUser(this); } } @@ -174,6 +170,6 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType, OldType->removeAbstractTypeUser(this); I->second = (Value*)NewType; // TODO FIXME when types aren't const if (NewType->isAbstract()) - NewType->castDerivedTypeAsserting()->addAbstractTypeUser(this); + cast<const DerivedType>(NewType)->addAbstractTypeUser(this); } } |