Re: [PATCH] D16310: new clang-tidy checker misc-long-cast

2016-01-28 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done. Comment at: clang-tidy/misc/MisplacedWideningCastCheck.cpp:33 @@ +32,3 @@ + Finder->addMatcher(varDecl(has(Cast)), this); + Finder->addMatcher(binaryOperator(hasOperatorName("="), hasRHS(Cast)), this); +} I have

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-11-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 40505. danielmarjamaki added a comment. I have problems with the "default" handling of expressions. I want to warn about loss of precision for such code: unsigned int x = 256; unsigned char c; c = x; The analyser tells me that the RHS value is

Re: [PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

2015-11-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. Does anybody else think that this should be moved to clang-tidy? I believe that the noise level is very low when I scan various open source projects. My script tries to run clang on all projects in the debian arch

[PATCH] D14977: clang-tidy: code cleanup with isAssignmentOperator

2015-11-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added subscribers: cfe-commits, alexfh. This is a small code cleanup. No change in logical behaviour is intended. http://reviews.llvm.org/D14977 Files: clang-tidy/misc/AssertSideEffectCheck.cpp Index: clang-tidy/misc/AssertSideEffectCheck

Re: [PATCH] D14977: clang-tidy: code cleanup with isAssignmentOperator

2015-11-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki closed this revision. danielmarjamaki added a comment. Committed with 254066. http://reviews.llvm.org/D14977 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-11-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. ping.. the latest patch has an alternative approach, where the checker track values of symbols. REGISTER_MAP_WITH_PROGRAMSTATE(DeclVal, const ValueDecl *, SVal) The reason I don't use normal ProgramState values is that these symbol values are truncated. I w

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-04 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 41858. danielmarjamaki added a comment. Another diff. This time I have stripped the checker to make it simpler to review, triage, etc. It will now only warn about loss of precision in assignments when RHS is a variable. For me, triaging these resul

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. In http://reviews.llvm.org/D13126#302647, @dcoughlin wrote: > In http://reviews.llvm.org/D13126#302328, @danielmarjamaki wrote: > > > When scanning 692 projects with this checker I got 56 warnings. I've > > triage

Re: [PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

2015-12-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 42164. danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. Moved warning to clang-tidy. In this patch I am more careful about function calls. Sometimes when it is technically possible to use const it's still not a good

Re: [PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

2015-12-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a subscriber: alexfh. danielmarjamaki added a reviewer: alexfh. danielmarjamaki added a comment. Alexander: I add you as reviewer since this was moved to clang-tidy. http://reviews.llvm.org/D12359 ___ cfe-commits mailing list c

Re: [PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

2015-12-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D12359#304772, @danielmarjamaki wrote: > Moved warning to clang-tidy. > > In this patch I am more careful about function calls. Sometimes when it is > technically possible to use const it's still not a good idea. > > For instance when u

[PATCH] D15332: new clang-tidy checker readability-non-const-parameter

2015-12-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added reviewers: alexfh, aaron.ballman, rsmith. danielmarjamaki added subscribers: cfe-commits, sberg. This is a new clang-tidy checker that will warn when function parameters should be const. See also related discussions in http://reviews.l

Re: [PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

2015-12-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki abandoned this revision. danielmarjamaki added a comment. I have created a new revision: http://reviews.llvm.org/D15332 http://reviews.llvm.org/D12359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-

Re: [PATCH] D15332: new clang-tidy checker readability-non-const-parameter

2015-12-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 42292. danielmarjamaki added a comment. I have tried to fix the comments. This patch is mostly untested. I have only run 'make check-all'. I am running more tests right now. http://reviews.llvm.org/D15332 Files: clang-tidy/readability/CMakeLists

Re: [PATCH] D15332: new clang-tidy checker readability-non-const-parameter

2015-12-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 12 inline comments as done. Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:44 @@ +43,3 @@ + if (B->isAssignmentOp()) +markCanNotBeConst(B, false); +} else if (const auto *CE = dyn_cast(S)) { I tried to unify l

Re: [PATCH] D15332: new clang-tidy checker readability-non-const-parameter

2015-12-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 3 inline comments as done. danielmarjamaki added a comment. In http://reviews.llvm.org/D15332#305976, @alexfh wrote: > Please add tests with templates and macros. Please also run this on > LLVM/Clang to ensure a) it doesn't crash; b) the number of warnings is sane; > c) a

Re: [PATCH] D15332: new clang-tidy checker readability-non-const-parameter

2015-12-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D15332#306097, @Eugene.Zelenko wrote: > This check partially implements PR19419. Could it be extended to variables? Yes, I don't see any technical reasons why that would not work. However politically, some people like const variables

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. I have looked all warnings that I got. 1678 projects where scanned. In total I got 124 warnings. I classified 91 warnings as TP. 14 as FP. and then there were 19 that I failed to triage. I for instance failed to

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. > I classified 91 warnings as TP. 14 as FP. and then there were 19 that I > failed to triage. I for instance failed to triage code implemented in headers > when I don't know what values function arguments will have. Sorry I calculated wrong. I classified 91 wa

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-16 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. ping. I would like to have a review on this. http://reviews.llvm.org/D13126 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-17 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. Thanks a lot for those comments. I'll try your suggestions. I will try to upload some samples where I think the ProgramState is wrong. Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:78 @@ +77,3 @@ + +// Can E value be greater or e

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 4 inline comments as done. Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:41 @@ +40,3 @@ +const Stmt *Parent = PM.getParent(Cast); +if (!Parent) + return; a.sidorin wrote: > Parent should always exist for an impli

<    1   2   3