================
@@ -453,13 +456,20 @@ class SymbolContextList {
/// The zero based index into the symbol context list.
///
/// \return
- /// A const reference to the symbol context to fill in.
- SymbolContext &operator[](size_t idx) { return m_symbol_contexts[idx]; }
-
+ /// A const reference to the symbol context.
const SymbolContext &operator[](size_t idx) const {
return m_symbol_contexts[idx];
}
+ /// Replace the symbol in the symbol context at index \a idx.
+ ///
+ /// The symbol field is excluded from the hash and equality used by the
+ /// internal set, so this is the only mutation that is safe to perform on
+ /// an element that is already in the list.
+ void SetSymbolAtIndex(size_t idx, Symbol *symbol) {
+ const_cast<SymbolContext &>(m_symbol_contexts[idx]).symbol = symbol;
----------------
augusto2112 wrote:
> Maybe remove/re-insert is another option. Not sure, the constraints are quite
> fiddly here :(
Besides setting a symbol if null, we don't actually modify the SymbolContexts
in the list at all today.
https://github.com/llvm/llvm-project/pull/181952
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits