From d0b2ff9b7a11d9df9a7b078a0042c2eacf44d361 Mon Sep 17 00:00:00 2001 From: Victor Hernandez Date: Wed, 20 Jan 2010 06:22:33 +0000 Subject: [PATCH] Fix if/else brackets; getFunctionForValue() is to be called for non-metadata values llvm-svn: 93984 --- llvm/lib/VMCore/Metadata.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/lib/VMCore/Metadata.cpp b/llvm/lib/VMCore/Metadata.cpp index b4a981f3a026..acc3b8ee5ef0 100644 --- a/llvm/lib/VMCore/Metadata.cpp +++ b/llvm/lib/VMCore/Metadata.cpp @@ -122,6 +122,7 @@ MDNode::~MDNode() { } static const Function *getFunctionForValue(Value *V) { + assert(!isa(V) && "does not iterate over metadata operands"); if (!V) return NULL; if (Instruction *I = dyn_cast(V)) return I->getParent()->getParent(); @@ -161,7 +162,8 @@ const Function *MDNode::getFunction() const { if (Value *V = getOperand(i)) { if (MDNode *MD = dyn_cast(V)) { if (const Function *F = MD->getFunction()) return F; - else return getFunctionForValue(V); + } else { + return getFunctionForValue(V); } } }