Start catching LLVMContext misuse in the verifier.
authorNick Lewycky <nicholas@mxc.ca>
Mon, 23 Nov 2009 04:52:00 +0000 (04:52 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Mon, 23 Nov 2009 04:52:00 +0000 (04:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89646 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Verifier.cpp

index 7ab7b1516844d95091a2a0494fcee69ceb0c6c79..7aa86b776c76120268c392bf525bc79f2894bc07 100644 (file)
@@ -1475,6 +1475,9 @@ void Verifier::visitInstruction(Instruction &I) {
 void Verifier::VerifyType(const Type *Ty) {
   if (!Types.insert(Ty)) return;
 
+  Assert1(&Mod->getContext() == &Ty->getContext(),
+          "Type context does not match Module context!", Ty);
+
   switch (Ty->getTypeID()) {
   case Type::FunctionTyID: {
     const FunctionType *FTy = cast<FunctionType>(Ty);