[Lldb-commits] [PATCH] D94271: [lldb] Replace GetModuleAtIndexUnlocked and GetModulePointerAtIndexUnlocked with iterators (NFC)

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 7 16:54:14 PST 2021


mib added inline comments.


================
Comment at: lldb/source/Commands/CommandObjectTarget.cpp:1404
   std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
   const size_t num_modules = module_list.GetSize();
   if (num_modules > 0) {
----------------
JDevlieghere wrote:
> mib wrote:
> > Same here, we could remove the check and just use `module_list.GetSize()` in the printf.
> There's a few places in this file where that's true, but here we still need it for both the early return and the print statement. I'm being pedantic, but generally `::size` is only guaranteed to be `O(n)` as opposed to `::empty` which is `O(1)`. I think having the temporary variable here is fine. 
Sounds good then!


================
Comment at: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp:406
+  Target &target = m_process->GetTarget();
+  const size_t num_modules = target.GetImages().GetSize();
 
----------------
JDevlieghere wrote:
> mib wrote:
> > This doesn't seem to be used anymore.
> It is below, but I've inlined it. 
Oh! The code was collapsed --' My bad!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94271/new/

https://reviews.llvm.org/D94271



More information about the lldb-commits mailing list