summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/google/MemsetZeroLengthCheck.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Add bugprone-suspicious-memset-usage checkGabor Horvath2017-07-141-96/+0
| | | | | | | | | | | | | | | | | | Created new module bugprone and placed the check in that. Finds memset() calls with potential mistakes in their arguments. Replaces and extends the existing google-runtime-memset-zero-length check. Cases covered: * Fill value is a character '0'. Integer 0 might have been intended. * Fill value is out of char range and gets truncated. * Byte count is zero. Potentially swapped with the fill value argument. Patch by: Reka Nikolett Kovacs Differential Revision: https://reviews.llvm.org/D32700 llvm-svn: 308020
* [clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-081-6/+7
| | | | | | | | | | | | | | | | Summary: Ran clang-format on all .c/.cpp/.h files in clang-tools-extra. Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories. Reviewers: klimek, alexfh Subscribers: nemanjai Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26329 llvm-svn: 286221
* [clang-tidy] Fix a false positive in google-runtime-memsetAlexander Kornienko2016-01-111-7/+11
| | | | | | | | | | | | | | | | | google-runtime-memset no longer issues a warning if the fill char value is known to be an invalid fill char count. Namely, it no longer warns for these: memset(p, 0, 0); memset(p, -1, 0); In both cases, swapping the last two args would either be useless (there is no actual bug) or wrong (it would introduce a bug). Patch by Matt Armstrong! llvm-svn: 257320
* [clang-tidy] Refactor: Move google clang-tidy checks to namespace ↵Alexander Kornienko2015-03-051-0/+2
| | | | | | | | | | clang::tidy::google http://reviews.llvm.org/D7994 Patch by Richard Thomson! llvm-svn: 231364
* [cleanup] Re-sort the #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | No functionality changed, this is just a mechanical cleanup to keep the order of #include lines consistent across the project. llvm-svn: 225976
* [clang-tidy] Use new ASTMatchers to identify template instantiations instead ↵Benjamin Kramer2014-09-031-4/+1
| | | | | | | | of copying it everywhere. No intended functionality change. llvm-svn: 217035
* [clang-tidy] MemsetZeroLenghtChecker: Don't crash trying to evaluate ↵Benjamin Kramer2014-07-171-2/+4
| | | | | | dependent values. llvm-svn: 213238
* [clang-tidy] As a simple heuristic don't emit a swap fixit that would createBenjamin Kramer2014-07-161-1/+2
| | | | | | | | | negative-sized memsets. memset(x, -1, 0) is still useless but swapping makes no sense here. Just emit a warning. llvm-svn: 213157
* [clang-tidy] Also emit a warning for memset(x, 0, 0)Benjamin Kramer2014-07-161-4/+8
| | | | | | | It doesn't make sense to suggest swapping the arguments here but it's still useless code llvm-svn: 213156
* [clang-tidy] Add a checker for zero-length memset.Benjamin Kramer2014-07-161-0/+85
If there's memset(x, y, 0) in the code it's most likely a mistake. The checker suggests a fix-it to swap 'y' and '0'. I think this has the potential to be promoted into a general clang warning after some testing in clang-tidy. Differential Revision: http://reviews.llvm.org/D4535 llvm-svn: 213155
OpenPOWER on IntegriCloud