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

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 06:29:36 PDT 2019


baloghadamsoftware requested changes to this revision.
baloghadamsoftware added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp:70
+      Collection, Info,
+      FullNameLT<typename CheckerOrPackageInfoList::value_type>{});
+}
----------------
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`.


Repository:
  rC Clang

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

https://reviews.llvm.org/D59459





More information about the cfe-commits mailing list