From 6ac3fe2ab7f261fed8a34e3d0e705055e8c7f64e Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Wed, 28 Oct 2015 20:08:51 +0000 Subject: [PATCH] [Orc] Require target support for host before running execution unit tests. Orc unit tests that execute code shouldn't run if the compiler doesn't have target support for the host machine. llvm-svn: 251551 --- llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h index 875db202a20e..bfdaced05b14 100644 --- a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h +++ b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h @@ -44,12 +44,15 @@ public: 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 TM; + if (TT.getArch() != Triple::x86_64 || !TT.isOSDarwin()) + return nullptr; - return nullptr; + return TM; } private: