X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=unittests%2FExecutionEngine%2FOrc%2FOrcTestCommon.h;fp=unittests%2FExecutionEngine%2FOrc%2FOrcTestCommon.h;h=15d9f54a37fc59992394fad4098f016e49952314;hp=bfdaced05b14d9a50f8ad83eaf9321d3a028d11a;hb=df3ef600c0084faf378b97637ed69664b5413b81;hpb=e05ab1115067e9099797199cdf3b8233f5344018 diff --git a/unittests/ExecutionEngine/Orc/OrcTestCommon.h b/unittests/ExecutionEngine/Orc/OrcTestCommon.h index bfdaced05b1..15d9f54a37f 100644 --- a/unittests/ExecutionEngine/Orc/OrcTestCommon.h +++ b/unittests/ExecutionEngine/Orc/OrcTestCommon.h @@ -38,23 +38,20 @@ public: InitializeNativeTargetAsmPrinter(); NativeTargetInitialized = true; } - }; - - // Get a target machine for the host if it supports JIT execution. - std::unique_ptr getHostTargetMachineIfSupported() { - std::unique_ptr TM(EngineBuilder().selectTarget()); - - if (!TM) - return nullptr; - - const Triple& TT = TM->getTargetTriple(); - if (TT.getArch() != Triple::x86_64 || !TT.isOSDarwin()) - return nullptr; + // Try to select a TargetMachine for the host. + TM.reset(EngineBuilder().selectTarget()); - return TM; - } + if (TM) { + // If we found a TargetMachine, check that it's one that Orc supports. + const Triple& TT = TM->getTargetTriple(); + if (TT.getArch() != Triple::x86_64 || !TT.isOSDarwin()) + TM = nullptr; + } + }; +protected: + std::unique_ptr TM; private: static bool NativeTargetInitialized; };