[Lldb-commits] [PATCH] D159313: [lldb][NFCI] Remove use of ConstString in StructuredData

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 11 11:19:59 PDT 2023


bulbazord added inline comments.


================
Comment at: lldb/include/lldb/Utility/StructuredData.h:436
       auto array_sp = std::make_shared<Array>();
-      collection::const_iterator iter;
-      for (iter = m_dict.begin(); iter != m_dict.end(); ++iter) {
+      for (auto iter = m_dict.begin(); iter != m_dict.end(); ++iter) {
         auto key_object_sp = std::make_shared<String>();
----------------
fdeazeve wrote:
> Since we are touching this line anyway, could you replace this with
> 
> ```
> for (StringRef key : llvm::make_first_range(m_dict))
> ```
> 
> This has a bit less cognitive burden IMO
Unfortunately no, `llvm::make_first_range` assumes that you can refer to `first` on an iterator, but `first` is actually a method to be called. The iterator code will have to stay for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159313



More information about the lldb-commits mailing list