diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
commit | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch) | |
tree | 5343938942df402b49ec7300a1c25a2d4ccd5821 /unittests/ExecutionEngine/Orc/OrcTestCommon.h | |
parent | 31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff) |
Diffstat (limited to 'unittests/ExecutionEngine/Orc/OrcTestCommon.h')
-rw-r--r-- | unittests/ExecutionEngine/Orc/OrcTestCommon.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/unittests/ExecutionEngine/Orc/OrcTestCommon.h b/unittests/ExecutionEngine/Orc/OrcTestCommon.h index f3972a3084e5..7fb26634c7a7 100644 --- a/unittests/ExecutionEngine/Orc/OrcTestCommon.h +++ b/unittests/ExecutionEngine/Orc/OrcTestCommon.h @@ -28,17 +28,29 @@ namespace llvm { -// Base class for Orc tests that will execute code. -class OrcExecutionTest { +class OrcNativeTarget { public: - - OrcExecutionTest() { + static void initialize() { if (!NativeTargetInitialized) { InitializeNativeTarget(); InitializeNativeTargetAsmParser(); InitializeNativeTargetAsmPrinter(); NativeTargetInitialized = true; } + } + +private: + static bool NativeTargetInitialized; +}; + +// Base class for Orc tests that will execute code. +class OrcExecutionTest { +public: + + OrcExecutionTest() { + + // Initialize the native target if it hasn't been done already. + OrcNativeTarget::initialize(); // Try to select a TargetMachine for the host. TM.reset(EngineBuilder().selectTarget()); @@ -56,8 +68,6 @@ public: protected: LLVMContext Context; std::unique_ptr<TargetMachine> TM; -private: - static bool NativeTargetInitialized; }; class ModuleBuilder { |