]> granicus.if.org Git - llvm/commitdiff
[ORC] fix use-after-move. NFC
authorNick Desaulniers <ndesaulniers@google.com>
Mon, 20 May 2019 22:17:43 +0000 (22:17 +0000)
committerNick Desaulniers <ndesaulniers@google.com>
Mon, 20 May 2019 22:17:43 +0000 (22:17 +0000)
Summary:
scan-build flagged a potential use-after-move in debug builds.  It's not
safe that a moved from value contains anything but garbage.  Manually
DRY up these repeated expressions.

Reviewers: lhames

Reviewed By: lhames

Subscribers: hiraditya, llvm-commits, srhines

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D62112

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

lib/ExecutionEngine/Orc/Layer.cpp

index 73470bf18c55a86efbc4657ae4df4d1b251b2883..3ed2dabf4545efaebc2affc96991ad35d4c7f8a6 100644 (file)
@@ -87,17 +87,15 @@ void BasicIRLayerMaterializationUnit::materialize(
 
 #ifndef NDEBUG
   auto &ES = R.getTargetJITDylib().getExecutionSession();
+  auto &N = R.getTargetJITDylib().getName();
 #endif // NDEBUG
 
   auto Lock = TSM.getContextLock();
-  LLVM_DEBUG(ES.runSessionLocked([&]() {
-    dbgs() << "Emitting, for " << R.getTargetJITDylib().getName() << ", "
-           << *this << "\n";
-  }););
+  LLVM_DEBUG(ES.runSessionLocked(
+      [&]() { dbgs() << "Emitting, for " << N << ", " << *this << "\n"; }););
   L.emit(std::move(R), std::move(TSM));
   LLVM_DEBUG(ES.runSessionLocked([&]() {
-    dbgs() << "Finished emitting, for " << R.getTargetJITDylib().getName()
-           << ", " << *this << "\n";
+    dbgs() << "Finished emitting, for " << N << ", " << *this << "\n";
   }););
 }