jankratochvil marked 2 inline comments as done.
jankratochvil added inline comments.
================
Comment at: lldb/include/lldb/Core/UniqueCStringMap.h:130-163
+ bool GetValues(ConstString unique_cstr,
+ std::function<bool(T value)> callback) const {
+ for (const Entry &entry : llvm::make_range(std::equal_range(
+ m_map.begin(), m_map.end(), unique_cstr, Compare())))
+ if (callback(entry.value))
+ return true;
+
----------------
jankratochvil wrote:
> labath wrote:
> > I'm not sure these functions are really needed. They have just one caller,
> > and they'd be trivial if this class provided appropriate abstractions.
> > Maybe just add begin/end/equal_range methods, so that one can write:
> > ```
> > for (value: map / map.equal_range(str))
> > stuff
> > ```
> > ?
> >
> > (ideally, I'd like to have iterators instead of callbacks for the index
> > classes too, but iterators and class hierarchies don't mix very well)
> Do you mean the standard iteration:
> ```
> for (std::pair<ConstString, DIERef> pair : map)
> stuff;
> ```
> or really
> ```
> for (DIERef ref : map)
> stuff;
> ```
> ?
>
Implemented. IIUC for regexes it should be matched in a caller - or to make
also an iterator for regexes?
```
for (const auto &entry : m_map.equal_range(name))
if (callback(entry.value))
```
```
for (const auto &entry : m_map)
if (regex.Execute(entry.cstring.GetCString())) {
if (callback(entry.value))
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77327/new/
https://reviews.llvm.org/D77327
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits