[PATCH] D39694: [VerifyDiagnosticConsumer] support -verify=<prefixes>

Joel E. Denny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 15 03:51:43 PST 2017


jdenny marked an inline comment as done.
jdenny added inline comments.


================
Comment at: lib/Frontend/VerifyDiagnosticConsumer.cpp:398
+    // DToken is foo-bar-warning, but foo is the only -verify prefix).
+    if (Prefixes.end() == std::find(Prefixes.begin(), Prefixes.end(), DToken))
+      continue;
----------------
hfinkel wrote:
> > Converts from std::vector to std::set for more efficient prefix lookup.
> 
> Don't do that. First, std::find is O(N) here anyway. You'd want to use Prefixes.find(...) instead. However, this set is essentially constant and you're trying to optimize the lookup. In such a case, std::set is not a good choice. Just use a sorted vector instead (e.g., call std::sort on the vector), and then use std::binary_search here. That's likely much faster.
> 
Thanks.


https://reviews.llvm.org/D39694





More information about the cfe-commits mailing list