[ORC] Add NullResolver
authorJoseph Tremoulet <jotrem@microsoft.com>
Mon, 22 Jun 2015 15:27:58 +0000 (15:27 +0000)
committerJoseph Tremoulet <jotrem@microsoft.com>
Mon, 22 Jun 2015 15:27:58 +0000 (15:27 +0000)
Summary:
This is an implementation of RuntimeDyld::SymbolResolver that simply
rejects all resolution requests; useful for clients that do not have any
cross-object symbol references.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D10455

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240288 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ExecutionEngine/Orc/NullResolver.h [new file with mode: 0644]
lib/ExecutionEngine/Orc/CMakeLists.txt
lib/ExecutionEngine/Orc/NullResolver.cpp [new file with mode: 0644]

diff --git a/include/llvm/ExecutionEngine/Orc/NullResolver.h b/include/llvm/ExecutionEngine/Orc/NullResolver.h
new file mode 100644 (file)
index 0000000..df1d9e8
--- /dev/null
@@ -0,0 +1,36 @@
+//===------ NullResolver.h - Reject symbol lookup requests ------*- C++ -*-===//\r
+//\r
+//                     The LLVM Compiler Infrastructure\r
+//\r
+// This file is distributed under the University of Illinois Open Source\r
+// License. See LICENSE.TXT for details.\r
+//\r
+//===----------------------------------------------------------------------===//\r
+//\r
+//   Defines a RuntimeDyld::SymbolResolver subclass that rejects all symbol\r
+// resolution requests, for clients that have no cross-object fixups.\r
+//\r
+//===----------------------------------------------------------------------===//\r
+\r
+#ifndef LLVM_EXECUTIONENGINE_ORC_NULLRESOLVER_H\r
+#define LLVM_EXECUTIONENGINE_ORC_NULLRESOLVER_H\r
+\r
+#include "llvm/ExecutionEngine/RuntimeDyld.h"\r
+\r
+namespace llvm {\r
+namespace orc {\r
+\r
+/// SymbolResolver impliementation that rejects all resolution requests.\r
+/// Useful for clients that have no cross-object fixups.\r
+class NullResolver : public RuntimeDyld::SymbolResolver {\r
+public:\r
+  RuntimeDyld::SymbolInfo findSymbol(const std::string &Name) final;\r
+\r
+  RuntimeDyld::SymbolInfo\r
+  findSymbolInLogicalDylib(const std::string &Name) final;\r
+};\r
+\r
+} // End namespace orc.\r
+} // End namespace llvm.\r
+\r
+#endif // LLVM_EXECUTIONENGINE_ORC_NULLRESOLVER_H\r
index 1da164237a67c0aec74fc7aec843d98ffbda903f..05fb5a30bcdb1e43a8ec4888988d6949e9560386 100644 (file)
@@ -1,12 +1,13 @@
-add_llvm_library(LLVMOrcJIT
-  ExecutionUtils.cpp
-  IndirectionUtils.cpp
-  OrcMCJITReplacement.cpp
-  OrcTargetSupport.cpp
-
-  ADDITIONAL_HEADER_DIRS
-  ${LLVM_MAIN_INCLUDE_DIR}/llvm/ExecutionEngine/Orc
-
-  DEPENDS
-  intrinsics_gen
-  )
+add_llvm_library(LLVMOrcJIT\r
+  ExecutionUtils.cpp\r
+  IndirectionUtils.cpp\r
+  NullResolver.cpp\r
+  OrcMCJITReplacement.cpp\r
+  OrcTargetSupport.cpp\r
+\r
+  ADDITIONAL_HEADER_DIRS\r
+  ${LLVM_MAIN_INCLUDE_DIR}/llvm/ExecutionEngine/Orc\r
+\r
+  DEPENDS\r
+  intrinsics_gen\r
+  )\r
diff --git a/lib/ExecutionEngine/Orc/NullResolver.cpp b/lib/ExecutionEngine/Orc/NullResolver.cpp
new file mode 100644 (file)
index 0000000..5b91b0a
--- /dev/null
@@ -0,0 +1,27 @@
+//===---------- NullResolver.cpp - Reject symbol lookup requests ----------===//\r
+//\r
+//                     The LLVM Compiler Infrastructure\r
+//\r
+// This file is distributed under the University of Illinois Open Source\r
+// License. See LICENSE.TXT for details.\r
+//\r
+//===----------------------------------------------------------------------===//\r
+\r
+#include "llvm/ExecutionEngine/Orc/NullResolver.h"\r
+\r
+#include "llvm/Support/ErrorHandling.h"\r
+\r
+namespace llvm {\r
+namespace orc {\r
+\r
+RuntimeDyld::SymbolInfo NullResolver::findSymbol(const std::string &Name) {\r
+  llvm_unreachable("Unexpected cross-object symbol reference");\r
+}\r
+\r
+RuntimeDyld::SymbolInfo\r
+NullResolver::findSymbolInLogicalDylib(const std::string &Name) {\r
+  llvm_unreachable("Unexpected cross-object symbol reference");\r
+}\r
+\r
+} // End namespace orc.\r
+} // End namespace llvm.\r