Scope a varible inside an if statement, to make it clear that
authorDan Gohman <gohman@apple.com>
Tue, 28 Sep 2010 21:02:55 +0000 (21:02 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 28 Sep 2010 21:02:55 +0000 (21:02 +0000)
it's not used afterwards.

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

lib/VMCore/Metadata.cpp

index da69c43ff7359fafc2094a95d48bd235a3c7dcbf..162884c5f689e6289a35d4cba54d5711db1e63f2 100644 (file)
@@ -343,9 +343,7 @@ void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
   FoldingSetNodeID ID;
   Profile(ID);
   void *InsertPoint;
-  MDNode *N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
-
-  if (N) {
+  if (MDNode *N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint)) {
     N->replaceAllUsesWith(this);
     N->destroy();
     N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);