[llvm] f420d26 - [ORC] Make ObjectLinkingLayerJITLinkContext a private nested class.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 15 21:56:41 PST 2024


Author: Lang Hames
Date: 2024-12-16T16:56:33+11:00
New Revision: f420d26e9dd7ff6aed435f86e7d6768501a29741

URL: https://github.com/llvm/llvm-project/commit/f420d26e9dd7ff6aed435f86e7d6768501a29741
DIFF: https://github.com/llvm/llvm-project/commit/f420d26e9dd7ff6aed435f86e7d6768501a29741.diff

LOG: [ORC] Make ObjectLinkingLayerJITLinkContext a private nested class.

This class is an implementation detail, so doesn't need a publicly accessible
name.

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
    llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h b/llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
index 6e0c46bfa8c4a4..340298f8c52856 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
@@ -39,8 +39,6 @@ class Symbol;
 
 namespace orc {
 
-class ObjectLinkingLayerJITLinkContext;
-
 /// An ObjectLayer implementation built on JITLink.
 ///
 /// Clients can use this class to add relocatable object files to an
@@ -48,7 +46,7 @@ class ObjectLinkingLayerJITLinkContext;
 /// a compiling layer like IRCompileLayer) for the rest of the JIT.
 class ObjectLinkingLayer : public RTTIExtends<ObjectLinkingLayer, ObjectLayer>,
                            private ResourceManager {
-  friend class ObjectLinkingLayerJITLinkContext;
+  class JITLinkCtx;
 
 public:
   static char ID;

diff  --git a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
index dd15499d4791f0..4630e62bef74f6 100644
--- a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
@@ -148,19 +148,18 @@ std::atomic<uint64_t> LinkGraphMaterializationUnit::Counter{0};
 namespace llvm {
 namespace orc {
 
-class ObjectLinkingLayerJITLinkContext final : public JITLinkContext {
+class ObjectLinkingLayer::JITLinkCtx final : public JITLinkContext {
 public:
-  ObjectLinkingLayerJITLinkContext(
-      ObjectLinkingLayer &Layer,
-      std::unique_ptr<MaterializationResponsibility> MR,
-      std::unique_ptr<MemoryBuffer> ObjBuffer)
+  JITLinkCtx(ObjectLinkingLayer &Layer,
+             std::unique_ptr<MaterializationResponsibility> MR,
+             std::unique_ptr<MemoryBuffer> ObjBuffer)
       : JITLinkContext(&MR->getTargetJITDylib()), Layer(Layer),
         MR(std::move(MR)), ObjBuffer(std::move(ObjBuffer)) {
     std::lock_guard<std::mutex> Lock(Layer.LayerMutex);
     Plugins = Layer.Plugins;
   }
 
-  ~ObjectLinkingLayerJITLinkContext() {
+  ~JITLinkCtx() {
     // If there is an object buffer return function then use it to
     // return ownership of the buffer.
     if (Layer.ReturnObjectBuffer && ObjBuffer)
@@ -624,8 +623,7 @@ void ObjectLinkingLayer::emit(std::unique_ptr<MaterializationResponsibility> R,
   assert(O && "Object must not be null");
   MemoryBufferRef ObjBuffer = O->getMemBufferRef();
 
-  auto Ctx = std::make_unique<ObjectLinkingLayerJITLinkContext>(
-      *this, std::move(R), std::move(O));
+  auto Ctx = std::make_unique<JITLinkCtx>(*this, std::move(R), std::move(O));
   if (auto G = createLinkGraphFromObject(
           ObjBuffer, getExecutionSession().getSymbolStringPool())) {
     Ctx->notifyMaterializing(**G);
@@ -637,8 +635,7 @@ void ObjectLinkingLayer::emit(std::unique_ptr<MaterializationResponsibility> R,
 
 void ObjectLinkingLayer::emit(std::unique_ptr<MaterializationResponsibility> R,
                               std::unique_ptr<LinkGraph> G) {
-  auto Ctx = std::make_unique<ObjectLinkingLayerJITLinkContext>(
-      *this, std::move(R), nullptr);
+  auto Ctx = std::make_unique<JITLinkCtx>(*this, std::move(R), nullptr);
   Ctx->notifyMaterializing(*G);
   link(std::move(G), std::move(Ctx));
 }


        


More information about the llvm-commits mailing list