diff options
author | John Criswell <criswell@uiuc.edu> | 2004-04-14 14:49:36 +0000 |
---|---|---|
committer | John Criswell <criswell@uiuc.edu> | 2004-04-14 14:49:36 +0000 |
commit | 17f64258cf33f4a2900299238758a746d70ecc14 (patch) | |
tree | f117ac0ab3450e0f6b43955a961a9541fa7e42d7 /lib | |
parent | 5365b6d143fe5f1463a512ba98be9ce348046de6 (diff) |
Added code to verify that llvm.readio's pointer argument returns something
that matches its return type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12944 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index fc237e69e5..89017d691c 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -638,15 +638,20 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { 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; |