[all-commits] [llvm/llvm-project] 04aa94: [lldb] Expose a const iterator for SymbolContextList

Alex via All-commits all-commits at lists.llvm.org
Thu May 4 16:39:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04aa943be8ed5c03092e2a90112ac638360ec253
      https://github.com/llvm/llvm-project/commit/04aa943be8ed5c03092e2a90112ac638360ec253
  Author: Alex Langford <alangford at apple.com>
  Date:   2023-05-04 (Thu, 04 May 2023)

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

  Log Message:
  -----------
  [lldb] Expose a const iterator for SymbolContextList

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.

Differential Revision: https://reviews.llvm.org/D149900




More information about the All-commits mailing list