Szelethus added a comment. I think testcases for non-class iterator objects would be valuable.
================ Comment at: lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp:72-76 + auto IteratesPointerKeysM = hasType(cxxRecordDecl(has( + fieldDecl(hasType(hasCanonicalType( + pointsTo(hasCanonicalType(pointerType())) + ))) + ))); ---------------- I'm not a matcher-expert, but here we go: As I understand it, you're matching iterator objects that wrap a pointer to pointer. Would it match this case?: ``` void fill(int **IntPointerArray); int main() { int *IntPointerArray[20]; // or a simple int array fill(IntPointerArray); std::sort(IntPointerArray, IntPointerArray + 20); } ``` `int**` is an [[ https://en.cppreference.com/w/cpp/named_req/RandomAccessIterator | RandomAccessIterator ]], but is not a `CXXRecordDecl`. As I mentioned earlier, it might be worth taking a look at `hasType`, and attempt to acquire `value_type`, as it is required for STL algorithms (it could be in a base class as well). `value_type` is also predefined through `std::iterator_traits` for pointer iterators like `int**`. https://reviews.llvm.org/D50488 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits