diff options
-rw-r--r-- | lib/VMCore/Metadata.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index b4a981f..acc3b8e 100644 --- a/lib/VMCore/Metadata.cpp +++ b/lib/VMCore/Metadata.cpp @@ -122,6 +122,7 @@ MDNode::~MDNode() { } static const Function *getFunctionForValue(Value *V) { + assert(!isa<MDNode>(V) && "does not iterate over metadata operands"); if (!V) return NULL; if (Instruction *I = dyn_cast<Instruction>(V)) return I->getParent()->getParent(); @@ -161,7 +162,8 @@ const Function *MDNode::getFunction() const { if (Value *V = getOperand(i)) { if (MDNode *MD = dyn_cast<MDNode>(V)) { if (const Function *F = MD->getFunction()) return F; - else return getFunctionForValue(V); + } else { + return getFunctionForValue(V); } } } |