[llvm-rtdyld] Turn assertion into errors, it seems more appropriate.
authorDavide Italiano <davide@freebsd.org>
Sat, 21 Nov 2015 05:49:07 +0000 (05:49 +0000)
committerDavide Italiano <davide@freebsd.org>
Sat, 21 Nov 2015 05:49:07 +0000 (05:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253766 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-rtdyld/llvm-rtdyld.cpp

index 689fb10..d0e4a44 100644 (file)
@@ -610,19 +610,23 @@ static int linkAndVerify() {
 
   std::unique_ptr<MCSubtargetInfo> STI(
     TheTarget->createMCSubtargetInfo(TripleName, MCPU, ""));
-  assert(STI && "Unable to create subtarget info!");
+  if (!STI)
+    return Error("Unable to create subtarget info!");
 
   std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TripleName));
-  assert(MRI && "Unable to create target register info!");
+  if (!MRI)
+    return Error("Unable to create target register info!");
 
   std::unique_ptr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*MRI, TripleName));
-  assert(MAI && "Unable to create target asm info!");
+  if (!MAI)
+    return Error("Unable to create target asm info!");
 
   MCContext Ctx(MAI.get(), MRI.get(), nullptr);
 
   std::unique_ptr<MCDisassembler> Disassembler(
     TheTarget->createMCDisassembler(*STI, Ctx));
-  assert(Disassembler && "Unable to create disassembler!");
+  if (!Disassembler)
+    return Error("Unable to create disassembler!");
 
   std::unique_ptr<MCInstrInfo> MII(TheTarget->createMCInstrInfo());