[PATCH] D27806: [clang-tidy] Add obvious-invalid-range

Jakub StaroĊ„ via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 16 03:21:19 PST 2016


staronj added inline comments.


================
Comment at: clang-tidy/misc/InvalidRangeCheck.cpp:19
+
+const std::string CXX_AlgorithmNames =
+    "std::for_each; std::find; std::find_if; std::find_end; "
----------------
Remove std::fill_n (http://en.cppreference.com/w/cpp/algorithm/fill_n) - doesn't take two iterators.
Remove std::generate_n (http://en.cppreference.com/w/cpp/algorithm/generate_n) - as above
Remove std::max (http://en.cppreference.com/w/cpp/algorithm/max) - as above
Remove std::min (http://en.cppreference.com/w/cpp/algorithm/min) - as above

Add std::search_n (http://en.cppreference.com/w/cpp/algorithm/search_n)
What about std::accumulate (http://en.cppreference.com/w/cpp/algorithm/accumulate)?
What about std::inner_product (http://en.cppreference.com/w/cpp/algorithm/inner_product)?
What about std::adjacent_difference (http://en.cppreference.com/w/cpp/algorithm/adjacent_difference)?
What about std::partial_sum (http://en.cppreference.com/w/cpp/algorithm/partial_sum)?


================
Comment at: clang-tidy/misc/InvalidRangeCheck.cpp:38
+
+const auto CXX11_AlgorithmNames =
+    CXX_AlgorithmNames +
----------------
Remove std::copy_n (http://en.cppreference.com/w/cpp/algorithm/copy_n) - it doesn't take range.
Remove std::minmax (http://en.cppreference.com/w/cpp/algorithm/minmax) - as above

What about std::iota (http://en.cppreference.com/w/cpp/algorithm/iota)?




https://reviews.llvm.org/D27806





More information about the cfe-commits mailing list