Orc unit tests that execute code shouldn't run if the compiler doesn't have
target support for the host machine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251551
91177308-0d34-0410-b5e6-
96231b3b80d8
std::unique_ptr<TargetMachine> getHostTargetMachineIfSupported() {
std::unique_ptr<TargetMachine> 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: