[llvm] r330020 - [llvm-exegesis][NFC] Add more logging in case target creation fails.

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 13 07:29:52 PDT 2018


Author: courbet
Date: Fri Apr 13 07:29:52 2018
New Revision: 330020

URL: http://llvm.org/viewvc/llvm-project?rev=330020&view=rev
Log:
[llvm-exegesis][NFC] Add more logging in case target creation fails.

Modified:
    llvm/trunk/unittests/tools/llvm-exegesis/X86/InMemoryAssemblerTest.cpp

Modified: llvm/trunk/unittests/tools/llvm-exegesis/X86/InMemoryAssemblerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/tools/llvm-exegesis/X86/InMemoryAssemblerTest.cpp?rev=330020&r1=330019&r2=330020&view=diff
==============================================================================
--- llvm/trunk/unittests/tools/llvm-exegesis/X86/InMemoryAssemblerTest.cpp (original)
+++ llvm/trunk/unittests/tools/llvm-exegesis/X86/InMemoryAssemblerTest.cpp Fri Apr 13 07:29:52 2018
@@ -49,11 +49,13 @@ protected:
     std::string Error;
     const llvm::Target *TheTarget =
         llvm::TargetRegistry::lookupTarget(TT, Error);
-    assert(TheTarget);
+    EXPECT_TRUE(TheTarget) << Error << " " << TT;
     const llvm::TargetOptions Options;
+    llvm::TargetMachine* TM = TheTarget->createTargetMachine(
+            TT, CpuName, "", Options, llvm::Reloc::Model::Static);
+    EXPECT_TRUE(TM) << TT << " " << CpuName;
     return std::unique_ptr<llvm::LLVMTargetMachine>(
-        static_cast<llvm::LLVMTargetMachine *>(TheTarget->createTargetMachine(
-            TT, CpuName, "", Options, llvm::Reloc::Model::Static)));
+        static_cast<llvm::LLVMTargetMachine *>(TM));
   }
 
   bool IsSupportedTarget() const {




More information about the llvm-commits mailing list