[PATCH] D62139: Ensuring unique names for JITDylib's
Praveen velliengiri via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 20 14:41:48 PDT 2019
pree-jackie updated this revision to Diff 200362.
pree-jackie added a comment.
Updated Diff file
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62139/new/
https://reviews.llvm.org/D62139
Files:
llvm/include/llvm/ExecutionEngine/Orc/Core.h
llvm/lib/ExecutionEngine/Orc/Core.cpp
Index: llvm/lib/ExecutionEngine/Orc/Core.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -1610,8 +1610,19 @@
return runSessionLocked([this]() -> JITDylib & { return *JDs.front(); });
}
+JITDylib *ExecutionSession::getJITDylibByName(std::string Name) {
+ return runSessionLocked([&, this]() -> JITDylib * {
+ for (auto &JD : JDs) {
+ if (JD->getName() == Name)
+ return JD.get();
+ }
+ return nullptr;
+ });
+}
+
JITDylib &ExecutionSession::createJITDylib(std::string Name,
bool AddToMainDylibSearchOrder) {
+ assert(!getJITDylibByName(Name) && "JITDylib with that name already exists");
return runSessionLocked([&, this]() -> JITDylib & {
JDs.push_back(
std::unique_ptr<JITDylib>(new JITDylib(*this, std::move(Name))));
Index: llvm/include/llvm/ExecutionEngine/Orc/Core.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/Orc/Core.h
+++ llvm/include/llvm/ExecutionEngine/Orc/Core.h
@@ -726,6 +726,9 @@
/// the ExecutionSession.
JITDylib &getMainJITDylib();
+ /// Return a pointer to the "name" JITDylib.
+ /// Ownership of JITDylib remains within Execution Session
+ JITDylib *getJITDylibByName(std::string Name);
/// Add a new JITDylib to this ExecutionSession.
JITDylib &createJITDylib(std::string Name,
bool AddToMainDylibSearchOrder = true);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62139.200362.patch
Type: text/x-patch
Size: 1550 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190520/4a12f071/attachment.bin>
More information about the llvm-commits
mailing list