diff options
author | Chris Lattner <sabre@nondot.org> | 2005-02-24 16:58:29 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-02-24 16:58:29 +0000 |
commit | aab1820816facf83d7bda8f01e3d85ced99601f3 (patch) | |
tree | d1944adcc099c69dfb332463b9a3b809de1e1530 | |
parent | 860598a29526f84c2df0a3e4584b82e1bcd2fe9a (diff) |
Fix some problems where the verifier would crash on invalid input instead of
reporting the problem and exiting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20302 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 9 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 5406c833a2..b42ccc1847 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -755,9 +755,12 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) { void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType, bool PrintName) { - assert(Operand != 0 && "Illegal Operand"); - if (PrintType) { Out << ' '; printType(Operand->getType()); } - WriteAsOperandInternal(Out, Operand, PrintName, TypeNames, &Machine); + if (Operand != 0) { + if (PrintType) { Out << ' '; printType(Operand->getType()); } + WriteAsOperandInternal(Out, Operand, PrintName, TypeNames, &Machine); + } else { + Out << "<null operand!>"; + } } diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index ad1074d8d3..4fae3b72d1 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -592,6 +592,7 @@ void Verifier::visitInstruction(Instruction &I) { for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) { // Check to make sure that the "address of" an intrinsic function is never // taken. + Assert1(I.getOperand(i) != 0, "Instruction has null operand!", &I); if (Function *F = dyn_cast<Function>(I.getOperand(i))) { Assert1(!F->isIntrinsic() || (i == 0 && isa<CallInst>(I)), "Cannot take the address of an intrinsic!", &I); |