[Lldb-commits] [PATCH] D66654: 2/2: Process formatters in reverse-chronological order

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Sep 14 08:53:53 PDT 2019


jankratochvil marked 9 inline comments as done.
jankratochvil added inline comments.


================
Comment at: lldb/include/lldb/DataFormatters/FormattersContainer.h:83
+    Delete(name);
+    m_map.push_back(std::make_pair(std::move(name), std::move(entry)));
     if (listener)
----------------
labath wrote:
> m_map.emplace_back, maybe?
Yes, not sure why I forgot here.


================
Comment at: lldb/include/lldb/DataFormatters/FormattersContainer.h:109
     std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    MapIterator iter = m_map.find(name);
-    if (iter == m_map.end())
-      return false;
-    entry = iter->second;
-    return true;
+    for (MapIterator iter = m_map.begin(); iter != m_map.end(); ++iter)
+      if (iter->first == name) {
----------------
labath wrote:
> range-based for
OK, other existing loops updated in: rL371922


================
Comment at: lldb/include/lldb/DataFormatters/FormattersContainer.h:168
+  typedef KeyType MapKeyType;
+  typedef std::shared_ptr<ValueType> MapValueType;
   typedef typename BackEndType::ForEachCallback ForEachCallback;
----------------
labath wrote:
> Is this still needed, or is that a leftover from the MapVector attempt?
Still needed.


================
Comment at: lldb/include/lldb/DataFormatters/FormattersContainer.h:291-292
+    // Patterns are matched in reverse-chronological order.
+    MapReverseIterator pos, end = m_format_map.map().rend();
+    for (pos = m_format_map.map().rbegin(); pos != end; pos++) {
       const RegularExpression &regex = pos->first;
----------------
labath wrote:
> consider: `for(const auto &entry: llvm::reverse(m_format_map))`
Nice, thanks, used.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66654/new/

https://reviews.llvm.org/D66654





More information about the lldb-commits mailing list