diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-06 20:14:12 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-06 20:14:12 +0000 |
commit | a4092fcbfb39b4d32a8e152a110d20132779d538 (patch) | |
tree | 37c84fe56b8ec43e3b08de27d76f53e259ddb0c7 /source | |
parent | cce7c2b0d24e364b1907670cf6f843531e5fe052 (diff) | |
download | src-test2-a4092fcbfb39b4d32a8e152a110d20132779d538.tar.gz src-test2-a4092fcbfb39b4d32a8e152a110d20132779d538.zip |
Notes
Diffstat (limited to 'source')
26 files changed, 120 insertions, 121 deletions
diff --git a/source/Core/DataEncoder.cpp b/source/Core/DataEncoder.cpp index dd6adc0a8688..334043651576 100644 --- a/source/Core/DataEncoder.cpp +++ b/source/Core/DataEncoder.cpp @@ -258,8 +258,7 @@ uint32_t DataEncoder::PutMaxU64(uint32_t offset, uint32_t byte_size, case 8: return PutU64(offset, value); default: - assert(!"GetMax64 unhandled case!"); - break; + llvm_unreachable("GetMax64 unhandled case!"); } return UINT32_MAX; } diff --git a/source/Core/ValueObjectMemory.cpp b/source/Core/ValueObjectMemory.cpp index 86747b84522b..18f3c94c522b 100644 --- a/source/Core/ValueObjectMemory.cpp +++ b/source/Core/ValueObjectMemory.cpp @@ -165,8 +165,7 @@ bool ValueObjectMemory::UpdateValue() { switch (value_type) { default: - assert(!"Unhandled expression result value kind..."); - break; + llvm_unreachable("Unhandled expression result value kind..."); case Value::eValueTypeScalar: // The variable value is in the Scalar value inside the m_value. diff --git a/source/Expression/IRInterpreter.cpp b/source/Expression/IRInterpreter.cpp index ef96b85971be..e5705984eb87 100644 --- a/source/Expression/IRInterpreter.cpp +++ b/source/Expression/IRInterpreter.cpp @@ -1602,25 +1602,23 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, lldb::addr_t addr = tmp_op.ULongLong(); size_t dataSize = 0; - if (execution_unit.GetAllocSize(addr, dataSize)) { - // Create the required buffer - rawArgs[i].size = dataSize; - rawArgs[i].data_ap.reset(new uint8_t[dataSize + 1]); - - // Read string from host memory - execution_unit.ReadMemory(rawArgs[i].data_ap.get(), addr, dataSize, - error); - if (error.Fail()) { - assert(!"we have failed to read the string from memory"); - return false; - } - // Add null terminator - rawArgs[i].data_ap[dataSize] = '\0'; - rawArgs[i].type = lldb_private::ABI::CallArgument::HostPointer; - } else { - assert(!"unable to locate host data for transfer to device"); - return false; - } + bool Success = execution_unit.GetAllocSize(addr, dataSize); + (void)Success; + assert(Success && + "unable to locate host data for transfer to device"); + // Create the required buffer + rawArgs[i].size = dataSize; + rawArgs[i].data_ap.reset(new uint8_t[dataSize + 1]); + + // Read string from host memory + execution_unit.ReadMemory(rawArgs[i].data_ap.get(), addr, dataSize, + error); + assert(!error.Fail() && + "we have failed to read the string from memory"); + + // Add null terminator + rawArgs[i].data_ap[dataSize] = '\0'; + rawArgs[i].type = lldb_private::ABI::CallArgument::HostPointer; } else /* if ( arg_ty->isPointerTy() ) */ { rawArgs[i].type = lldb_private::ABI::CallArgument::TargetValue; diff --git a/source/Expression/IRMemoryMap.cpp b/source/Expression/IRMemoryMap.cpp index 008838d5aab3..7b9d26667389 100644 --- a/source/Expression/IRMemoryMap.cpp +++ b/source/Expression/IRMemoryMap.cpp @@ -126,7 +126,7 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) { err = process_sp->GetMemoryRegionInfo( region_info.GetRange().GetRangeEnd(), region_info); if (err.Fail()) { - lldbassert(!"GetMemoryRegionInfo() succeeded, then failed"); + lldbassert(0 && "GetMemoryRegionInfo() succeeded, then failed"); ret = LLDB_INVALID_ADDRESS; break; } diff --git a/source/Host/common/Editline.cpp b/source/Host/common/Editline.cpp index a600c61c8e6b..1c5c0ffe902b 100644 --- a/source/Host/common/Editline.cpp +++ b/source/Host/common/Editline.cpp @@ -526,17 +526,8 @@ int Editline::GetCharacter(EditLineCharType *c) { } if (read_count) { -#if LLDB_EDITLINE_USE_WCHAR - // After the initial interruptible read, this is guaranteed not to block - ungetc(ch, m_input_file); - *c = fgetwc(m_input_file); - if (*c != WEOF) - return 1; -#else - *c = ch; - if (ch != (char)EOF) + if (CompleteCharacter(ch, *c)) return 1; -#endif } else { switch (status) { case lldb::eConnectionStatusSuccess: // Success @@ -1367,3 +1358,39 @@ void Editline::PrintAsync(Stream *stream, const char *s, size_t len) { MoveCursor(CursorLocation::BlockEnd, CursorLocation::EditingCursor); } } + +bool Editline::CompleteCharacter(char ch, EditLineCharType &out) { +#if !LLDB_EDITLINE_USE_WCHAR + if (ch == (char)EOF) + return false; + + out = ch; + return true; +#else + std::codecvt_utf8<wchar_t> cvt; + llvm::SmallString<4> input; + for (;;) { + const char *from_next; + wchar_t *to_next; + std::mbstate_t state = std::mbstate_t(); + input.push_back(ch); + switch (cvt.in(state, input.begin(), input.end(), from_next, &out, &out + 1, + to_next)) { + case std::codecvt_base::ok: + return out != WEOF; + + case std::codecvt_base::error: + case std::codecvt_base::noconv: + return false; + + case std::codecvt_base::partial: + lldb::ConnectionStatus status; + size_t read_count = m_input_connection.Read( + &ch, 1, std::chrono::seconds(0), status, nullptr); + if (read_count == 0) + return false; + break; + } + } +#endif +} diff --git a/source/Host/windows/EditLineWin.cpp b/source/Host/windows/EditLineWin.cpp index 124104b00067..133cd6225467 100644 --- a/source/Host/windows/EditLineWin.cpp +++ b/source/Host/windows/EditLineWin.cpp @@ -13,6 +13,7 @@ #include "lldb/Host/windows/windows.h" #include "lldb/Host/windows/editlinewin.h" +#include "llvm/Support/ErrorHandling.h" #include <assert.h> #include <vector> @@ -285,11 +286,10 @@ void el_end(EditLine *el) { // assert( !"Not implemented!" ); } -void el_reset(EditLine *) { assert(!"Not implemented!"); } +void el_reset(EditLine *) { llvm_unreachable("Not implemented!"); } int el_getc(EditLine *, char *) { - assert(!"Not implemented!"); - return 0; + llvm_unreachable("Not implemented!"); } void el_push(EditLine *, const char *) {} @@ -297,8 +297,7 @@ void el_push(EditLine *, const char *) {} void el_beep(EditLine *) { Beep(1000, 500); } int el_parse(EditLine *, int, const char **) { - assert(!"Not implemented!"); - return 0; + llvm_unreachable("Not implemented!"); } int el_get(EditLine *el, int code, ...) { @@ -311,7 +310,7 @@ int el_get(EditLine *el, int code, ...) { *dout = clientData; } break; default: - assert(!"Not implemented!"); + llvm_unreachable("Not implemented!"); } return 0; } @@ -322,7 +321,7 @@ int el_source(EditLine *el, const char *file) { return 0; } -void el_resize(EditLine *) { assert(!"Not implemented!"); } +void el_resize(EditLine *) { llvm_unreachable("Not implemented!"); } const LineInfo *el_line(EditLine *el) { return 0; } @@ -331,7 +330,7 @@ int el_insertstr(EditLine *, const char *) { return 0; } -void el_deletestr(EditLine *, int) { assert(!"Not implemented!"); } +void el_deletestr(EditLine *, int) { llvm_unreachable("Not implemented!"); } History *history_init(void) { // return dummy handle diff --git a/source/Interpreter/OptionValueProperties.cpp b/source/Interpreter/OptionValueProperties.cpp index 9a621bea8355..7e4df3a3e1d2 100644 --- a/source/Interpreter/OptionValueProperties.cpp +++ b/source/Interpreter/OptionValueProperties.cpp @@ -584,8 +584,7 @@ Error OptionValueProperties::DumpPropertyValue(const ExecutionContext *exe_ctx, } lldb::OptionValueSP OptionValueProperties::DeepCopy() const { - assert(!"this shouldn't happen"); - return lldb::OptionValueSP(); + llvm_unreachable("this shouldn't happen"); } const Property *OptionValueProperties::GetPropertyAtPath( diff --git a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp index c542b36b674f..64b303c4f735 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -64,10 +64,10 @@ private: class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor { public: ClangModulesDeclVendorImpl( - llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> &diagnostics_engine, - llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation, - std::unique_ptr<clang::CompilerInstance> &&compiler_instance, - std::unique_ptr<clang::Parser> &&parser); + llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_engine, + std::shared_ptr<clang::CompilerInvocation> compiler_invocation, + std::unique_ptr<clang::CompilerInstance> compiler_instance, + std::unique_ptr<clang::Parser> parser); ~ClangModulesDeclVendorImpl() override = default; @@ -96,7 +96,7 @@ private: bool m_enabled = false; llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> m_diagnostics_engine; - llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> m_compiler_invocation; + std::shared_ptr<clang::CompilerInvocation> m_compiler_invocation; std::unique_ptr<clang::CompilerInstance> m_compiler_instance; std::unique_ptr<clang::Parser> m_parser; size_t m_source_location_index = @@ -157,14 +157,14 @@ ClangModulesDeclVendor::ClangModulesDeclVendor() {} ClangModulesDeclVendor::~ClangModulesDeclVendor() {} ClangModulesDeclVendorImpl::ClangModulesDeclVendorImpl( - llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> &diagnostics_engine, - llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation, - std::unique_ptr<clang::CompilerInstance> &&compiler_instance, - std::unique_ptr<clang::Parser> &&parser) - : ClangModulesDeclVendor(), m_diagnostics_engine(diagnostics_engine), - m_compiler_invocation(compiler_invocation), + llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_engine, + std::shared_ptr<clang::CompilerInvocation> compiler_invocation, + std::unique_ptr<clang::CompilerInstance> compiler_instance, + std::unique_ptr<clang::Parser> parser) + : m_diagnostics_engine(std::move(diagnostics_engine)), + m_compiler_invocation(std::move(compiler_invocation)), m_compiler_instance(std::move(compiler_instance)), - m_parser(std::move(parser)), m_imported_modules() {} + m_parser(std::move(parser)) {} void ClangModulesDeclVendorImpl::ReportModuleExportsHelper( std::set<ClangModulesDeclVendor::ModuleID> &exports, @@ -498,7 +498,7 @@ void ClangModulesDeclVendorImpl::ForEachMacro( ti->getLocation(), &invalid); if (invalid) { - lldbassert(!"Unhandled token kind"); + lldbassert(0 && "Unhandled token kind"); macro_expansion.append("<unknown literal value>"); } else { macro_expansion.append( @@ -621,9 +621,9 @@ ClangModulesDeclVendor::Create(Target &target) { compiler_invocation_argument_cstrs.push_back(arg.c_str()); } - llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> invocation( + std::shared_ptr<clang::CompilerInvocation> invocation = clang::createInvocationFromCommandLine(compiler_invocation_argument_cstrs, - diagnostics_engine)); + diagnostics_engine); if (!invocation) return nullptr; @@ -640,7 +640,7 @@ ClangModulesDeclVendor::Create(Target &target) { new clang::CompilerInstance); instance->setDiagnostics(diagnostics_engine.get()); - instance->setInvocation(invocation.get()); + instance->setInvocation(invocation); std::unique_ptr<clang::FrontendAction> action(new clang::SyntaxOnlyAction); @@ -674,6 +674,7 @@ ClangModulesDeclVendor::Create(Target &target) { while (!parser->ParseTopLevelDecl(parsed)) ; - return new ClangModulesDeclVendorImpl(diagnostics_engine, invocation, + return new ClangModulesDeclVendorImpl(std::move(diagnostics_engine), + std::move(invocation), std::move(instance), std::move(parser)); } diff --git a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp index ba531b2e3f2d..aaca04582676 100644 --- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp +++ b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp @@ -196,8 +196,8 @@ bool fixupX86StructRetCalls(llvm::Module &module) { llvm::AllocaInst *new_func_ptr = new llvm::AllocaInst(new_func_ptr_type, "new_func_ptr", call_inst); // store the new_func_cast to the newly allocated space - (void)new llvm::StoreInst(new_func_cast, new_func_ptr, - "new_func_ptr_load_cast", call_inst); + (new llvm::StoreInst(new_func_cast, new_func_ptr, call_inst)) + ->setName("new_func_ptr_load_cast"); // load the new function address ready for a jump llvm::LoadInst *new_func_addr_load = new llvm::LoadInst(new_func_ptr, "load_func_pointer", call_inst); diff --git a/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index dae33f6257d1..a757bba70d16 100644 --- a/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -480,8 +480,7 @@ Error ProcessKDP::DoResume() { default: // The only valid thread resume states are listed above - assert(!"invalid thread resume state"); - break; + llvm_unreachable("invalid thread resume state"); } } diff --git a/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp b/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp index 273e1966f3fc..9f594f35d70d 100644 --- a/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp +++ b/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp @@ -116,8 +116,7 @@ ThreadKDP::CreateRegisterContextForFrame(StackFrame *frame) { new RegisterContextKDP_x86_64(*this, concrete_frame_idx)); break; default: - assert(!"Add CPU type support in KDP"); - break; + llvm_unreachable("Add CPU type support in KDP"); } } } else { diff --git a/source/Plugins/Process/POSIX/CrashReason.cpp b/source/Plugins/Process/POSIX/CrashReason.cpp index debdd7808e63..77d6e287486c 100644 --- a/source/Plugins/Process/POSIX/CrashReason.cpp +++ b/source/Plugins/Process/POSIX/CrashReason.cpp @@ -21,6 +21,7 @@ void AppendFaultAddr(std::string &str, lldb::addr_t addr) { str += ss.str(); } +#if defined(si_lower) && defined(si_upper) void AppendBounds(std::string &str, lldb::addr_t lower_bound, lldb::addr_t upper_bound, lldb::addr_t addr) { llvm::raw_string_ostream stream(str); @@ -37,6 +38,7 @@ void AppendBounds(std::string &str, lldb::addr_t lower_bound, stream << ")"; stream.flush(); } +#endif CrashReason GetCrashReasonForSIGSEGV(const siginfo_t &info) { assert(info.si_signo == SIGSEGV); diff --git a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp index 7c8c26047f85..75f7251fb108 100644 --- a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -167,7 +167,7 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict, reg_info.byte_offset = containing_reg_info->byte_offset + msbyte; } else { - assert(!"Invalid byte order"); + llvm_unreachable("Invalid byte order"); } } else { if (msbit > max_bit) diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 3c33ddb335d6..ba84c40e9767 100644 --- a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -1053,8 +1053,7 @@ bool RegisterContextLLDB::ReadRegisterValueFromRegisterLocation( case UnwindLLDB::RegisterLocation::eRegisterNotSaved: break; case UnwindLLDB::RegisterLocation::eRegisterSavedAtHostMemoryLocation: - assert("FIXME debugger inferior function call unwind"); - break; + llvm_unreachable("FIXME debugger inferior function call unwind"); case UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation: { Error error(ReadRegisterValueFromMemory( reg_info, regloc.location.target_memory_location, reg_info->byte_size, @@ -1062,8 +1061,7 @@ bool RegisterContextLLDB::ReadRegisterValueFromRegisterLocation( success = error.Success(); } break; default: - assert("Unknown RegisterLocation type."); - break; + llvm_unreachable("Unknown RegisterLocation type."); } return success; } @@ -1097,8 +1095,7 @@ bool RegisterContextLLDB::WriteRegisterValueToRegisterLocation( case UnwindLLDB::RegisterLocation::eRegisterNotSaved: break; case UnwindLLDB::RegisterLocation::eRegisterSavedAtHostMemoryLocation: - assert("FIXME debugger inferior function call unwind"); - break; + llvm_unreachable("FIXME debugger inferior function call unwind"); case UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation: { Error error(WriteRegisterValueToMemory( reg_info, regloc.location.target_memory_location, reg_info->byte_size, @@ -1106,8 +1103,7 @@ bool RegisterContextLLDB::WriteRegisterValueToRegisterLocation( success = error.Success(); } break; default: - assert("Unknown RegisterLocation type."); - break; + llvm_unreachable("Unknown RegisterLocation type."); } return success; } diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index f9bbaef60215..b70f0903dbd5 100644 --- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -2599,10 +2599,7 @@ size_t GDBRemoteCommunicationClient::GetCurrentThreadIDs( thread_ids.push_back(1); } } else { -#if defined(LLDB_CONFIGURATION_DEBUG) -// assert(!"ProcessGDBRemote::UpdateThreadList() failed due to not getting the -// sequence mutex"); -#else +#if !defined(LLDB_CONFIGURATION_DEBUG) Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS | GDBR_LOG_PACKETS)); if (log) @@ -3246,7 +3243,7 @@ GDBRemoteCommunicationClient::GetModulesInfo( JSONObject::SP module_sp = std::make_shared<JSONObject>(); module_array_sp->AppendObject(module_sp); module_sp->SetObject( - "file", std::make_shared<JSONString>(module_file_spec.GetPath())); + "file", std::make_shared<JSONString>(module_file_spec.GetPath(false))); module_sp->SetObject("triple", std::make_shared<JSONString>(triple.getTriple())); } diff --git a/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 3747b2b86d52..357b48e53c48 100644 --- a/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -1599,12 +1599,7 @@ StructuredData::ArraySP ScriptInterpreterPython::OSPlugin_ThreadsInfo( // as the underlying typedef for uint* types, size_t, off_t and other values // change. -template <typename T> const char *GetPythonValueFormatString(T t) { - assert(!"Unhandled type passed to GetPythonValueFormatString(T), make a " - "specialization of GetPythonValueFormatString() to support this " - "type."); - return nullptr; -} +template <typename T> const char *GetPythonValueFormatString(T t); template <> const char *GetPythonValueFormatString(char *) { return "s"; } template <> const char *GetPythonValueFormatString(char) { return "b"; } template <> const char *GetPythonValueFormatString(unsigned char) { diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp index 78fe571c50cf..ef3566855298 100644 --- a/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp +++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp @@ -65,8 +65,7 @@ bool DWARFDebugRanges::Extract(SymbolFileDWARF *dwarf2Data, break; default: - assert(!"DWARFRangeList::Extract() unsupported address size."); - break; + llvm_unreachable("DWARFRangeList::Extract() unsupported address size."); } // Filter out empty ranges diff --git a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index ad18c56b3300..39c52a8a5e57 100644 --- a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -734,12 +734,11 @@ int DWARFFormValue::Compare(const DWARFFormValue &a_value, } case DW_FORM_indirect: - assert(!"This shouldn't happen after the form has been extracted..."); - break; + llvm_unreachable( + "This shouldn't happen after the form has been extracted..."); default: - assert(!"Unhandled DW_FORM"); - break; + llvm_unreachable("Unhandled DW_FORM"); } return -1; } diff --git a/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp index afdb1d6afed3..cb1e5c185613 100644 --- a/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ b/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -167,8 +167,7 @@ void DWARFMappedHash::Prologue::AppendAtom(AtomType type, dw_form_t form) { case DW_FORM_exprloc: case DW_FORM_flag_present: case DW_FORM_ref_sig8: - assert(!"Unhandled atom form"); - break; + llvm_unreachable("Unhandled atom form"); case DW_FORM_string: case DW_FORM_block: diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 567ac88fdf07..16bb578e99c2 100644 --- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -1253,8 +1253,7 @@ SymbolFileDWARFDebugMap::GetCompileUnit(SymbolFileDWARF *oso_dwarf) { } } } - assert(!"this shouldn't happen"); - return lldb::CompUnitSP(); + llvm_unreachable("this shouldn't happen"); } SymbolFileDWARFDebugMap::CompileUnitInfo * diff --git a/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp index 0852f1922034..be770a38fba7 100644 --- a/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ b/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -442,15 +442,14 @@ size_t UnwindAssemblyInstEmulation::WriteMemory( case EmulateInstruction::eContextPushRegisterOnStack: { uint32_t reg_num = LLDB_INVALID_REGNUM; uint32_t generic_regnum = LLDB_INVALID_REGNUM; - if (context.info_type == - EmulateInstruction::eInfoTypeRegisterToRegisterPlusOffset) { - const uint32_t unwind_reg_kind = m_unwind_plan_ptr->GetRegisterKind(); - reg_num = context.info.RegisterToRegisterPlusOffset.data_reg - .kinds[unwind_reg_kind]; - generic_regnum = context.info.RegisterToRegisterPlusOffset.data_reg - .kinds[eRegisterKindGeneric]; - } else - assert(!"unhandled case, add code to handle this!"); + assert(context.info_type == + EmulateInstruction::eInfoTypeRegisterToRegisterPlusOffset && + "unhandled case, add code to handle this!"); + const uint32_t unwind_reg_kind = m_unwind_plan_ptr->GetRegisterKind(); + reg_num = context.info.RegisterToRegisterPlusOffset.data_reg + .kinds[unwind_reg_kind]; + generic_regnum = context.info.RegisterToRegisterPlusOffset.data_reg + .kinds[eRegisterKindGeneric]; if (reg_num != LLDB_INVALID_REGNUM && generic_regnum != LLDB_REGNUM_GENERIC_SP) { diff --git a/source/Symbol/ClangASTContext.cpp b/source/Symbol/ClangASTContext.cpp index caebd0ce8c6b..3c817a409b03 100644 --- a/source/Symbol/ClangASTContext.cpp +++ b/source/Symbol/ClangASTContext.cpp @@ -390,7 +390,7 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) { case IK_AST: case IK_LLVM_IR: case IK_RenderScript: - assert(!"Invalid input kind!"); + llvm_unreachable("Invalid input kind!"); case IK_OpenCL: LangStd = LangStandard::lang_opencl; break; @@ -2119,7 +2119,7 @@ CompilerType ClangASTContext::CreateStructForIdentifier( if (!type_name.IsEmpty() && (type = GetTypeForIdentifier<clang::CXXRecordDecl>(type_name)) .IsValid()) { - lldbassert("Trying to create a type for an existing name"); + lldbassert(0 && "Trying to create a type for an existing name"); return type; } @@ -7568,8 +7568,7 @@ ClangASTContext::GetTemplateArgument(lldb::opaque_compiler_type_t type, return CompilerType(); default: - assert(!"Unhandled clang::TemplateArgument::ArgKind"); - break; + llvm_unreachable("Unhandled clang::TemplateArgument::ArgKind"); } } } diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp index 2374a6d2b202..2df193fa45e5 100644 --- a/source/Symbol/Type.cpp +++ b/source/Symbol/Type.cpp @@ -484,8 +484,7 @@ bool Type::ResolveClangType(ResolveState compiler_type_resolve_state) { break; default: - assert(!"Unhandled encoding_data_type."); - break; + llvm_unreachable("Unhandled encoding_data_type."); } } else { // We have no encoding type, return void? @@ -529,8 +528,7 @@ bool Type::ResolveClangType(ResolveState compiler_type_resolve_state) { break; default: - assert(!"Unhandled encoding_data_type."); - break; + llvm_unreachable("Unhandled encoding_data_type."); } } diff --git a/source/Target/ABI.cpp b/source/Target/ABI.cpp index de4f685eb1c7..87363a3b8aeb 100644 --- a/source/Target/ABI.cpp +++ b/source/Target/ABI.cpp @@ -189,8 +189,7 @@ bool ABI::PrepareTrivialCall(Thread &thread, lldb::addr_t sp, lldb::addr_t returnAddress, llvm::Type &returntype, llvm::ArrayRef<ABI::CallArgument> args) const { // dummy prepare trivial call - assert(!"Should never get here!"); - return false; + llvm_unreachable("Should never get here!"); } bool ABI::GetFallbackRegisterLocation( diff --git a/source/Target/Platform.cpp b/source/Target/Platform.cpp index 43371ec23614..d8db53663f14 100644 --- a/source/Target/Platform.cpp +++ b/source/Target/Platform.cpp @@ -1876,9 +1876,8 @@ size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target, } break; default: - assert( - !"Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode"); - break; + llvm_unreachable( + "Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode"); } assert(bp_site); diff --git a/source/Target/StackFrameList.cpp b/source/Target/StackFrameList.cpp index 872e153ddb06..146b2b05dbd7 100644 --- a/source/Target/StackFrameList.cpp +++ b/source/Target/StackFrameList.cpp @@ -541,8 +541,7 @@ StackFrameSP StackFrameList::GetFrameAtIndex(uint32_t idx) { if (m_frames.empty()) { // Why do we have a thread with zero frames, that should not ever // happen... - if (m_thread.IsValid()) - assert("A valid thread has no frames."); + assert(!m_thread.IsValid() && "A valid thread has no frames."); } else { ResetCurrentInlinedDepth(); frame_sp = m_frames[original_idx]; |