From 7bd0aec94269c9b981b175096fd6f52ea3301cfd Mon Sep 17 00:00:00 2001 From: Tanya Lattner Date: Tue, 28 Oct 2008 17:22:40 +0000 Subject: [PATCH] Do not allow a user to set the operand for a constant. llvm-svn: 58335 --- include/llvm/User.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/llvm/User.h b/include/llvm/User.h index 570f381d1a8..919693e0829 100644 --- a/include/llvm/User.h +++ b/include/llvm/User.h @@ -95,6 +95,9 @@ public: } void setOperand(unsigned i, Value *Val) { assert(i < NumOperands && "setOperand() out of range!"); + assert((!isa((const Value*)this) || + isa((const Value*)this)) && + "Cannot mutate a constant with setOperand!"); OperandList[i] = Val; } unsigned getNumOperands() const { return NumOperands; }