[PATCH] D11940: don't diagnose -Wunused-parameter in virtual method or method that overrides base class method

2015-08-11 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a reviewer: krememek. danielmarjamaki added a subscriber: cfe-commits. Don't diagnose -Wunused-parameter in methods that override other methods because the overridden methods might use the parameter Don't diagnose -Wunused-parameter

Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual method or method that overrides base class method

2015-08-11 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki abandoned this revision. danielmarjamaki added a comment. In http://reviews.llvm.org/D11940#221718, @thakis wrote: Can't you just change your signature to virtual void a(int /* x */) {} in these cases? hmm.. yes I agree. You are right, so I change my mind about this

Re: [PATCH] D10892: warning when inner condition is identical

2015-08-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki accepted this revision. danielmarjamaki added a reviewer: danielmarjamaki. danielmarjamaki marked 6 inline comments as done. This revision is now accepted and ready to land. Comment at: lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp:120 @@ +119,3 @@ +

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

2015-11-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 39679. danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. fixes of review comments http://reviews.llvm.org/D12359 Files: include/clang/AST/Decl.h include/clang/Basic/DiagnosticGroups.td

Re: [PATCH] D14540: clang-tidy: Fix FP in MacroParenthesesChecker when using object member pointer

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

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

2015-11-11 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D12359#287522, @rsmith wrote: > Why does this construct justify the compiler emitting a warning? It seems to > be reporting a fact about the code rather than a bug, and as there are many > coding styles where variables are not

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

2015-11-12 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 40040. danielmarjamaki added a comment. Moved NonConstUse from VarDecl to ParmVarDecl to avoid waste of memory http://reviews.llvm.org/D12359 Files: include/clang/AST/Decl.h include/clang/Basic/DiagnosticGroups.td

[PATCH] D14540: clang-tidy: Fix FP in MacroParenthesesChecker when using object member pointer

2015-11-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a reviewer: alexfh. danielmarjamaki added a subscriber: cfe-commits. This fixes the FP in http://llvm.org/bugs/show_bug.cgi?id=25208 http://reviews.llvm.org/D14540 Files: clang-tidy/misc/MacroParenthesesCheck.cpp

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

2015-10-19 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 37728. danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. Fix FN for code: const char *ret(char *p) { return p ? p : ""; } http://reviews.llvm.org/D12359 Files: include/clang/AST/Decl.h

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

2015-10-19 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D12359#233152, @sberg wrote: > causes false positive for > > char * f(char *); > char * g(char * p) { return f(p); } > Sorry for replying this late. This should work in latest patch. Comment at:

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

2015-10-19 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. > It might be more useful if you could print the paths on which the errors > occurred (this could be done for text output with -analyzer-output=text) Sounds good. Is it possible to use it with scan-build? Comment at:

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

2015-10-19 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D13126#270193, @danielmarjamaki wrote: > > It might be more useful if you could print the paths on which the errors > > occurred (this could be done for text output with -analyzer-output=text) > > > Sounds good. Is it possible to use

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

2015-10-16 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 37582. danielmarjamaki marked 5 inline comments as done. danielmarjamaki added a comment. One more work in progress patch. I have moved the NonConstUse to VarDecl. I turned on Wnonconst-parameter by default. This had a very positive effect; I saw

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

2015-10-16 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 37584. danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. Minor fixes from previous patch. Added some more testcases. http://reviews.llvm.org/D12359 Files: include/clang/AST/Decl.h

Re: [PATCH] D13643: [Sema] Warn on ternary comparison

2015-10-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a subscriber: danielmarjamaki. danielmarjamaki added a comment. Interesting checker. I'll test it on some debian projects. If you're interested.. it does not currently warn about "1.0 < 2.0 < 3.0" as far as I see. http://reviews.llvm.org/D13643

Re: [PATCH] D13643: [Sema] Warn on ternary comparison

2015-10-21 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D13643#271885, @danielmarjamaki wrote: > I tested this on 2199 debian projects.. and got 16 warnings. > > ftp://ftp.se.debian.org/debian/pool/main/t/tf5/tf5_5.0beta8.orig.tar.gz > expr.c:738:22: warning: comparisons such as 'a < b

Re: [PATCH] D13643: [Sema] Warn on ternary comparison

2015-10-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. I tested this on 2199 debian projects.. and got 16 warnings. ftp://ftp.se.debian.org/debian/pool/main/t/tf5/tf5_5.0beta8.orig.tar.gz expr.c:738:22: warning: comparisons such as 'a < b != c' do not have their mathematical meaning [-Wparentheses] if

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

2015-10-21 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 37969. danielmarjamaki added a comment. Fixed a FP. Triaged warnings (random selection of warnings): ftp://ftp.se.debian.org/debian/pool/main/a/aespipe/aespipe_2.4c.orig.tar.bz2 ./aespipe.c:467:43: warning: parameter 'keyStr' can be const

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

2015-10-13 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 37223. danielmarjamaki added a comment. Minor cleanups and refactorings http://reviews.llvm.org/D12359 Files: include/clang/AST/Decl.h include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td

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

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

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

2015-08-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a subscriber: cfe-commits. This is a new warning for Clang. It will warn when a pointer parameter can be const. The design is inspired by the Wunused-parameter warning. I have tested this on many debian packages. In 2151 projects

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

2015-08-27 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. I saw a FP when I looked through the logs today... Example code: void dostuff(int *); void f(int *p) { #ifdef X dostuff(p); #endif if (*p == 0) {} } As far as I know there is nothing I can do about this in the checker. A user could

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

2015-08-27 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 33307. danielmarjamaki added a comment. Thanks! I fixed that FP. http://reviews.llvm.org/D12359 Files: include/clang/AST/DeclBase.h include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td

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

2015-08-31 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D12359#236334, @aaron.ballman wrote: > I have concerns about this being a frontend warning. The true positive rate > seems rather high given the benign nature of the diagnostic, and the false > negative rate is quite high. This seems

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

2015-08-31 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 33575. danielmarjamaki added a comment. Fixed 2 false positives found in python source code. http://reviews.llvm.org/D12359 Files: include/clang/AST/DeclBase.h include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td

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

2015-09-02 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. > > > The checker isn't currently path sensitive as it doesn't pay attention > > > > > > > to control flow graphs or how pointer values flow through a function > > > > > > > body. I suppose this is a matter of scope more than anything; I see a >

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

2015-09-02 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. The full output log I got when building clang was very big. 47MB. Roughly half of that is lines saying "In file included from". I also saw false positives for constructors. The initialisation list is not considered properly. I reduced the output with this grep

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

2015-09-02 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. After looking at 5 of the warnings for Clang.. it is obvious that there are lots of FP for this code. I will fix these so a better log for Clang can be shown. http://reviews.llvm.org/D12359 ___ cfe-commits mailing

Re: [PATCH] D12619: [Static Analyzer] Minor cleanups for the nullability checker.

2015-09-04 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a subscriber: danielmarjamaki. danielmarjamaki added a comment. Overall.. LGTM Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:78 @@ -78,2 +77,3 @@ + llvm_unreachable("Unexpected enumeration."); return ""; } After

RE: r246646 - Silence a -Wsign-compare warning; NFC.

2015-09-02 Thread Daniel Marjamäki via cfe-commits
Hello! In general I am scared of such fixes. I assume we know that Info::MaxTables is never a negative value now. However if it would (by mistake) get a negative value in the future then you are hiding an important TP warning here. I assume we know that Info::MaxTables is never larger than

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

2015-09-28 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. Thanks! Very good comments. I will look at the comments asap. but unfortunately I don't have time right now. I expect that I can continue working on this warning in a few weeks. Comment at: include/clang/AST/DeclBase.h:279 @@ +278,3 @@ + ///

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

2015-09-23 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 35482. danielmarjamaki marked 9 inline comments as done. danielmarjamaki added a comment. With the previous patch there was much noise when building Clang. I have fixed many false positives with improved handling of C++ code. However I have not been

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

2015-09-24 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a reviewer: zaks.anna. danielmarjamaki added a subscriber: cfe-commits. This is a new static analyzer checker that warns when there is loss of sign and loss of precision. It is similar in spirit to Wsign-compare/Wsign-conversion etc.

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

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

