Fix the conditions to unambiguously show the logic they represent. This is the
authorChandler Carruth <chandlerc@gmail.com>
Wed, 20 Jan 2010 06:01:02 +0000 (06:01 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 20 Jan 2010 06:01:02 +0000 (06:01 +0000)
logic enforced in the test case as well, so hopefully it is correct. Please
review Victor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93980 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Metadata.cpp

index 822dbd9521d289d0ccbf8eb1384befffe6d7d682..b4a981f3a02677339a3479ec786527d16f7d52bd 100644 (file)
@@ -159,10 +159,10 @@ const Function *MDNode::getFunction() const {
 
   for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
     if (Value *V = getOperand(i)) {
-      if (MDNode *MD = dyn_cast<MDNode>(V))
+      if (MDNode *MD = dyn_cast<MDNode>(V)) {
         if (const Function *F = MD->getFunction()) return F;
-      else
-        return getFunctionForValue(V);
+        else return getFunctionForValue(V);
+      }
     }
   }
   return NULL;