[llvm-commits] [llvm] r47460 - in /llvm/trunk/lib/VMCore: Function.cpp Verifier.cpp

Devang Patel dpatel at apple.com
Thu Feb 21 14:24:18 PST 2008


Author: dpatel
Date: Thu Feb 21 16:24:17 2008
New Revision: 47460

URL: http://llvm.org/viewvc/llvm-project?rev=47460&view=rev
Log:
Use isa<> instead of getTypeID() to check StructType.

Modified:
    llvm/trunk/lib/VMCore/Function.cpp
    llvm/trunk/lib/VMCore/Verifier.cpp

Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=47460&r1=47459&r2=47460&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Thu Feb 21 16:24:17 2008
@@ -180,7 +180,7 @@
   SymTab = new ValueSymbolTable();
 
   assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy
-          || getReturnType()->getTypeID() == Type::StructTyID)
+          || isa<StructType>(getReturnType()))
          && "LLVM functions cannot return aggregate values!");
 
   // If the function has arguments, mark them as lazily built.

Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=47460&r1=47459&r2=47460&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Thu Feb 21 16:24:17 2008
@@ -452,7 +452,7 @@
           &F, FT);
   Assert1(F.getReturnType()->isFirstClassType() ||
           F.getReturnType() == Type::VoidTy || 
-          F.getReturnType()->getTypeID() == Type::StructTyID,
+          isa<StructType>(F.getReturnType()),
           "Functions cannot return aggregate values!", &F);
 
   Assert1(!F.isStructReturn() || FT->getReturnType() == Type::VoidTy,
@@ -1072,8 +1072,8 @@
   // 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<CallInst>(I) || isa<InvokeInst>(I))
-              && I.getType()->getTypeID() == Type::StructTyID),
+          || ((isa<CallInst>(I) || isa<InvokeInst>(I)) 
+              && isa<StructType>(I.getType())),
           "Instruction returns a non-scalar type!", &I);
 
   // Check that all uses of the instruction, if they are instructions
@@ -1095,14 +1095,13 @@
     // instructions.
     if (!I.getOperand(i)->getType()->isFirstClassType()) {
       if (isa<ReturnInst>(I) || isa<GetResultInst>(I))
-        Assert1(I.getOperand(i)->getType()->getTypeID() == Type::StructTyID,
+        Assert1(isa<StructType>(I.getOperand(i)->getType()),
                 "Invalid ReturnInst operands!", &I);
       else if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
         if (const PointerType *PT = dyn_cast<PointerType>
             (I.getOperand(i)->getType())) {
           const Type *ETy = PT->getElementType();
-          Assert1(ETy->getTypeID() == Type::StructTyID,
-                  "Invalid CallInst operands!", &I);
+          Assert1(isa<StructType>(ETy), "Invalid CallInst operands!", &I);
         }
         else
           Assert1(0, "Invalid CallInst operands!", &I);





More information about the llvm-commits mailing list