diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-01 20:11:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-01 20:11:19 +0000 |
commit | 38569343868ee3dad90dcdddfb9fee1ca0bcf25f (patch) | |
tree | 1b9bc0f2b6911aed0815f3a00945714c26a8a5ce /llvm/lib/VMCore | |
parent | 8f191129239552b876f2c6717fae9619a7701a03 (diff) | |
download | bcm5719-llvm-38569343868ee3dad90dcdddfb9fee1ca0bcf25f.tar.gz bcm5719-llvm-38569343868ee3dad90dcdddfb9fee1ca0bcf25f.zip |
Convert more code to use new style casts
Eliminate old style casts from value.h
llvm-svn: 696
Diffstat (limited to 'llvm/lib/VMCore')
-rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/VMCore/BasicBlock.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/ConstPoolVals.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/VMCore/Function.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/SlotCalculator.cpp | 4 |
5 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 3c67c2ca088..b9a1c6dbeed 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/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 = cast<const ConstPoolVal>(V)) { + if (const ConstPoolVal *CPV = dyn_cast<const ConstPoolVal>(V)) { processConstant(CPV); - } else if (const Type *Ty = cast<const Type>(V)) { + } else if (const Type *Ty = dyn_cast<const Type>(V)) { Out << "\t%" << I->first << " = type " << Ty->getDescription() << endl; } } diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp index 7d97c85f7de..81c1f11616e 100644 --- a/llvm/lib/VMCore/BasicBlock.cpp +++ b/llvm/lib/VMCore/BasicBlock.cpp @@ -77,7 +77,7 @@ void BasicBlock::dropAllReferences() { // bool BasicBlock::hasConstantPoolReferences() const { for (use_const_iterator I = use_begin(), E = use_end(); I != E; ++I) - if ((*I)->isConstant()) + if (::isa<ConstPoolVal>(*I)) return true; return false; diff --git a/llvm/lib/VMCore/ConstPoolVals.cpp b/llvm/lib/VMCore/ConstPoolVals.cpp index 374c583ab9b..bf538bd2516 100644 --- a/llvm/lib/VMCore/ConstPoolVals.cpp +++ b/llvm/lib/VMCore/ConstPoolVals.cpp @@ -51,7 +51,9 @@ ConstPoolVal *ConstPoolVal::getNullConstant(const Type *Ty) { } } - +bool ConstPoolInt::isa(const ConstPoolVal *CPV) { + return CPV->getType()->isIntegral(); +} //===----------------------------------------------------------------------===// // ConstPoolXXX Classes diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index 5d1132f0a7d..9eb8277a272 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -28,7 +28,7 @@ template class ValueHolder<BasicBlock , Method, Method>; Method::Method(const MethodType *Ty, const string &name) : Value(Ty, Value::MethodVal, name), SymTabValue(this), BasicBlocks(this), ArgumentList(this, this) { - assert(Ty->isMethodType() && "Method signature must be of method type!"); + assert(::isa<MethodType>(Ty) && "Method signature must be of method type!"); Parent = 0; } diff --git a/llvm/lib/VMCore/SlotCalculator.cpp b/llvm/lib/VMCore/SlotCalculator.cpp index d0f37fb723e..38980e5e63a 100644 --- a/llvm/lib/VMCore/SlotCalculator.cpp +++ b/llvm/lib/VMCore/SlotCalculator.cpp @@ -106,7 +106,7 @@ void SlotCalculator::processSymbolTableConstants(const SymbolTable *ST) { for (SymbolTable::const_iterator I = ST->begin(), E = ST->end(); I != E; ++I) for (SymbolTable::type_const_iterator TI = I->second.begin(), TE = I->second.end(); TI != TE; ++TI) - if (TI->second->isConstant()) + if (isa<ConstPoolVal>(TI->second)) insertValue(TI->second); } @@ -223,7 +223,7 @@ int SlotCalculator::getValSlot(const Value *D) const { int SlotCalculator::insertValue(const Value *D) { - if (D->isConstant() || D->isGlobal()) { + if (isa<ConstPoolVal>(D) || isa<GlobalVariable>(D)) { const User *U = (const User *)D; // This makes sure that if a constant has uses (for example an array // of const ints), that they are inserted also. Same for global variable |