Szelethus added inline comments.

Comment at: lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp:91-100
+  const QualType IterTy = CE->getArg(0)->getType();
+  const RecordDecl *RD =
+    IterTy->getUnqualifiedDesugaredType()->getAsCXXRecordDecl();
+  if (RD->field_empty())
+    return;
NoQ wrote:
> This heuristic ("the argument of `std::sort` is //a class whose first field 
> is of pointer type//") is quite wonky, do you have a plan on how to make it 
> more precise?
template< class RandomIt >
void sort( RandomIt first, RandomIt last );
Since `RandomIt` must satisfy [[ | 
RandomAccesIterator ]], maybe you could obtain the value type with 
`std::iterator_traits<It>::value_type`, and check whether it's a pointer type.

  rC Clang

cfe-commits mailing list

Reply via email to