[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 test/clang-tidy/mi

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 routinel

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 include/clang/Basic/Diagnosti

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 @@ + if

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

2016-08-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: clang-tidy/readability/MisplacedArrayIndexCheck.cpp:43 @@ +42,3 @@ + +static StringRef getAsString(const MatchFinder::MatchResult &Result, + const Expr *E) { alexfh wrote: > Looks like

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

2016-08-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki set the repository for this revision to rL LLVM. danielmarjamaki updated this revision to Diff 67144. danielmarjamaki added a comment. Fixed review comments. Repository: rL LLVM https://reviews.llvm.org/D21134 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readab

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

2016-08-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision. danielmarjamaki updated this revision to Diff 67145. danielmarjamaki added a comment. Cleanup my previous commit. Ran clang-format. https://reviews.llvm.org/D21134 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/re

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

2016-08-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. In https://reviews.llvm.org/D21134#508511, @aaron.ballman wrote: > Is there a reason we don't want this check to be a part of the clang > frontend, rather than as a clang-tidy check? I discussed this with fronte

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

2016-08-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D21134#508524, @jroelofs wrote: > I think the replacement is wrong for something like: > > int *arr; int offs1, offs2; > offs1[arr + offs2] = 42; > > > which I think would give: > > int *arr; int offs1, offs2; > arr + offs2[offs

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

2016-08-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 67322. danielmarjamaki added a comment. take care of review comments https://reviews.llvm.org/D21134 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/MisplacedArrayIndexCheck.cpp clang-tidy/readability/MisplacedArrayIndexChe

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

2016-08-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 4 inline comments as done. danielmarjamaki added a comment. as far as I see the only unsolved review comment now is about macros. if it can be handled better. Comment at: clang-tidy/readability/MisplacedArrayIndexCheck.cpp:28-29 @@ +27,4 @@ +

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

2016-08-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 2 inline comments as done. Comment at: test/clang-tidy/readability-misplaced-array-index.cpp:31 @@ +30,3 @@ + x[10] = 0; + dostuff(0[0 + ABC]); +} aaron.ballman wrote: > Why is this considered to be "normal syntax" and not worth getting a

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

2016-08-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 67337. danielmarjamaki added a comment. More generic diagnostic. Diagnose all integerType[pointerType] expressions. https://reviews.llvm.org/D21134 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/MisplacedArrayIndexCheck.cpp

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

2016-08-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 67338. danielmarjamaki added a comment. ran clang-format https://reviews.llvm.org/D21134 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/MisplacedArrayIndexCheck.cpp clang-tidy/readability/MisplacedArrayIndexCheck.h clang

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

2016-08-09 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. https://reviews.llvm.org/D21134 ___ 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-08-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 67470. danielmarjamaki added a comment. Make sure patch can be applied in latest trunk. Ping. https://reviews.llvm.org/D13126 Files: include/clang/StaticAnalyzer/Checkers/Checkers.td lib/StaticAnalyzer/Checkers/CMakeLists.txt lib/StaticAnalyz

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

2016-08-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 67500. danielmarjamaki added a comment. Fix patch so it can be applied in latest trunk. Tried to fix review comments. https://reviews.llvm.org/D15332 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/NonConstParameterCheck.cpp

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

2016-08-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 10 inline comments as done. Comment at: test/clang-tidy/readability-non-const-parameter.cpp:117-135 @@ +116,21 @@ +// CHECK-MESSAGES: :[[@LINE+1]]:18: warning: pointer parameter 'p' can be +int return1(int *p) { + // CHECK-FIXES: {{^}}int return1(const int

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

2016-08-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 67504. danielmarjamaki added a comment. fixed more review comments https://reviews.llvm.org/D15332 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/NonConstParameterCheck.cpp clang-tidy/readability/NonConstParameterCheck.h

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

2016-08-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 2 inline comments as done. Comment at: test/clang-tidy/readability-non-const-parameter.cpp:245 @@ +244,3 @@ + C c(p); +} + I have added tests and fixed FPs in latest diff. Comment at: test/clang-tidy/readability-non-const-

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

