From 736ceace11249da645ec4ed91b8714832193ead4 Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Fri, 5 Oct 2012 03:31:58 +0000 Subject: tblgen: Replace uses of dynamic_cast with dyn_cast<>. This is a mechanical change of dynamic_cast<> to dyn_cast<>. A number of these uses are actually more like isa<> or cast<>, and will be changed to the semanticaly appropriate one in a future patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165291 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/TableGen/Record.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'lib/TableGen/Record.cpp') diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp index 9955617aa8..e51ae44627 100644 --- a/lib/TableGen/Record.cpp +++ b/lib/TableGen/Record.cpp @@ -113,9 +113,9 @@ Init *BitRecTy::convertValue(IntInit *II) { Init *BitRecTy::convertValue(TypedInit *VI) { RecTy *Ty = VI->getType(); - if (dynamic_cast(Ty) || - dynamic_cast(Ty) || - dynamic_cast(Ty)) + if (dyn_cast(Ty) || + dyn_cast(Ty) || + dyn_cast(Ty)) return VI; // Accept variable if it is already of bit type! return 0; } @@ -181,7 +181,7 @@ Init *BitsRecTy::convertValue(BitsInit *BI) { } Init *BitsRecTy::convertValue(TypedInit *VI) { - if (Size == 1 && dynamic_cast(VI->getType())) + if (Size == 1 && dyn_cast(VI->getType())) return BitsInit::get(VI); if (VI->getType()->typeIsConvertibleTo(this)) { @@ -243,7 +243,7 @@ Init *StringRecTy::convertValue(BinOpInit *BO) { Init *StringRecTy::convertValue(TypedInit *TI) { - if (dynamic_cast(TI->getType())) + if (dyn_cast(TI->getType())) return TI; // Accept variable if already of the right type! return 0; } @@ -263,7 +263,7 @@ Init *ListRecTy::convertValue(ListInit *LI) { else return 0; - ListRecTy *LType = dynamic_cast(LI->getType()); + ListRecTy *LType = dyn_cast(LI->getType()); if (LType == 0) { return 0; } @@ -273,7 +273,7 @@ Init *ListRecTy::convertValue(ListInit *LI) { Init *ListRecTy::convertValue(TypedInit *TI) { // Ensure that TI is compatible with our class. - if (ListRecTy *LRT = dynamic_cast(TI->getType())) + if (ListRecTy *LRT = dyn_cast(TI->getType())) if (LRT->getElementType()->typeIsConvertibleTo(getElementType())) return TI; return 0; @@ -309,7 +309,7 @@ Init *DagRecTy::convertValue(BinOpInit *BO) { } RecordRecTy *RecordRecTy::get(Record *R) { - return &dynamic_cast(*R->getDefInit()->getType()); + return dyn_cast(R->getDefInit()->getType()); } std::string RecordRecTy::getAsString() const { @@ -325,7 +325,7 @@ Init *RecordRecTy::convertValue(DefInit *DI) { Init *RecordRecTy::convertValue(TypedInit *TI) { // Ensure that TI is compatible with Rec. - if (RecordRecTy *RRT = dynamic_cast(TI->getType())) + if (RecordRecTy *RRT = dyn_cast(TI->getType())) if (RRT->getRecord()->isSubClassOf(getRecord()) || RRT->getRecord() == getRecord()) return TI; @@ -354,7 +354,7 @@ RecTy *llvm::resolveTypes(RecTy *T1, RecTy *T2) { return T1; // If one is a Record type, check superclasses - if (RecordRecTy *RecTy1 = dynamic_cast(T1)) { + if (RecordRecTy *RecTy1 = dyn_cast(T1)) { // See if T2 inherits from a type T1 also inherits from const std::vector &T1SuperClasses = RecTy1->getRecord()->getSuperClasses(); @@ -372,7 +372,7 @@ RecTy *llvm::resolveTypes(RecTy *T1, RecTy *T2) { } } } - if (RecordRecTy *RecTy2 = dynamic_cast(T2)) { + if (RecordRecTy *RecTy2 = dyn_cast(T2)) { // See if T1 inherits from a type T2 also inherits from const std::vector &T2SuperClasses = RecTy2->getRecord()->getSuperClasses(); @@ -599,7 +599,7 @@ ListInit *ListInit::get(ArrayRef Range, RecTy *EltTy) { } void ListInit::Profile(FoldingSetNodeID &ID) const { - ListRecTy *ListType = dynamic_cast(getType()); + ListRecTy *ListType = dyn_cast(getType()); assert(ListType && "Bad type for ListInit!"); RecTy *EltTy = ListType->getElementType(); @@ -1039,8 +1039,8 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type, DagInit *MHSd = dynamic_cast(MHS); ListInit *MHSl = dynamic_cast(MHS); - DagRecTy *DagType = dynamic_cast(Type); - ListRecTy *ListType = dynamic_cast(Type); + DagRecTy *DagType = dyn_cast(Type); + ListRecTy *ListType = dyn_cast(Type); OpInit *RHSo = dynamic_cast(RHS); @@ -1235,7 +1235,7 @@ std::string TernOpInit::getAsString() const { } RecTy *TypedInit::getFieldType(const std::string &FieldName) const { - RecordRecTy *RecordType = dynamic_cast(getType()); + RecordRecTy *RecordType = dyn_cast(getType()); if (RecordType) { RecordVal *Field = RecordType->getRecord()->getValue(FieldName); if (Field) { @@ -1247,7 +1247,7 @@ RecTy *TypedInit::getFieldType(const std::string &FieldName) const { Init * TypedInit::convertInitializerBitRange(const std::vector &Bits) const { - BitsRecTy *T = dynamic_cast(getType()); + BitsRecTy *T = dyn_cast(getType()); if (T == 0) return 0; // Cannot subscript a non-bits variable. unsigned NumBits = T->getNumBits(); @@ -1263,7 +1263,7 @@ TypedInit::convertInitializerBitRange(const std::vector &Bits) const { Init * TypedInit::convertInitListSlice(const std::vector &Elements) const { - ListRecTy *T = dynamic_cast(getType()); + ListRecTy *T = dyn_cast(getType()); if (T == 0) return 0; // Cannot subscript a non-list variable. if (Elements.size() == 1) @@ -1336,7 +1336,7 @@ Init *VarInit::resolveListElementReference(Record &R, RecTy *VarInit::getFieldType(const std::string &FieldName) const { - if (RecordRecTy *RTy = dynamic_cast(getType())) + if (RecordRecTy *RTy = dyn_cast(getType())) if (const RecordVal *RV = RTy->getRecord()->getValue(FieldName)) return RV->getType(); return 0; @@ -1344,7 +1344,7 @@ RecTy *VarInit::getFieldType(const std::string &FieldName) const { Init *VarInit::getFieldInit(Record &R, const RecordVal *RV, const std::string &FieldName) const { - if (dynamic_cast(getType())) + if (dyn_cast(getType())) if (const RecordVal *Val = R.getValue(VarName)) { if (RV != Val && (RV || dynamic_cast(Val->getValue()))) return 0; @@ -1655,7 +1655,7 @@ void Record::checkName() { const TypedInit *TypedName = dynamic_cast(Name); assert(TypedName && "Record name is not typed!"); RecTy *Type = TypedName->getType(); - if (dynamic_cast(Type) == 0) { + if (dyn_cast(Type) == 0) { throw TGError(getLoc(), "Record name is not a string!"); } } -- cgit v1.2.3-70-g09d2