From cfe26c930ae691ff3012736555846c45087e1a9e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 1 Oct 2001 18:26:53 +0000 Subject: 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 --- lib/Bytecode/Reader/ConstantReader.cpp | 5 ++--- lib/Bytecode/Reader/Reader.cpp | 4 ++-- lib/Bytecode/Writer/SlotCalculator.cpp | 6 +++--- lib/Bytecode/Writer/Writer.cpp | 3 ++- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/Bytecode') diff --git a/lib/Bytecode/Reader/ConstantReader.cpp b/lib/Bytecode/Reader/ConstantReader.cpp index ae206da..67cfff7 100644 --- a/lib/Bytecode/Reader/ConstantReader.cpp +++ b/lib/Bytecode/Reader/ConstantReader.cpp @@ -149,8 +149,7 @@ bool BytecodeParser::parseTypeConstants(const uchar *&Buf, const uchar *EndBuf, // abstract type to use the newty. This also will cause the opaque type // to be deleted... // - // FIXME when types are not const - const_cast(Tab[i+BaseLevel]->castDerivedTypeAsserting())->refineAbstractTypeTo(NewTy); + cast(Tab[i+BaseLevel].get())->refineAbstractTypeTo(NewTy); // This should have replace the old opaque type with the new type in the // value table... @@ -159,7 +158,7 @@ bool BytecodeParser::parseTypeConstants(const uchar *&Buf, const uchar *EndBuf, BCR_TRACE(5, "Resulting types:\n"); for (unsigned i = 0; i < NumEntries; i++) { - BCR_TRACE(5, Tab[i+BaseLevel]->castTypeAsserting() << "\n"); + BCR_TRACE(5, cast(Tab[i+BaseLevel]) << "\n"); } return false; } diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index a2038ed..b7904bb 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -55,7 +55,7 @@ const Type *BytecodeParser::getType(unsigned ID) { const Value *D = getValue(Type::TypeTy, ID, false); if (D == 0) return failure(0); - return D->castTypeAsserting(); + return cast(D); } bool BytecodeParser::insertValue(Value *Val, vector &ValueTab) { @@ -341,7 +341,7 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End, Value *V = getValue(Ty->castPointerType()->getValueType(), InitSlot, false); if (V == 0) return failure(true); - Initializer = V->castConstantAsserting(); + Initializer = cast(V); } // Create the global variable... diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index cac8f2e..d0f37fb 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/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(D)) && !isa(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(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(D)->getDescription() << "'!\n"; if (Typ->isDerivedType()) { int DefSlot = getValSlot(Typ); diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index 04a0ca4..94cbcec 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -84,7 +84,8 @@ void BytecodeWriter::outputConstants(bool isMethod) { unsigned NC = ValNo; // Number of constants for (; NC < Plane.size() && - (Plane[NC]->isConstant() || Plane[NC]->isType()); NC++) /*empty*/; + (isa(Plane[NC]) || + isa(Plane[NC])); NC++) /*empty*/; NC -= ValNo; // Convert from index into count if (NC == 0) continue; // Skip empty type planes... -- cgit v1.1