[PATCH] D32700: [clang-tidy] Add misc-suspicious-memset-usage check.

2017-07-06 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 105401. rnkovacs edited the summary of this revision. rnkovacs added a comment. - Merged in the `google-runtime-memset-zero-length` check. - Added a separate check for memory manipulation functions: `misc-undefined-memory-manipulation`

[PATCH] D32700: [clang-tidy] Add misc-suspicious-memset-usage check.

2017-05-17 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment. > The existing google-runtime-memset-zero-length check is related. It finds > cases when the byte count parameter is zero and offers to swap that with the > fill value argument. Perhaps the two could be merged while maintaining > backward compatibility through an alias.

[PATCH] D32700: [clang-tidy] Add misc-suspicious-memset-usage check.

2017-05-08 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs added a comment. The current proposition could be that we only keep the first two cases, possibly merging in the google check for a third case (with its old name evoking original functionality). Separately, another check could be written that warns when the below mentioned memory

[PATCH] D32700: [clang-tidy] Add misc-suspicious-memset-usage check.

2017-05-07 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added inline comments. Comment at: clang-tidy/misc/SuspiciousMemsetUsageCheck.cpp:21 +void SuspiciousMemsetUsageCheck::registerMatchers(MatchFinder *Finder) { + const auto HasCtorOrDtor = + eachOf(hasMethod(cxxConstructorDecl(unless(anyOf( I

[PATCH] D32700: [clang-tidy] Add misc-suspicious-memset-usage check.

2017-05-05 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 97917. rnkovacs edited the summary of this revision. rnkovacs added a comment. - Removed case related to virtual pointers as there is a diagnostic flag for that. - Added case warning for calls on classes with a constructor or destructor. Changed tests and

[PATCH] D32700: [clang-tidy] Add misc-suspicious-memset-usage check.

2017-05-03 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs added a comment. In https://reviews.llvm.org/D32700#743178, @malcolm.parsons wrote: > Can you change this to match any pointer to a class with a virtual function? Well, I have just found a clang flag `-Wdynamic-class-memaccess`

[PATCH] D32700: [clang-tidy] Add misc-suspicious-memset-usage check.

2017-05-03 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 97646. rnkovacs edited the summary of this revision. rnkovacs added a comment. - Fixed function call format in docs. - Added check to release notes. https://reviews.llvm.org/D32700 Files: clang-tidy/misc/CMakeLists.txt

[PATCH] D32700: [clang-tidy] Add misc-suspicious-memset-usage check.

2017-05-02 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons added a comment. > The destination is a this pointer within a class that has a virtual function. > It might reset the virtual pointer. Can you change this to match any pointer to a class with a virtual function? I'd also like a warning for a pointer to a class with a

[PATCH] D32700: [clang-tidy] Add misc-suspicious-memset-usage check.

2017-05-01 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment. Please mention this check in docs/ReleaseNotes.rst (in alphabetical order). Comment at: docs/clang-tidy/checks/misc-suspicious-memset-usage.rst:6 + +This check finds memset calls with potential mistakes in their arguments. +Considering the

[PATCH] D32700: [clang-tidy] Add misc-suspicious-memset-usage check.

2017-05-01 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs created this revision. Herald added a subscriber: mgorny. This check finds memset calls with potential mistakes in their arguments. Cases covered: - Fill value is a character '0'. Integer 0 might have been intended. - Fill value is out of character range and gets truncated. - The