[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function
Daniel Marjamäki via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 18 03:56:13 PDT 2017
danielmarjamaki added a comment.
Please click "Done" on fixed review comments.
================
Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2038
+ // If the size can be nonzero, we have to check the other arguments.
+ if (StateNonZeroSize) {
+ State = StateNonZeroSize;
----------------
This "if (StateNonZeroSize)" condition is useless now since you added a early return
================
Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2039
+ if (StateNonZeroSize) {
+ State = StateNonZeroSize;
+
----------------
I suggest code cleanup:
```
State = StateNonZeroSize;
State = checkNonNull(C, State, Mem, MemVal);
```
Change that to:
```
State = checkNonNull(C, StateNonZeroSize, Mem, MemVal);
```
================
Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2063
+ if (!State)
+ return;
+ }
----------------
indentation. I personally like the clang-format-diff script also. That would cleanup all your changes.
cd llvm/tools/clang
svn diff | python tools/clang-format/clang-format-diff.py -i
It should work with git diff also but I have not tried that.
Repository:
rL LLVM
https://reviews.llvm.org/D31868
More information about the cfe-commits
mailing list