mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-17 00:27:31 +00:00
Assert to bounds check MDNode::getOperand.
The getOperandPtr utility already bounds checks, but allows one-off-the-end. This assert should catch the cases that could previously have been dereferencing these one-off-the-end pointer. Happily, no cases of this came up with this change. llvm-svn: 176721
This commit is contained in:
parent
934c99e905
commit
e0efb3660f
@ -303,6 +303,7 @@ void MDNode::deleteTemporary(MDNode *N) {
|
||||
|
||||
/// getOperand - Return specified operand.
|
||||
Value *MDNode::getOperand(unsigned i) const {
|
||||
assert(i < getNumOperands() && "Invalid operand number");
|
||||
return *getOperandPtr(const_cast<MDNode*>(this), i);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user