[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

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

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

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

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

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:

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)

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

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

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

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

2016-01-05 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 43997. danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. Refactorings thanks to review comments http://reviews.llvm.org/D13126 Files: lib/StaticAnalyzer/Checkers/CMakeLists.txt

Re: [PATCH] D9600: Add scan-build python implementation

2016-01-06 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. I like the standalone bear tool. should it really be embedded into clang? Will the standalone tool still be maintained? Comment at: tools/scan-build-py/libear/ear.c:1 @@ +1,2 @@ +/* -*- coding: utf-8 -*- +// The LLVM

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

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] D20853: [clang-tidy] misc-macro-parentheses: Don't insert parentheses in variable declarations. Fixes bugzilla 26273

2016-06-08 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL272128 (authored by danielmarjamaki). Changed prior to commit: http://reviews.llvm.org/D20853?vs=59208=60013#toc Repository: rL LLVM http://reviews.llvm.org/D20853 Files:

Re: [PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

2016-06-15 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision. danielmarjamaki updated this revision to Diff 60803. danielmarjamaki added a comment. updated releasedocs deeper lookup if macro is used only warn when the replacement can be done safely. the expressions "x[y+z]" and y+z[x]"

Re: [PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

2016-06-15 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 60804. danielmarjamaki added a comment. fixed typo in releasenotes http://reviews.llvm.org/D21134 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/MisplacedArrayIndexCheck.cpp

[PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

2016-06-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a reviewer: alexfh. danielmarjamaki added a subscriber: cfe-commits. danielmarjamaki set the repository for this revision to rL LLVM. this is a new check for clang-tidy that diagnoses when it see unusual array index syntax. there is

Re: [PATCH] D20853: [clang-tidy] misc-macro-parentheses: Don't insert parentheses in variable declarations. Fixes bugzilla 26273

2016-06-01 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. > The "possibleVarDecl" could be much more clever. For instance, variable > declarations can at least contain :: < & also, I could handle those better > also but that would mean more false negatives. I now saw bugzilla 27399 also. I do need to handle

[PATCH] D20853: [clang-tidy] misc-macro-parentheses: Don't insert parentheses in variable declarations. Fixes bugzilla 26273

2016-06-01 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added subscribers: cfe-commits, alexfh. danielmarjamaki set the repository for this revision to rL LLVM. This is a quick fix for bugzilla 26273. parentheses should not be inserted in variable declarations. This patch will introduce false

Re: [PATCH] D20853: [clang-tidy] misc-macro-parentheses: Don't insert parentheses in variable declarations. Fixes bugzilla 26273

2016-06-01 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision. danielmarjamaki updated this revision to Diff 59208. danielmarjamaki added a comment. Updated diff. Now also handles bugzilla 27399. http://reviews.llvm.org/D20853 Files: clang-tidy/misc/MacroParenthesesCheck.cpp

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

2016-01-19 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added subscribers: cfe-commits, alexfh. This is a new checker for clang-tidy. This checker will warn when there is a explicit redundant cast of a calculation result to a bigger type. If the intention of the cast is to avoid loss of precision

[PATCH] D16309: Use getCharWidth() instead of magic number

2016-01-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a subscriber: cfe-commits. Use getCharWidth() instead of magic number to handle arbitrary char widths. no change in logical behaviour is intended when getCharWidth() is 8. http://reviews.llvm.org/D16309 Files:

Re: [PATCH] D11035: trivial patch, improve constness

2016-01-19 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a subscriber: rsmith. danielmarjamaki added a comment. ping.. can somebody review. http://reviews.llvm.org/D11035 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2016-02-10 Thread Daniel Marjamäki via cfe-commits
> You can get overflow with / and %. Consider: > > int i = INT_MIN / -1; // similar for % you are right, I did not think of that. imho overflow still seems unlikely for / and %. ..

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

2016-02-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: docs/clang-tidy/checks/misc-misplaced-widening-cast.rst:2 @@ +1,3 @@ +.. title:: clang-tidy - misc-misplaced-widening-cast + +misc-misplaced-widening-cast For information, it seem I had to use

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

2016-02-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: clang-tidy/misc/MisplacedWideningCastCheck.cpp:31 @@ +30,3 @@ + + Finder->addMatcher(returnStmt(has(Cast)), this); + Finder->addMatcher(varDecl(has(Cast)), this); alexfh wrote: > FYI, these matchers can be

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

2016-02-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 47182. danielmarjamaki marked 9 inline comments as done. danielmarjamaki added a comment. Fixed review comments http://reviews.llvm.org/D16310 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp

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

2016-02-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: clang-tidy/misc/MisplacedWideningCastCheck.cpp:79 @@ +78,3 @@ + +void MisplacedWideningCastCheck::check(const MatchFinder::MatchResult ) { + const auto *Cast = Result.Nodes.getNodeAs("Cast"); I looked in

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

2016-02-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 47181. danielmarjamaki added a comment. Fixes according to review comments. http://reviews.llvm.org/D16310 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/MisplacedWideningCastCheck.cpp

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

2016-02-05 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. ping? http://reviews.llvm.org/D16310 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D17140: [clang-tidy] improve misc-misplaced-widening-cast so it also detects portability problems

2016-02-11 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL260665: [clang-tidy] improve misc-misplaced-widening-cast so it also detects… (authored by danielmarjamaki). Changed prior to commit: http://reviews.llvm.org/D17140?vs=47640=47771#toc Repository: rL

[PATCH] D17140: [clang-tidy] improve misc-misplaced-widening-cast so it also detects portability problems

2016-02-11 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a reviewer: alexfh. danielmarjamaki added a subscriber: cfe-commits. danielmarjamaki set the repository for this revision to rL LLVM. The misc-misplaced-widening-cast currently only looks at the size to determine if a cast is widening.

Re: [PATCH] D16309: Use getCharWidth() instead of magic number

2016-02-12 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. ping http://reviews.llvm.org/D16309 ___ 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

2016-02-12 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. ping http://reviews.llvm.org/D13126 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2016-02-10 Thread Daniel Marjamäki via cfe-commits
That is intentional.. you can't get overflow with / , % , & , | , etc... .. Daniel Marjamäki Senior Engineer Evidente ES East AB Warfvinges väg 34 SE-112 51 Stockholm Sweden

SV: [clang-tools-extra] r260225 - [clang-tidy] Add -target in misc-misplaced-widening-cast test so it will work on various bots

2016-02-10 Thread Daniel Marjamäki via cfe-commits
Hello! > I'm not sure this is a good fix. What was the specific issue (and on which > buildbots)? Ok. The buildbots said: FileCheck error: '/home/linaro/buildbot/clang-cmake-thumbv7-a15/stage1/tools/clang/tools/extra/test/clang-tidy/Output/misc-misplaced-widening-cast.cpp.tmp.cpp.msg' is

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

2016-02-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: clang-tools-extra/trunk/clang-tidy/misc/MisplacedWideningCastCheck.cpp:21-23 @@ +20,5 @@ +void MisplacedWideningCastCheck::registerMatchers(MatchFinder *Finder) { + auto Calc = expr(anyOf(binaryOperator(anyOf( +

RE: [clang-tools-extra] r260225 - [clang-tidy] Add -target in misc-misplaced-widening-cast test so it will work on various bots

2016-02-10 Thread Daniel Marjamäki via cfe-commits
Hello! That would make some sense to me. To catch portability issues users could use different relevant targets. Do you know if some do that? Best regards, Daniel Marjamäki ..

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

2016-01-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. For information, I am testing this patch right now.. it will take a while 1-2 days. http://reviews.llvm.org/D13126 ___ cfe-commits mailing list

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

2016-01-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. For information I have now tested latest patch. Statistics: projects: 1804 files:85976 warnings: 100 There were some new interesting warnings and imho they were TP. http://reviews.llvm.org/D16310 ___

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

2016-01-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 45972. danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. fixed review comments, readded 'loss of sign' checking http://reviews.llvm.org/D13126 Files: lib/StaticAnalyzer/Checkers/CMakeLists.txt

Re: [PATCH] D16582: fix array index out of bounds

2016-01-26 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL258911: Fix array index out of bounds (authored by danielmarjamaki). Changed prior to commit: http://reviews.llvm.org/D16582?vs=45991=46102#toc Repository: rL LLVM http://reviews.llvm.org/D16582

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] D16310: new clang-tidy checker misc-long-cast

2016-01-28 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 46235. danielmarjamaki added a comment. Refactoring the AST matching http://reviews.llvm.org/D16310 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/MisplacedWideningCastCheck.cpp

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

2016-01-28 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D16310#337563, @LegalizeAdulthood wrote: > In http://reviews.llvm.org/D16310#335844, @danielmarjamaki wrote: > > > There were some new interesting warnings and imho they were TP. > > > TP? Sorry.. True Positive

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

2016-02-03 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D13126#335929, @danielmarjamaki wrote: > For information, I am testing this patch right now.. it will take a while 1-2 > days. I have run my latest patch.. In 2215 projects it found 875 warnings. For comparison the -Wconversion

Re: [PATCH] D11035: trivial patch, improve constness

2016-01-21 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. http://reviews.llvm.org/D11035 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2016-01-21 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D16310#331538, @LegalizeAdulthood wrote: > If you state what the check does, then > > In http://reviews.llvm.org/D16310#331054, @danielmarjamaki wrote: > > > In http://reviews.llvm.org/D16310#330367, @LegalizeAdulthood wrote: > > > > >

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

2016-01-21 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done. Comment at: clang-tidy/misc/LongCastCheck.cpp:21 @@ +20,3 @@ + Finder->addMatcher( + returnStmt( + has(cStyleCastExpr(has(binaryOperator(anyOf(hasOperatorName("+"), alexfh wrote: > Any reason to

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

2016-01-21 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done. Comment at: clang-tidy/misc/LongCastCheck.cpp:43 @@ +42,3 @@ + +static unsigned getMaxCalculationWidth(ASTContext , const Expr *E) { + E = E->IgnoreParenImpCasts(); LegalizeAdulthood wrote: > Prefer anonymous

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

2016-01-22 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D16310#331538, @LegalizeAdulthood wrote: > If you state what the check does, then > > In http://reviews.llvm.org/D16310#331054, @danielmarjamaki wrote: > > > In http://reviews.llvm.org/D16310#330367, @LegalizeAdulthood wrote: > > > > >

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

2016-01-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 5 inline comments as done. danielmarjamaki added a comment. http://reviews.llvm.org/D16310 ___ 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

2016-01-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 7 inline comments as done. danielmarjamaki added a comment. 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] D16310: new clang-tidy checker misc-long-cast

2016-01-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 3 inline comments as done. Comment at: docs/clang-tidy/checks/misc-long-cast.rst:11 @@ +10,3 @@ + +Example code:: + alexfh wrote: > LegalizeAdulthood wrote: > > Please add an example for another type other than `long`, such as casting a >

[PATCH] D16582: fix array index out of bounds

2016-01-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a subscriber: cfe-commits. danielmarjamaki set the repository for this revision to rL LLVM. This little patch fixes possible array index out of bounds: [tools/clang/lib/Driver/MSVCToolChain.cpp:147]: (error) Array 'partialKey[256]'

Re: [PATCH] D16582: fix array index out of bounds

2016-01-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added reviewers: rnk, hans, chandlerc, majnemer. danielmarjamaki added a comment. adding reviewers according to 'svn blame' and CODE_OWNERS.txt Repository: rL LLVM http://reviews.llvm.org/D16582 ___ cfe-commits mailing list

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

2016-01-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision. danielmarjamaki updated this revision to Diff 45378. danielmarjamaki added a comment. Fixed review comment; s/checker/check/ http://reviews.llvm.org/D16310 Files: clang-tidy/misc/CMakeLists.txt

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

2016-01-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D16310#330367, @LegalizeAdulthood wrote: > Why not supply a fixit that removes the cast? I am skeptic. There are different valid fixes. Example code: l = (long)(a*1000); Fix1: l = ((long)a * 1000); Fix2: l = (a *

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

2016-01-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D16310#330312, @Eugene.Zelenko wrote: > Clang-tidy has 6 cast related checks. May be this is good time to introduce > dedicated category for them? I am not against this. I don't know which ones you are thinking about.. but if a

  1   2   3   >