Author: Slava Gurevich Date: 2022-07-25T18:23:19-07:00 New Revision: 9877159dd65ae6d2c4afc4c459d2eefe2473e616
URL: https://github.com/llvm/llvm-project/commit/9877159dd65ae6d2c4afc4c459d2eefe2473e616 DIFF: https://github.com/llvm/llvm-project/commit/9877159dd65ae6d2c4afc4c459d2eefe2473e616.diff LOG: Revert "[LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan. Part 2" This reverts commit b9aedd94e6796e4b4866ab4c091b736b3db58cb7. Added: Modified: lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp lldb/source/Plugins/Process/Utility/ThreadMemory.cpp lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp lldb/source/Symbol/Type.cpp lldb/source/Target/Process.cpp lldb/source/Target/RegisterContextUnwind.cpp lldb/source/Target/ThreadPlanCallFunction.cpp lldb/source/Target/ThreadPlanTracer.cpp lldb/source/Target/TraceDumper.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp index c396cb061c017..acb131b8a775a 100644 --- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp +++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp @@ -348,7 +348,7 @@ llvm::support::ulittle64_t read_register_u64(RegisterContext *reg_ctx, lldb_private::minidump::MinidumpContext_x86_64 GetThreadContext_64(RegisterContext *reg_ctx) { - lldb_private::minidump::MinidumpContext_x86_64 thread_context = {}; + lldb_private::minidump::MinidumpContext_x86_64 thread_context; thread_context.p1_home = {}; thread_context.context_flags = static_cast<uint32_t>( lldb_private::minidump::MinidumpContext_x86_64_Flags::x86_64_Flag | @@ -534,7 +534,7 @@ Status MinidumpFileBuilder::AddException(const lldb::ProcessSP &process_sp) { helper_data.AppendData( &thread_context, sizeof(lldb_private::minidump::MinidumpContext_x86_64)); - Exception exp_record = {}; + Exception exp_record; exp_record.ExceptionCode = static_cast<llvm::support::ulittle32_t>(stop_info_sp->GetValue()); exp_record.ExceptionFlags = static_cast<llvm::support::ulittle32_t>(0); diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index f7f52deb173fb..90118f9386da3 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -234,7 +234,7 @@ NativeProcessLinux::Factory::Launch(ProcessLaunchInfo &launch_info, } // Wait for the child process to trap on its call to execve. - int wstatus = 0; + int wstatus; ::pid_t wpid = llvm::sys::RetryAfterSignal(-1, ::waitpid, pid, &wstatus, 0); assert(wpid == pid); (void)wpid; diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp index 691e7db3fc79e..11b300bc44fbb 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp @@ -95,7 +95,7 @@ static size_t k_num_register_infos = RegisterContextDarwin_arm64::RegisterContextDarwin_arm64( Thread &thread, uint32_t concrete_frame_idx) - : RegisterContext(thread, concrete_frame_idx), gpr(), fpu(), exc(), dbg() { + : RegisterContext(thread, concrete_frame_idx), gpr(), fpu(), exc() { uint32_t i; for (i = 0; i < kNumErrors; i++) { gpr_errs[i] = -1; diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp index 89ecc757a68f5..7469e7633e71d 100644 --- a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp +++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp @@ -23,8 +23,7 @@ using namespace lldb_private; ThreadMemory::ThreadMemory(Process &process, tid_t tid, const ValueObjectSP &thread_info_valobj_sp) : Thread(process, tid), m_backing_thread_sp(), - m_thread_info_valobj_sp(thread_info_valobj_sp), m_name(), m_queue(), - m_register_data_addr(LLDB_INVALID_ADDRESS) {} + m_thread_info_valobj_sp(thread_info_valobj_sp), m_name(), m_queue() {} ThreadMemory::ThreadMemory(Process &process, lldb::tid_t tid, llvm::StringRef name, llvm::StringRef queue, diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index 24c942f1d290a..58b4fe3add1b3 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -610,9 +610,9 @@ llvm::Error ProcessElfCore::parseNetBSDNotes(llvm::ArrayRef<CoreNote> notes) { // To be extracted from struct netbsd_elfcore_procinfo // Used to sanity check of the LWPs of the process uint32_t nlwps = 0; - uint32_t signo = 0; // killing signal - uint32_t siglwp = 0; // LWP target of killing signal - uint32_t pr_pid = 0; + uint32_t signo; // killing signal + uint32_t siglwp; // LWP target of killing signal + uint32_t pr_pid; for (const auto ¬e : notes) { llvm::StringRef name = note.info.n_name; @@ -764,7 +764,7 @@ llvm::Error ProcessElfCore::parseNetBSDNotes(llvm::ArrayRef<CoreNote> notes) { } llvm::Error ProcessElfCore::parseOpenBSDNotes(llvm::ArrayRef<CoreNote> notes) { - ThreadData thread_data = {}; + ThreadData thread_data; for (const auto ¬e : notes) { // OpenBSD per-thread information is stored in notes named "OpenBSD@nnn" so // match on the initial part of the string. diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index 64219e1a960b8..c91c111d8df3a 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -233,8 +233,7 @@ ProcessMinidump::ProcessMinidump(lldb::TargetSP target_sp, const FileSpec &core_file, DataBufferSP core_data) : PostMortemProcess(target_sp, listener_sp), m_core_file(core_file), - m_core_data(std::move(core_data)), m_active_exception(nullptr), - m_is_wow64(false) {} + m_core_data(std::move(core_data)), m_is_wow64(false) {} ProcessMinidump::~ProcessMinidump() { Clear(); diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp index 7d730ecdd1f33..6317b140f7e8e 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp @@ -475,7 +475,7 @@ llvm::StringRef lldb_private::npdb::DropNameScope(llvm::StringRef name) { } VariableInfo lldb_private::npdb::GetVariableNameInfo(CVSymbol sym) { - VariableInfo result = {}; + VariableInfo result; if (sym.kind() == S_REGREL32) { RegRelativeSym reg(SymbolRecordKind::RegRelativeSym); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp index 7fc1d6ab49ec1..2e60ba6f3fc31 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -747,7 +747,7 @@ void SystemRuntimeMacOSX::PopulateQueueList( SystemRuntimeMacOSX::PendingItemsForQueue SystemRuntimeMacOSX::GetPendingItemRefsForQueue(lldb::addr_t queue) { - PendingItemsForQueue pending_item_refs = {}; + PendingItemsForQueue pending_item_refs; AppleGetPendingItemsHandler::GetPendingItemsReturnInfo pending_items_pointer; ThreadSP cur_thread_sp( m_process->GetThreadList().GetExpressionExecutionThread()); diff --git a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp index c796cbc75c1b6..92eec139e07c9 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp +++ b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp @@ -968,7 +968,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( UnwindPlan::RowSP prologue_completed_row; // copy of prologue row of CFI int prologue_completed_sp_bytes_offset_from_cfa; // The sp value before the // epilogue started executed - bool prologue_completed_is_aligned = false; + bool prologue_completed_is_aligned; std::vector<bool> prologue_completed_saved_registers; while (current_func_text_offset < size) { diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index f83bdcdc1c740..4ee5a3e76ae44 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -162,8 +162,8 @@ Type::Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name, } Type::Type() - : std::enable_shared_from_this<Type>(), UserID(0), m_name("<INVALID TYPE>"), - m_payload(0) { + : std::enable_shared_from_this<Type>(), UserID(0), + m_name("<INVALID TYPE>") { m_byte_size = 0; m_byte_size_has_value = false; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 6583baec63202..0467066376913 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -434,11 +434,10 @@ Process::Process(lldb::TargetSP target_sp, ListenerSP listener_sp, m_memory_cache(*this), m_allocated_memory_cache(*this), m_should_detach(false), m_next_event_action_up(), m_public_run_lock(), m_private_run_lock(), m_finalizing(false), - m_clear_thread_plans_on_stop(false), - m_currently_handling_do_on_removals(false), m_resume_requested(false), - m_force_next_event_delivery(false), m_last_broadcast_state(eStateInvalid), - m_destroy_in_process(false), m_can_interpret_function_calls(false), - m_run_thread_plan_lock(), m_can_jit(eCanJITDontKnow) { + m_clear_thread_plans_on_stop(false), m_force_next_event_delivery(false), + m_last_broadcast_state(eStateInvalid), m_destroy_in_process(false), + m_can_interpret_function_calls(false), m_run_thread_plan_lock(), + m_can_jit(eCanJITDontKnow) { CheckInWithManager(); Log *log = GetLog(LLDBLog::Object); @@ -4551,9 +4550,9 @@ class RestorePlanState { private: lldb::ThreadPlanSP m_thread_plan_sp; bool m_already_reset = false; - bool m_private = false; - bool m_is_controlling = false; - bool m_okay_to_discard = false; + bool m_private; + bool m_is_controlling; + bool m_okay_to_discard; }; } // anonymous namespace diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp index 2da40ba2bf61e..a0f97d7e7cff4 100644 --- a/lldb/source/Target/RegisterContextUnwind.cpp +++ b/lldb/source/Target/RegisterContextUnwind.cpp @@ -1525,7 +1525,7 @@ RegisterContextUnwind::SavedLocationForRegister( // unwindplan_regloc has valid contents about where to retrieve the register if (unwindplan_regloc.IsUnspecified()) { - lldb_private::UnwindLLDB::RegisterLocation new_regloc = {}; + lldb_private::UnwindLLDB::RegisterLocation new_regloc; new_regloc.type = UnwindLLDB::RegisterLocation::eRegisterNotSaved; m_registers[regnum.GetAsKind(eRegisterKindLLDB)] = new_regloc; UnwindLogMsg("save location for %s (%d) is unspecified, continue searching", @@ -1731,7 +1731,7 @@ bool RegisterContextUnwind::TryFallbackUnwindPlan() { addr_t old_caller_pc_value = LLDB_INVALID_ADDRESS; addr_t new_caller_pc_value = LLDB_INVALID_ADDRESS; - UnwindLLDB::RegisterLocation regloc = {}; + UnwindLLDB::RegisterLocation regloc; if (SavedLocationForRegister(pc_regnum.GetAsKind(eRegisterKindLLDB), regloc) == UnwindLLDB::RegisterSearchResult::eRegisterFound) { diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 629ffcf307153..a9f774aa61097 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -104,10 +104,7 @@ ThreadPlanCallFunction::ThreadPlanCallFunction( m_ignore_breakpoints(options.DoesIgnoreBreakpoints()), m_debug_execution(options.GetDebug()), m_trap_exceptions(options.GetTrapExceptions()), m_function_addr(function), - m_start_addr(), m_function_sp(0), m_subplan_sp(), - m_cxx_language_runtime(nullptr), m_objc_language_runtime(nullptr), - m_stored_thread_state(), m_real_stop_info_sp(), m_constructor_errors(), - m_return_valobj_sp(), m_takedown_done(false), + m_function_sp(0), m_takedown_done(false), m_should_clear_objc_exception_bp(false), m_should_clear_cxx_exception_bp(false), m_stop_address(LLDB_INVALID_ADDRESS), m_return_type(return_type) { @@ -137,11 +134,8 @@ ThreadPlanCallFunction::ThreadPlanCallFunction( m_ignore_breakpoints(options.DoesIgnoreBreakpoints()), m_debug_execution(options.GetDebug()), m_trap_exceptions(options.GetTrapExceptions()), m_function_addr(function), - m_start_addr(), m_function_sp(0), m_subplan_sp(), - m_cxx_language_runtime(nullptr), m_objc_language_runtime(nullptr), - m_stored_thread_state(), m_real_stop_info_sp(), m_constructor_errors(), - m_return_valobj_sp(), m_takedown_done(false), m_function_sp(0), - m_takedown_done(false), m_should_clear_objc_exception_bp(false), + m_function_sp(0), m_takedown_done(false), + m_should_clear_objc_exception_bp(false), m_should_clear_cxx_exception_bp(false), m_stop_address(LLDB_INVALID_ADDRESS), m_return_type(CompilerType()) {} diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp index 7e09253076443..f5331428038be 100644 --- a/lldb/source/Target/ThreadPlanTracer.cpp +++ b/lldb/source/Target/ThreadPlanTracer.cpp @@ -36,11 +36,11 @@ using namespace lldb_private; ThreadPlanTracer::ThreadPlanTracer(Thread &thread, lldb::StreamSP &stream_sp) : m_process(*thread.GetProcess().get()), m_tid(thread.GetID()), - m_enabled(false), m_stream_sp(stream_sp), m_thread(nullptr) {} + m_enabled(false), m_stream_sp(stream_sp) {} ThreadPlanTracer::ThreadPlanTracer(Thread &thread) : m_process(*thread.GetProcess().get()), m_tid(thread.GetID()), - m_enabled(false), m_stream_sp(), m_thread(nullptr) {} + m_enabled(false), m_stream_sp() {} Stream *ThreadPlanTracer::GetLogStream() { if (m_stream_sp) diff --git a/lldb/source/Target/TraceDumper.cpp b/lldb/source/Target/TraceDumper.cpp index c9ef3aa5bd6b7..739105e9e9fb1 100644 --- a/lldb/source/Target/TraceDumper.cpp +++ b/lldb/source/Target/TraceDumper.cpp @@ -286,7 +286,7 @@ TraceDumper::TraceDumper(lldb::TraceCursorUP &&cursor_up, Stream &s, } TraceDumper::TraceItem TraceDumper::CreatRawTraceItem() { - TraceItem item = {}; + TraceItem item; item.id = m_cursor_up->GetId(); if (m_options.show_tsc) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits