[llvm] 5df428e - [Orc] Actually save the callback
Anubhab Ghosh via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 21 04:08:55 PDT 2022
Author: Anubhab Ghosh
Date: 2022-08-21T16:36:37+05:30
New Revision: 5df428eac37fddbe35c1a18d975ea836277708c1
URL: https://github.com/llvm/llvm-project/commit/5df428eac37fddbe35c1a18d975ea836277708c1
DIFF: https://github.com/llvm/llvm-project/commit/5df428eac37fddbe35c1a18d975ea836277708c1.diff
LOG: [Orc] Actually save the callback
The callback function was captured by reference but it lived on the
stack and was in danger of being overwritten and could cause a crash.
Differential Revision: https://reviews.llvm.org/D132313
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/MapperJITLinkMemoryManager.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/MapperJITLinkMemoryManager.cpp b/llvm/lib/ExecutionEngine/Orc/MapperJITLinkMemoryManager.cpp
index 587adbf71d241..c774e385c91e1 100644
--- a/llvm/lib/ExecutionEngine/Orc/MapperJITLinkMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/MapperJITLinkMemoryManager.cpp
@@ -12,8 +12,6 @@
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
#include "llvm/Support/Process.h"
-#include <limits>
-
using namespace llvm::jitlink;
namespace llvm {
@@ -34,7 +32,8 @@ class MapperJITLinkMemoryManager::InFlightAlloc
std::swap(AI.Segments, Segs);
std::swap(AI.Actions, G.allocActions());
- Parent.Mapper->initialize(AI, [&](Expected<ExecutorAddr> Result) {
+ Parent.Mapper->initialize(AI, [OnFinalize = std::move(OnFinalize)](
+ Expected<ExecutorAddr> Result) mutable {
if (!Result) {
OnFinalize(Result.takeError());
return;
More information about the llvm-commits
mailing list