getOperandNum(): error if specified operand number is out of range.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28775 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2006-06-13 21:47:27 +00:00
parent 8b92d0cae1
commit 50c997e26a

View File

@ -121,6 +121,13 @@ TreePatternNode *SDTypeConstraint::getOperandNum(unsigned OpNo,
assert(NumResults <= 1 &&
"We only work with nodes with zero or one result so far!");
if (OpNo >= (NumResults + N->getNumChildren())) {
std::cerr << "Invalid operand number " << OpNo << " ";
N->dump();
std::cerr << '\n';
exit(1);
}
if (OpNo < NumResults)
return N; // FIXME: need value #
else