From b737702efd96d2902c7063152747e8f193aa1fbc Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Thu, 23 May 2013 00:32:34 +0000 Subject: [PATCH] Missed removing one of the assert()'s from the LLVMCreateDisasmCPU() library 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/MC/MCDisassembler/Disassembler.cpp b/lib/MC/MCDisassembler/Disassembler.cpp index d3c019246c0..c80a167ace7 100644 --- a/lib/MC/MCDisassembler/Disassembler.cpp +++ b/lib/MC/MCDisassembler/Disassembler.cpp @@ -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) -- 2.34.1