[Lldb-commits] [PATCH] D30402: Modernize Enable/DisableLogChannel interface a bit

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 28 02:54:37 PST 2017


labath added a comment.





================
Comment at: include/lldb/Interpreter/Args.h:196-197
+  llvm::ArrayRef<const char *> GetArgumentArrayRef() const {
+    return {static_cast<const char *const *>(m_argv.data()),
+            m_argv.size() - 1};
+  }
----------------
zturner wrote:
> can this be written `return makeArrayRef(m_argv).drop_back();`?
Yes, it looks like it can.


================
Comment at: source/Core/Log.cpp:74-80
+    auto cat = llvm::find_if(
+        entry.second.channel.categories,
+        [&](const Log::Category &c) { return c.name.equals_lower(category); });
     if (cat != entry.second.channel.categories.end()) {
       flags |= cat->flag;
       continue;
     }
----------------
zturner wrote:
> How about 
> 
> ```
> bool exists = llvm::any(entry.second.channel.categories,
>         [&](const Log::Category &c) { return c.name.equals_lower(category); }));
> if (exists) {
>   ...
> }
> ```
That won't work, because I actually need the relevant iterator to get the associated flag (`flags |= cat->flag` below).


https://reviews.llvm.org/D30402





More information about the lldb-commits mailing list