[Lldb-commits] [PATCH] D49322: Narrow the CompletionRequest API to being append-only.

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 26 02:36:43 PDT 2018


labath added a comment.

The patch makes sense to me, though I can't say I'm that familiar with this code.

The thing I'd really like to get rid of is the need to have `return request.GetNumberOfMatches();` everywhere, but that's a fight for another day..



================
Comment at: include/lldb/Utility/CompletionRequest.h:88-93
+    // Filter out duplicates.
+    if (m_match_set.find(completion) != m_match_set.end())
+      return;
+
+    m_matches->AppendString(completion);
+    m_match_set.insert(completion);
----------------
Slightly shorter and more efficient:
`if (m_match_set.insert(completion).second) m_matches->AppendString(completion);`


https://reviews.llvm.org/D49322





More information about the lldb-commits mailing list