[Lldb-commits] [PATCH] D149900: [lldb] Expose a const iterator for SymbolContextList

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 4 13:30:28 PDT 2023


bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, jingham, mib, aprantl.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: lldb-commits, jplehr, sstefan1.
Herald added a project: LLDB.

There are many situations where we'll iterate over a SymbolContextList
with the pattern:

  SymbolContextList sc_list;
  // Fill in sc_list here
  for (auto i = 0; i < sc_list.GetSize(); i++) {
    SymbolContext sc;
    sc_list.GetSymbolAtContext(i, sc);
  
    // Do work with sc
  }

Adding an iterator to iterate over the instances directly means we don't
have to do bounds checking or create a copy of every element of the
SymbolContextList.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149900

Files:
  lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
  lldb/include/lldb/Symbol/SymbolContext.h
  lldb/include/lldb/Symbol/UnwindTable.h
  lldb/source/API/SBThread.cpp
  lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Commands/CommandCompletions.cpp
  lldb/source/Commands/CommandObjectSource.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Core/AddressResolverFileLine.cpp
  lldb/source/Core/SourceManager.cpp
  lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Symbol/SymbolContext.cpp
  lldb/source/Symbol/UnwindTable.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149900.519634.patch
Type: text/x-patch
Size: 41522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230504/ec9a3305/attachment-0001.bin>


More information about the lldb-commits mailing list