Missed removing one of the assert()'s from the LLVMCreateDisasmCPU() library
authorKevin Enderby <enderby@apple.com>
Thu, 23 May 2013 00:32:34 +0000 (00:32 +0000)
committerKevin Enderby <enderby@apple.com>
Thu, 23 May 2013 00:32:34 +0000 (00:32 +0000)
API with my 176880 revision.  If a bad Triple is passed in it can also assert.
In this case too it should just return 0 to indicate failure to create the
disassembler.

rdar://13955214

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182542 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCDisassembler/Disassembler.cpp

index d3c019246c08219d12a637cea5c4b0aa944cbc4d..c80a167ace71434ea011637af7eae1700fa1dfcd 100644 (file)
@@ -40,7 +40,8 @@ LLVMDisasmContextRef LLVMCreateDisasmCPU(const char *Triple, const char *CPU,
   // Get the target.
   std::string Error;
   const Target *TheTarget = TargetRegistry::lookupTarget(Triple, Error);
-  assert(TheTarget && "Unable to create target!");
+  if (!TheTarget)
+    return 0;
 
   const MCRegisterInfo *MRI = TheTarget->createMCRegInfo(Triple);
   if (!MRI)