[PATCH] D59459: [analyzer][NFC] Prefer binary searches in CheckerRegistry

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 11 14:55:43 PDT 2019


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


================
Comment at: lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp:70
+      Collection, Info,
+      FullNameLT<typename CheckerOrPackageInfoList::value_type>{});
+}
----------------
baloghadamsoftware wrote:
> Please note that `llvm::lower_bound()` uses `std::lower_bound()` which returns an iterator pointing to the first element that is not less than the sought value, or last if no such element is found. So it is mandatory to check the return value whether it is equal to sought value or greater. In latter case you should return `Collection.end()` to keep up compatibility with `find_if`.
Yup, nice catch!


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

https://reviews.llvm.org/D59459





More information about the cfe-commits mailing list