https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/145366
We can omit the call to Target::HasLoadedSections as Address::HasLoadedSections already "does the right thing" and returns LLDB_INVALID_ADDRESS if no sections are loaded. >From 1df38e3639abcd0c009024e6d495113b421a520a Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere <jo...@devlieghere.com> Date: Mon, 23 Jun 2025 10:17:17 -0700 Subject: [PATCH] [lldb] Eliminate check for HasLoadedSections (NFC) We can omit the call to Target::HasLoadedSections as Address::HasLoadedSections already "does the right thing" and returns LLDB_INVALID_ADDRESS if no sections are loaded. --- lldb/source/Core/FormatEntity.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 8e3c3c18863fa..ca389bc88cf79 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -470,9 +470,7 @@ static bool DumpAddressAndContent(Stream &s, const SymbolContext *sc, bool print_file_addr_or_load_addr) { Target *target = Target::GetTargetFromContexts(exe_ctx, sc); - addr_t vaddr = LLDB_INVALID_ADDRESS; - if (target && target->HasLoadedSections()) - vaddr = addr.GetLoadAddress(target); + addr_t vaddr = addr.GetLoadAddress(target); if (vaddr == LLDB_INVALID_ADDRESS) vaddr = addr.GetFileAddress(); if (vaddr == LLDB_INVALID_ADDRESS) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits