[clang-tools-extra] e4bb3e2 - [clang-tidy] Expand the list of functions in bugprone-unused-return-value

Joe Ranieri via cfe-commits cfe-commits at lists.llvm.org
Fri May 22 09:59:00 PDT 2020


Author: Joe Ranieri
Date: 2020-05-22T12:57:58-04:00
New Revision: e4bb3e25e4400151133fd3737f4842f2aeda1c1b

URL: https://github.com/llvm/llvm-project/commit/e4bb3e25e4400151133fd3737f4842f2aeda1c1b
DIFF: https://github.com/llvm/llvm-project/commit/e4bb3e25e4400151133fd3737f4842f2aeda1c1b.diff

LOG: [clang-tidy] Expand the list of functions in bugprone-unused-return-value

This change adds common C, C++, and POSIX functions to the clang-tidy unused return value checker.

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

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
index c3efb08d4213..d49fd63f005d 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
@@ -43,7 +43,90 @@ UnusedReturnValueCheck::UnusedReturnValueCheck(llvm::StringRef Name,
                                    "::std::unique;"
                                    "::std::unique_ptr::release;"
                                    "::std::basic_string::empty;"
-                                   "::std::vector::empty")) {}
+                                   "::std::vector::empty;"
+                                   "::std::back_inserter;"
+                                   "::std::distance;"
+                                   "::std::find;"
+                                   "::std::find_if;"
+                                   "::std::inserter;"
+                                   "::std::lower_bound;"
+                                   "::std::make_pair;"
+                                   "::std::map::count;"
+                                   "::std::map::find;"
+                                   "::std::map::lower_bound;"
+                                   "::std::multimap::equal_range;"
+                                   "::std::multimap::upper_bound;"
+                                   "::std::set::count;"
+                                   "::std::set::find;"
+                                   "::std::setfill;"
+                                   "::std::setprecision;"
+                                   "::std::setw;"
+                                   "::std::upper_bound;"
+                                   "::std::vector::at;"
+                                   // C standard library
+                                   "::bsearch;"
+                                   "::ferror;"
+                                   "::feof;"
+                                   "::isalnum;"
+                                   "::isalpha;"
+                                   "::isblank;"
+                                   "::iscntrl;"
+                                   "::isdigit;"
+                                   "::isgraph;"
+                                   "::islower;"
+                                   "::isprint;"
+                                   "::ispunct;"
+                                   "::isspace;"
+                                   "::isupper;"
+                                   "::iswalnum;"
+                                   "::iswprint;"
+                                   "::iswspace;"
+                                   "::isxdigit;"
+                                   "::memchr;"
+                                   "::memcmp;"
+                                   "::strcmp;"
+                                   "::strcoll;"
+                                   "::strncmp;"
+                                   "::strpbrk;"
+                                   "::strrchr;"
+                                   "::strspn;"
+                                   "::strstr;"
+                                   "::wcscmp;"
+                                   // POSIX
+                                   "::access;"
+                                   "::bind;"
+                                   "::connect;"
+                                   "::
diff time;"
+                                   "::dlsym;"
+                                   "::fnmatch;"
+                                   "::getaddrinfo;"
+                                   "::getopt;"
+                                   "::htonl;"
+                                   "::htons;"
+                                   "::iconv_open;"
+                                   "::inet_addr;"
+                                   "::isascii;"
+                                   "::isatty;"
+                                   "::mmap;"
+                                   "::newlocale;"
+                                   "::openat;"
+                                   "::pathconf;"
+                                   "::pthread_equal;"
+                                   "::pthread_getspecific;"
+                                   "::pthread_mutex_trylock;"
+                                   "::readdir;"
+                                   "::readlink;"
+                                   "::recvmsg;"
+                                   "::regexec;"
+                                   "::scandir;"
+                                   "::semget;"
+                                   "::setjmp;"
+                                   "::shm_open;"
+                                   "::shmget;"
+                                   "::sigismember;"
+                                   "::strcasecmp;"
+                                   "::strsignal;"
+                                   "::ttyname")) {}
 
 void UnusedReturnValueCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "CheckedFunctions", CheckedFunctions);


        


More information about the cfe-commits mailing list