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`
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.
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
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
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
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`
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
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
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
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
10 matches
Mail list logo