2016-08-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 67506. danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. added this check to the release notes. run clang-format. https://reviews.llvm.org/D15332 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readabilit

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

2016-08-12 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 67817. danielmarjamaki added a comment. fixed review comments https://reviews.llvm.org/D13126 Files: include/clang/StaticAnalyzer/Checkers/Checkers.td lib/StaticAnalyzer/Checkers/CMakeLists.txt lib/StaticAnalyzer/Checkers/ConversionChecker.cpp

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

2016-08-12 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 3 inline comments as done. Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:67 @@ +66,3 @@ + const Stmt *Parent = PM.getParent(Cast); + if (!Parent) +return; I get assertion failure then when running this test: Analysis/

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

2016-08-15 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:95-98 @@ +94,6 @@ +const QualType T = VD->getType(); +if (T->isPointerType() && !T->getPointeeType().isConstQualified()) + markCanNotBeConst(VD->getInit(), true); +

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 gene

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

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 clang-tidy/mis

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 clang-tidy/misc/MisplacedWi

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 &Result) { + 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 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 -DLLVM_ENABLE_SPHINX

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

2016-02-09 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL260223: [clang-tidy] Add 'misc-misplaced-widening-cast' check. (authored by danielmarjamaki). Changed prior to commit: http://reviews.llvm.org/D16310?vs=47182&id=47310#toc Repository: rL LLVM http:/

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

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 em

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

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 %. .. D

[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] 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&id=47771#toc Repository:

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

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

2016-02-15 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 47962. danielmarjamaki added a comment. Run this check on C++ code also. I have rerun the add_new_check python script. Minor code cleanups. I have run this on the debian packages again. In 1806 projects there were 9691 warnings. I have so far triage

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

2016-02-15 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D15332#352556, @danielmarjamaki wrote: > > I see no warning when running on Clang source code (files in > llvm/tools/clang/lib/...). For information I rerun with --header-filter=* and got some results.. I will triage those.. ht

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

2016-02-16 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 2 inline comments as done. Comment at: docs/clang-tidy/checks/readability-non-const-parameter.rst:15 @@ +14,3 @@ + + // warning here; p should be const + char f1(char *p) { LegalizeAdulthood wrote: > With pointers, there are always two lay

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

2016-03-30 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 52029. danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. Minor fixes of review comments. Renamed functions to "isNegative" and "isGreaterEqual" and return bool. Updated comment. Added testcases for false positives I h

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

2016-03-30 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D13126#381772, @zaks.anna wrote: > Could you add the reduced false positives to the tests file? > > > As far as I see the diagnostics are showing the proper path now.. > > > What do you mean? Does this refer to supplying more information

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

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 templates

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 test/clan

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&id=60013#toc Repository: rL LLVM http://reviews.llvm.org/D20853 Files: clang-tools-extra/trun

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

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]" are

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 clang-tidy/readability/MisplacedArrayIndexCheck.

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

2016-03-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: test/clang-tidy/readability-non-const-parameter.cpp:3 @@ +2,3 @@ + +// Currently the checker only warns about pointer arguments. +// LegalizeAdulthood wrote: > danielmarjamaki wrote: > > LegalizeAdulthood wrote: >

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

2016-03-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 50032. danielmarjamaki added a comment. Updated documentation http://reviews.llvm.org/D15332 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/NonConstParameterCheck.cpp clang-tidy/readability/NonConstParameterCheck.h clang

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

2016-03-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 7 inline comments as done. Comment at: docs/clang-tidy/checks/readability-non-const-parameter.rst:16 @@ +15,3 @@ + // warning here; the declaration "const char *p" would make the function + // interface safer. + char f1(char *p) thanks. I

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

2016-03-08 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 2 inline comments as done. Comment at: test/clang-tidy/readability-non-const-parameter.cpp:4 @@ +3,3 @@ +// Currently the checker only warns about pointer arguments. +// +// It can be defined both that the data is const and that the pointer is const, ---

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

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

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

