[llvm-commits] [llvm] r58335 - /llvm/trunk/include/llvm/User.h
Tanya Lattner
tonic at nondot.org
Tue Oct 28 10:22:40 PDT 2008
Author: tbrethou
Date: Tue Oct 28 12:22:40 2008
New Revision: 58335
URL: http://llvm.org/viewvc/llvm-project?rev=58335&view=rev
Log:
Do not allow a user to set the operand for a constant.
Modified:
llvm/trunk/include/llvm/User.h
Modified: llvm/trunk/include/llvm/User.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/User.h?rev=58335&r1=58334&r2=58335&view=diff
==============================================================================
--- llvm/trunk/include/llvm/User.h (original)
+++ llvm/trunk/include/llvm/User.h Tue Oct 28 12:22:40 2008
@@ -95,6 +95,9 @@
}
void setOperand(unsigned i, Value *Val) {
assert(i < NumOperands && "setOperand() out of range!");
+ assert((!isa<Constant>((const Value*)this) ||
+ isa<GlobalValue>((const Value*)this)) &&
+ "Cannot mutate a constant with setOperand!");
OperandList[i] = Val;
}
unsigned getNumOperands() const { return NumOperands; }
More information about the llvm-commits
mailing list