From 298b5f1d6c8efb681a0c9a082dfaf6cdd4903729 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 21 Feb 2008 22:24:17 +0000 Subject: [PATCH] Use isa<> instead of getTypeID() to check StructType. llvm-svn: 47460 --- lib/VMCore/Function.cpp | 2 +- lib/VMCore/Verifier.cpp | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index ee386630d7d..49d770d5bd3 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -180,7 +180,7 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage, SymTab = new ValueSymbolTable(); assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy - || getReturnType()->getTypeID() == Type::StructTyID) + || isa(getReturnType())) && "LLVM functions cannot return aggregate values!"); // If the function has arguments, mark them as lazily built. diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 2eb306b264b..386ee090e01 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -452,7 +452,7 @@ void Verifier::visitFunction(Function &F) { &F, FT); Assert1(F.getReturnType()->isFirstClassType() || F.getReturnType() == Type::VoidTy || - F.getReturnType()->getTypeID() == Type::StructTyID, + isa(F.getReturnType()), "Functions cannot return aggregate values!", &F); Assert1(!F.isStructReturn() || FT->getReturnType() == Type::VoidTy, @@ -1072,8 +1072,8 @@ void Verifier::visitInstruction(Instruction &I) { // Check that the return value of the instruction is either void or a legal // value type. Assert1(I.getType() == Type::VoidTy || I.getType()->isFirstClassType() - || ((isa(I) || isa(I)) - && I.getType()->getTypeID() == Type::StructTyID), + || ((isa(I) || isa(I)) + && isa(I.getType())), "Instruction returns a non-scalar type!", &I); // Check that all uses of the instruction, if they are instructions @@ -1095,14 +1095,13 @@ void Verifier::visitInstruction(Instruction &I) { // instructions. if (!I.getOperand(i)->getType()->isFirstClassType()) { if (isa(I) || isa(I)) - Assert1(I.getOperand(i)->getType()->getTypeID() == Type::StructTyID, + Assert1(isa(I.getOperand(i)->getType()), "Invalid ReturnInst operands!", &I); else if (isa(I) || isa(I)) { if (const PointerType *PT = dyn_cast (I.getOperand(i)->getType())) { const Type *ETy = PT->getElementType(); - Assert1(ETy->getTypeID() == Type::StructTyID, - "Invalid CallInst operands!", &I); + Assert1(isa(ETy), "Invalid CallInst operands!", &I); } else Assert1(0, "Invalid CallInst operands!", &I);