summaryrefslogtreecommitdiff
path: root/include/llvm/User.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/User.h')
-rw-r--r--include/llvm/User.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/llvm/User.h b/include/llvm/User.h
index 570f381d1a..919693e082 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<Constant>((const Value*)this) ||
+ isa<GlobalValue>((const Value*)this)) &&
+ "Cannot mutate a constant with setOperand!");
OperandList[i] = Val;
}
unsigned getNumOperands() const { return NumOperands; }