hanchenye-llvm-project/libcxx
Nico Weber 1362d7ef88 libcxx: Add _LIBCPP_NODISCARD_EXT to 38 more functions
This builds on the work done in r342808 and adds _LIBCPP_NODISCARD_EXT
to 37 more functions, namely:

adjacent_find, all_of, any_of, binary_search, clamp, count_if, count,
equal_range, equal, find_end, find_first_not_of, find_first_of, find_if,
find, includes, is_heap_until, is_heap, is_partitioned, is_permutation,
is_sorted_until, is_sorted, lexicographical_compare, lower_bound,
max_element, max, min_element, min, minmax_element, minmax, mismatch,
none_of, remove_if, remove, search_n, search, unique, upper_bound

The motivation here is that we noticed that find_if is nodiscard with
Visual Studio's standard library, and we deemed that useful
(https://crbug.com/948122).
https://devblogs.microsoft.com/cppblog/c17-progress-in-vs-2017-15-5-and-15-6/
says "Our criteria for emitting the warning are: discarding the return
value is a guaranteed leak [...], discarding the return value is
near-guaranteed to be incorrect (e.g. remove()/remove_if()/unique()), or
the function is essentially a pure observer (e.g. vector::empty() and
std::is_sorted())." so I went through algorithm and tried to apply these
criteria.

Some of these, like vector::empty() are already nodiscard per C++
standard and didn't need changing.

I didn't (yet?) go over std::string::find* methods which should probably
have _LIBCPP_NODISCARD_EXT too (but not as part of this change).

Differential Revision: https://reviews.llvm.org/D60145

llvm-svn: 357619
2019-04-03 18:13:08 +00:00
..
benchmarks Add more benchmarks for literal strings. 2019-04-03 17:40:51 +00:00
cmake [CMake] Differentiate between static and shared libc++abi 2019-04-03 01:33:14 +00:00
docs libcxx: Add _LIBCPP_NODISCARD_EXT to 38 more functions 2019-04-03 18:13:08 +00:00
fuzzing Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
include libcxx: Add _LIBCPP_NODISCARD_EXT to 38 more functions 2019-04-03 18:13:08 +00:00
lib [CMake] Differentiate between static and shared libc++abi 2019-04-03 01:33:14 +00:00
src Fix typo that I introduced in r357413. Thanks to ensadc@mailnesia.com for the catch. 2019-04-02 14:00:36 +00:00
test libcxx: Add _LIBCPP_NODISCARD_EXT to 38 more functions 2019-04-03 18:13:08 +00:00
utils [libc++] Add proper XFAILs for shared_mutex tests 2019-03-27 15:50:34 +00:00
www [libc++] Use std::is_nothrow_callable for std::invoke according to LWG 2807 2019-04-03 17:54:37 +00:00
.arcconfig
.clang-format
.gitignore
CMakeLists.txt [libc++][CMake] Allow merging libc++abi.a into libc++ even on Apple platforms 2019-03-25 14:56:29 +00:00
CREDITS.TXT
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
NOTES.TXT Reland "Use custom command and target to install libc++ headers" 2018-06-12 03:10:02 +00:00
TODO.TXT
appveyor-reqs-install.cmd Update LLVM version used on Appveyor bot, remove MSVC 2015 bot 2018-10-30 21:23:31 +00:00
appveyor.yml Update LLVM version used on Appveyor bot, remove MSVC 2015 bot 2018-10-30 21:23:31 +00:00