[PATCH] D35051: [clang-tidy] Add misc-undefined-memory-manipulation check.

2017-07-06 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs created this revision. rnkovacs added a project: clang-tools-extra. Herald added subscribers: whisperity, JDevlieghere, mgorny. Finds calls of memory manipulation functions `memset()`, `memcpy()` and `memmove()` on not TriviallyCopyable objects resulting in undefined behavior. Related d

[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 bugprone-suspicious-memset-usage check.

2017-07-12 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 106172. rnkovacs retitled this revision from "[clang-tidy] Add misc-suspicious-memset-usage check." to "[clang-tidy] Add bugprone-suspicious-memset-usage check.". rnkovacs edited the summary of this revision. rnkovacs added a comment. - Created new module `

[PATCH] D35051: [clang-tidy] Add bugprone-undefined-memory-manipulation check.

2017-07-12 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 106185. rnkovacs retitled this revision from "[clang-tidy] Add misc-undefined-memory-manipulation check." to "[clang-tidy] Add bugprone-undefined-memory-manipulation check.". rnkovacs edited the summary of this revision. rnkovacs added a comment. - Moved to

[PATCH] D35051: [clang-tidy] Add bugprone-undefined-memory-manipulation check.

2017-07-12 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 106234. rnkovacs added a comment. Herald added a subscriber: baloghadamsoftware. Removed redundant parens and stray semicolons. https://reviews.llvm.org/D35051 Files: clang-tidy/bugprone/BugproneTidyModule.cpp clang-tidy/bugprone/CMakeLists.txt clang

[PATCH] D35051: [clang-tidy] Add bugprone-undefined-memory-manipulation check.

2017-07-12 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs marked 2 inline comments as done. rnkovacs added inline comments. Comment at: clang-tidy/bugprone/UndefinedMemoryManipulationCheck.cpp:39 + // Check whether source object is not TriviallyCopyable. + // Only applicable to memcpy() and memmove(). + Finder->addMatcher( -

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

2017-07-12 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 106268. rnkovacs added a comment. Herald added a subscriber: baloghadamsoftware. - Added `char[]` exception along with a test case. There are no more false positives on LLVM. - Simplified fix-its by using `clang::tooling::fixit` functions. https://reviews.

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

2017-07-13 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 106381. https://reviews.llvm.org/D32700 Files: clang-tidy/CMakeLists.txt clang-tidy/bugprone/BugproneTidyModule.cpp clang-tidy/bugprone/CMakeLists.txt clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp clang-tidy/bugprone/SuspiciousMemsetUsageCheck

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

2017-07-13 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs marked an inline comment as done. rnkovacs added inline comments. Comment at: docs/clang-tidy/checks/bugprone-suspicious-memset-usage.rst:10 + +**Case 1: Fill value is a character '0'** + whisperity wrote: > Shouldn't this `'0'` be enclosed within backti

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

2017-07-14 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 106620. rnkovacs marked an inline comment as done. rnkovacs added a comment. Moved comments inside `if` bodies. https://reviews.llvm.org/D32700 Files: clang-tidy/CMakeLists.txt clang-tidy/bugprone/BugproneTidyModule.cpp clang-tidy/bugprone/CMakeLists

[PATCH] D35790: [clang-tidy] Handle incomplete types in bugprone-undefined-memory-manipulation check.

2017-07-24 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs created this revision. rnkovacs added a project: clang-tools-extra. Herald added subscribers: whisperity, JDevlieghere. `bugprone-undefined-memory-manipulation` check crashes on incomplete types. This diff fixes that by assuming they are `TriviallyCopyable` by default. https://reviews.

[PATCH] D35051: [clang-tidy] Add bugprone-undefined-memory-manipulation check.

2017-07-24 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs added a comment. Dependent types seem to work, but we did manage to produce a crash on incomplete types. I created https://reviews.llvm.org/D35790 for that. I hope it's the same problem you encountered. Repository: rL LLVM https://reviews.llvm.org/D35051

[PATCH] D35796: [analyzer] Misused polymorphic object checker

2017-07-24 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs created this revision. Herald added subscribers: baloghadamsoftware, xazax.hun, whisperity, mgorny. This check warns if a derived type object is deleted through a base pointer with a non-virtual destructor in its base class. It also places a note at the last point where the derived-to-b

[PATCH] D35796: [analyzer] Misused polymorphic object checker

2017-07-26 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 108226. https://reviews.llvm.org/D35796 Files: include/clang/StaticAnalyzer/Checkers/Checkers.td lib/StaticAnalyzer/Checkers/CMakeLists.txt lib/StaticAnalyzer/Checkers/MisusedPolymorphicObjectChecker.cpp test/Analysis/MisusedPolymorphicObject.cpp In

[PATCH] D35796: [analyzer] Misused polymorphic object checker

2017-07-26 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs added a comment. In https://reviews.llvm.org/D35796#819965, @NoQ wrote: > It seems that this check is more powerful because it works by knowing the > dynamic type of the object. However, i still suspect that > `-Wnon-virtual-dtor` (the other one, without `delete-`, that simply asks to

[PATCH] D35932: [clang-tidy] Add integer division check

2017-07-27 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs created this revision. rnkovacs added a project: clang-tools-extra. Herald added subscribers: baloghadamsoftware, JDevlieghere, mgorny. Finds integer divisions in environments expecting floating-point values. Examples of possibly unintended precision loss: sin(7 / (2 + 3)); abs(sin(

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-15 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs added inline comments. Comment at: lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp:150 +SB.getKnownValue(state, C.getSVal(B->getRHS())); +if ((unsigned) RHS->getZExtValue() > LHS->countLeadingZeros()) { + OS << "The result of the left shif

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-15 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 129905. rnkovacs marked an inline comment as done. https://reviews.llvm.org/D41816 Files: lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp lib/StaticAnalyzer/Core/BasicValueFactory.cpp test/Analysis/bitwise-ops.c Index: test/Analysis/bitwise-ops.c

[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 destina

[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 clang-tidy/misc/MiscTidyModule.cp

[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-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 d

[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 manag

<    1   2