2016-03-15 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 12 inline comments as done. Comment at: docs/clang-tidy/checks/readability-non-const-parameter.rst:6 @@ +5,3 @@ + +Finds function parameters that should be const. When const is used properly, +many mistakes can be avoided. Advantages when using const properl

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

2016-03-15 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 50705. danielmarjamaki marked 3 inline comments as done. danielmarjamaki added a comment. Fixed review comments http://reviews.llvm.org/D15332 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/NonConstParameterCheck.cpp clang

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

2016-03-21 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

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

2016-03-22 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In http://reviews.llvm.org/D13126#379306, @zaks.anna wrote: > Why is there such a large jump in the number of warnings reported in the last > patch iteration? > It went from "1678 projects where scanned. In total I got 124 warnings" to > "In 2215 projects it fo

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

2016-03-22 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:84 @@ +83,3 @@ +// Can E value be greater or equal than Val? +static bool canBeGreaterEqual(CheckerContext &C, const Expr *E, + unsigned long long Val)

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

2016-03-22 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: test/clang-tidy/readability-non-const-parameter.cpp:116-134 @@ +115,21 @@ + +// CHECK-MESSAGES: :[[@LINE+1]]:18: warning: parameter 'p' can be const +int return1(int *p) { + // CHECK-FIXES: {{^}}int return1(const int *p) {{{$}} +

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

2016-03-23 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:84 @@ +83,3 @@ +// Can E value be greater or equal than Val? +static bool canBeGreaterEqual(CheckerContext &C, const Expr *E, + unsigned long long Val)

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

2016-03-23 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:84 @@ +83,3 @@ +// Can E value be greater or equal than Val? +static bool canBeGreaterEqual(CheckerContext &C, const Expr *E, + unsigned long long Val)

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

2016-03-23 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. Here are some false positives I have marked... let me know if you want more... I have marked this as a FP: URL: ftp://ftp.se.debian.org/debian/pool/main/m/m17n-lib/m17n-lib_1.7.0.orig.tar.gz File: m17n-lib-1.7.0/src/mtext.c Line 1946 Code: int mtext_set_cha

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

2016-03-23 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 51402. danielmarjamaki added a comment. Minor fixes of review comments. - Improved comments about the checker in the source code. - Improved capitalization and punctuation in error messages. - Renamed "canBe..." functions and changed their return type

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

2016-03-23 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 3 inline comments as done. Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:12 @@ +11,3 @@ +// +// ConversionChecker generates a subset of the warnings that are reported by +// Wconversion. It is designed to be an alternative to Wconversion. ---

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 lib/StaticAnalyzer/Checkers/Checker

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 Compiler

[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: lib/Frontend/InitPrep

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 http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[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

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 * (long)1000

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 clang-tidy/misc/LongCastChec

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

2016-01-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment 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] 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 check

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] 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: > > > > > W

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 &C, const Expr *E) { + E = E->IgnoreParenImpCasts(); LegalizeAdulthood wrote: > Prefer anonymous na

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 limi

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

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

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

2016-01-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: clang-tidy/misc/LongCastCheck.cpp:97 @@ +96,3 @@ + + if (!CastType->isIntegerType() || !SubType->isIntegerType()) +return; LegalizeAdulthood wrote: > danielmarjamaki wrote: > > 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] D16310: new clang-tidy checker misc-long-cast

2016-01-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision. danielmarjamaki updated this revision to Diff 45854. danielmarjamaki added a comment. Fixed review comments http://reviews.llvm.org/D16310 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-ti

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

2016-01-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki closed this revision. danielmarjamaki added a comment. Thanks! Committed with r258673 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-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 13 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] 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 ___ cfe-commit

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 lib/StaticAnalyzer/

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 cfe-commits@lists.llv

[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]' acc

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

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&id=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 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 clang-tidy/misc/Mispl

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 Comme

<    1   2   3   >