From: Nick Desaulniers Date: Mon, 20 May 2019 22:17:43 +0000 (+0000) Subject: [ORC] fix use-after-move. NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0fbbfa80995bd96413978f741a2c73b3f91510e8;p=llvm [ORC] fix use-after-move. NFC 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 --- diff --git a/lib/ExecutionEngine/Orc/Layer.cpp b/lib/ExecutionEngine/Orc/Layer.cpp index 73470bf18c5..3ed2dabf454 100644 --- a/lib/ExecutionEngine/Orc/Layer.cpp +++ b/lib/ExecutionEngine/Orc/Layer.cpp @@ -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"; });); }