diff options
Diffstat (limited to 'source/Plugins')
14 files changed, 46 insertions, 62 deletions
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) { |