[PATCH] D62112: [ORC] fix use-after-move
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 19 18:10:28 PDT 2019
nickdesaulniers created this revision.
nickdesaulniers added a reviewer: lhames.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
nickdesaulniers updated this revision to Diff 200191.
nickdesaulniers added a comment.
- git-clang-format HEAD~
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D62112
Files:
llvm/lib/ExecutionEngine/Orc/Layer.cpp
Index: llvm/lib/ExecutionEngine/Orc/Layer.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/Layer.cpp
+++ llvm/lib/ExecutionEngine/Orc/Layer.cpp
@@ -87,17 +87,15 @@
#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";
}););
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62112.200191.patch
Type: text/x-patch
Size: 953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190520/ce6addc3/attachment.bin>
More information about the llvm-commits
mailing list