[lldb] Expose a const iterator for SymbolContextList
authorAlex Langford <alangford@apple.com>
Thu, 4 May 2023 20:26:58 +0000 (13:26 -0700)
committerAlex Langford <alangford@apple.com>
Thu, 4 May 2023 23:36:44 +0000 (16:36 -0700)
commit04aa943be8ed5c03092e2a90112ac638360ec253
tree45c211c4b200c275522d16e07890e7fc1a05e8ea
parent4c9c1a4e4f854b2a4891813b2b1d7e1079a52a62
[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
20 files changed:
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