[PATCH] D62139: Ensuring unique names for JITDylib's

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 20:22:12 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL361215: [ORC] Assert that JITDylibs have unique names. (authored by lhames, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62139?vs=200362&id=200392#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62139/new/

https://reviews.llvm.org/D62139

Files:
  llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
  llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp


Index: llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
===================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
+++ llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
@@ -1610,8 +1610,18 @@
   return runSessionLocked([this]() -> JITDylib & { return *JDs.front(); });
 }
 
+JITDylib *ExecutionSession::getJITDylibByName(StringRef 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/trunk/include/llvm/ExecutionEngine/Orc/Core.h
===================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
@@ -726,6 +726,10 @@
   /// the ExecutionSession.
   JITDylib &getMainJITDylib();
 
+  /// Return a pointer to the "name" JITDylib.
+  /// Ownership of JITDylib remains within Execution Session
+  JITDylib *getJITDylibByName(StringRef 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.200392.patch
Type: text/x-patch
Size: 1576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190521/8593edc3/attachment.bin>


More information about the llvm-commits mailing list