[Lldb-commits] [PATCH] D77324: [source maps] Fix remove, insert-after and replace

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 2 23:57:47 PDT 2020


labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lldb/source/Interpreter/OptionValuePathMappings.cpp:184-185
+      // Sort and then erase in reverse so indexes are always valid
+      llvm::sort(remove_indexes.rbegin(), remove_indexes.rend());
+      for (auto index : remove_indexes)
+        m_path_mappings.Remove(index, m_notify_changes);
----------------
sorting on reverse iterators causes some head-scratching. I think it would be simpler to just sort normally, and then iterate in reverse (`for (int /*not auto*/ index: llvm::reverse(remove_indexes)) ...`)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77324





More information about the lldb-commits mailing list