Skip to content

Commit

Permalink
[ORC] fix use-after-move. NFC
Browse files Browse the repository at this point in the history
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

llvm-svn: 361203
  • Loading branch information
nickdesaulniers committed May 20, 2019
1 parent 6dd08e3 commit 28e351a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions llvm/lib/ExecutionEngine/Orc/Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}););
}

Expand Down

0 comments on commit 28e351a

Please sign in to comment.