[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

John Criswell criswell at cs.uiuc.edu
Wed Apr 14 09:51:02 PDT 2004


Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.93 -> 1.94

---
Log message:

Added code to verify that llvm.readio's pointer argument returns something
that matches its return type.



---
Diffs of the changes:  (+8 -3)

Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.93 llvm/lib/VMCore/Verifier.cpp:1.94
--- llvm/lib/VMCore/Verifier.cpp:1.93	Wed Apr 14 08:46:52 2004
+++ llvm/lib/VMCore/Verifier.cpp	Wed Apr 14 09:49:36 2004
@@ -638,15 +638,20 @@
     NumArgs = 1;
     break;
 
-  case Intrinsic:: readio:
+  case Intrinsic:: readio: {
+    const Type * ParamType  = FT->getParamType(0);
+    const Type * ReturnType = FT->getReturnType();
+
     Assert1(FT->getNumParams() == 1,
             "Illegal # arguments for intrinsic function!", IF);
-    Assert1(FT->getReturnType()->isFirstClassType(),
+    Assert1(ReturnType->isFirstClassType(),
             "Return type is not a first class type!", IF);
-    Assert1(FT->getParamType(0)->getPrimitiveID() == Type::PointerTyID,
+    Assert1(ParamType->getPrimitiveID() == Type::PointerTyID,
             "First argument not a pointer!", IF);
+    Assert1(((dyn_cast<PointerType>(ParamType)->getContainedType(0)) == ReturnType), "Pointer type doesn't match return type!", IF);
     NumArgs = 1;
     break;
+  }
 
   case Intrinsic::setjmp:          NumArgs = 1; break;
   case Intrinsic::longjmp:         NumArgs = 2; break;





More information about the llvm-commits mailing list