summaryrefslogtreecommitdiff
path: root/include/llvm/User.h
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2008-10-28 17:22:40 +0000
committerTanya Lattner <tonic@nondot.org>2008-10-28 17:22:40 +0000
commit803f5fc02f73651fecc342807939066b067b65b5 (patch)
treebdd271aa79674633a69e72caff7beaf4d29d5b37 /include/llvm/User.h
parent2b9cbf127fe009448b3cc4d98f2c5693a1866731 (diff)
downloadllvm-803f5fc02f73651fecc342807939066b067b65b5.tar.gz
llvm-803f5fc02f73651fecc342807939066b067b65b5.tar.bz2
llvm-803f5fc02f73651fecc342807939066b067b65b5.tar.xz
Do not allow a user to set the operand for a constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58335 91177308-0d34-0410-b5e6-96231b3b80d8
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; }