Re: [PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-09-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. > However, I think this check should be part of Clang diagnostics. GCC has > -Wredundant-decls for a long time. I am not against that. What is the criteria? When should it be in the compiler and when should it be in clang-tidy? Personally I think it's natural

Re: [PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-09-19 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. > Will be good idea to detect redundant function prototypes. Yes. Should that have the same ID though? Is it better to have one readability-redundant-declaration or two separate readability-redundant-variable-declaration and readability-redundant-function-dec

Re: [PATCH] D24232: Wbitfiled-constant-conversion : allow ~0 , ~(1<

2016-09-19 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a subscriber: cfe-commits. danielmarjamaki added a comment. ping https://reviews.llvm.org/D24232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-09-19 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision. danielmarjamaki updated this revision to Diff 71775. danielmarjamaki added a comment. run clang-format on test. add release notes. https://reviews.llvm.org/D24656 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/rea

Re: [PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

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

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

2016-09-19 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. ping. https://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] D24507: Add attribute for return values that shouldn't be cast to bool

2016-09-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a subscriber: danielmarjamaki. Comment at: include/clang/Basic/AttrDocs.td:2055 @@ -2054,1 +2054,3 @@ } +def WarnImpcastToBoolDocs : Documentation { + let Category = DocCatFunction; I saw your email on cfe-dev. This sounds like a good idea

Re: [PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

2016-09-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. Thanks! I somehow missed your answer in cfe-dev. I will continue working on this and hopefully have a proper patch soon. https://reviews.llvm.org/D24759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http:

Re: [PATCH] D24232: Wbitfiled-constant-conversion : allow ~0 , ~(1<

2016-09-22 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL282156: Fix Wbitfield-constant-conversion false positives (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D24232?vs=70325&id=72169#toc Repository: rL LLVM https://re

Re: [PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

2016-09-23 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 72252. danielmarjamaki added a comment. Updated CFGBuilder::VisitDoStmt https://reviews.llvm.org/D24759 Files: lib/Analysis/CFG.cpp test/Analysis/uninit-sometimes.cpp test/Analysis/unreachable-code-path.c Index: test/Analysis/unreachable-code

Re: [PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

2016-09-23 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. My change is causing a false negative in the test/Analysis/uninit-sometimes.cpp. As far as I see my change anyway makes the unoptimized CFG better. https://reviews.llvm.org/D24759 ___ cfe-commits mailing list cfe-c

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

2016-09-23 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki abandoned this revision. danielmarjamaki added a comment. Fixed by r282242 https://reviews.llvm.org/D16309 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D24861: [Sema] extend Wshift-op-parentheses so it warns for multiplicative operators

2016-09-23 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added reviewers: dblaikie, rtrieu. danielmarjamaki added a subscriber: cfe-commits. danielmarjamaki set the repository for this revision to rL LLVM. This patch makes Clang warn about following code: a = (b * c >> 2); It might be a good i

[PATCH] D24905: Fix unreachable code false positive, vardecl in switch

2016-09-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added subscribers: cfe-commits, NoQ, zaks.anna, a.sidorin, xazax.hun. danielmarjamaki set the repository for this revision to rL LLVM. This patch fixes false positives for vardecls that are technically unreachable but they are needed. ```

Re: [PATCH] D24905: Fix unreachable code false positive, vardecl in switch

2016-09-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 72455. danielmarjamaki added a comment. Minor updates of testcase Repository: rL LLVM https://reviews.llvm.org/D24905 Files: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp test/Analysis/unreachable-code-path.c Index: test/Analysis/un

Re: [PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

2016-09-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: lib/Analysis/CFG.cpp:2986 @@ -2985,3 +2985,1 @@ -if (!KnownVal.isFalse()) { - // Add an intermediate block between the BodyBlock and the dcoughlin wrote: > You need to keep this check so that the optimi

Re: [PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

2016-09-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 72461. danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. Fixed review comments by Devin. It works better now! https://reviews.llvm.org/D24759 Files: lib/Analysis/CFG.cpp test/Analysis/unreachable-code-path.c Ind

Re: [PATCH] D24861: [Sema] extend Wshift-op-parentheses so it warns for multiplicative operators

2016-09-27 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. Compiling 2064 projects resulted in 904 warnings Here are the results: https://drive.google.com/file/d/0BykPmWrCOxt2N04tYl8zVHA3MXc/view?usp=sharing The results looks acceptable imho. The code looks intentional in many cases so I believe there are users that wil

Re: [PATCH] D24905: Fix unreachable code false positive, vardecl in switch

2016-09-28 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision. danielmarjamaki updated this revision to Diff 72775. danielmarjamaki added a comment. Use !isa. Suggestion by Gabor. https://reviews.llvm.org/D24905 Files: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp test/Analys

Re: [PATCH] D24905: Fix unreachable code false positive, vardecl in switch

2016-09-28 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done. Comment at: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp:195 @@ +194,3 @@ +if (Optional S = I->getAs()) { + if (!isa(S->getStmt())) +return S->getStmt(); yes I agree. https://reviews.ll

Re: [PATCH] D24905: Fix unreachable code false positive, vardecl in switch

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

Re: [PATCH] D24905: Fix unreachable code false positive, vardecl in switch

2016-09-28 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL282574: [StaticAnalyzer] Fix false positives for vardecls that are technically… (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D24905?vs=72775&id=72793#toc Repository:

Re: [PATCH] D24861: [Sema] extend Wshift-op-parentheses so it warns for multiplicative operators

2016-09-28 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision. danielmarjamaki updated this revision to Diff 72797. danielmarjamaki added a comment. Don't write warning for multiplication in LHS of <<. Often the execution order is not important. https://reviews.llvm.org/D24861 Files: l

Re: [PATCH] D24861: [Sema] extend Wshift-op-parentheses so it warns for multiplicative operators

2016-09-28 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. I updated the patch so it does not warn about 'A * B << C'. It's a simple fix. I have not made careful measurements but I guess that the performance penalty is acceptable. https://reviews.llvm.org/D24861 ___ cfe-co

Re: [PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-09-28 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 72802. danielmarjamaki added a comment. Fix review comments https://reviews.llvm.org/D24656 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantDeclarationCheck.cpp cl

Re: [PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-09-28 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 3 inline comments as done. Comment at: clang-tidy/readability/RedundantDeclarationCheck.cpp:39 @@ +38,3 @@ + bool MultiVar = false; + if (const auto *VD = dyn_cast(D)) { +if (VD && VD->getPreviousDecl()->getStorageClass() == SC_Extern && --

[PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

2016-10-03 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki closed this revision. danielmarjamaki added a comment. r283095 https://reviews.llvm.org/D24759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D24905: Fix unreachable code false positive, vardecl in switch

2016-10-03 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D24905#557573, @dcoughlin wrote: > Sorry, missed this patch. > > I think it would good to add a test to make sure we do warn when the var decl > has an initializer, since that will not be executed. > > void varDecl(int X) { > swi

SV: [PATCH] D24861: [Sema] extend Wshift-op-parentheses so it warns for multiplicative operators

2016-10-03 Thread Daniel Marjamäki via cfe-commits
Hello! Moving it to a subgroup such as -Wparentheses is fine for me. I will look at that when I have time. Do you think this warning has an acceptable output then? Best regards, Daniel Marjamäki

[PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-10-05 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. Ping. I am not very happy about how I detect multivariable declarations. But I really don't see any such info in the VarDecl. For instance, the AST dump does not show this info. https://reviews.llvm.org/D24656

[PATCH] D24861: [Sema] extend Wshift-op-parentheses so it warns for multiplicative operators

2016-10-05 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki set the repository for this revision to rL LLVM. danielmarjamaki updated this revision to Diff 73633. danielmarjamaki added a comment. Add new flag : -Wshift-op-parentheses-mul This is not enabled by default. Repository: rL LLVM https://reviews.llvm.org/D24861 Files: includ

[PATCH] D19586: Misleading Indentation check

2016-10-05 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. > MisleadingIndentationCheck.cpp:20 > + > +void MisleadingIndentationCheck::danglingElseCheck( > +const MatchFinder::MatchResult &Result) { There is no handling of tabs and spaces by danglingElseCheck as far as I see. The "if" might for example be inde

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-06 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added subscribers: cfe-commits, dcoughlin, NoQ. danielmarjamaki set the repository for this revision to rL LLVM. Returns when calling an inline function should not be merged in the ExplodedGraph unless they are same. Background post on cfe-d

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added reviewers: NoQ, zaks.anna, dcoughlin, a.sidorin, xazax.hun. danielmarjamaki added a comment. adding reviewers. Repository: rL LLVM https://reviews.llvm.org/D25326 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D25326#564082, @NoQ wrote: > Funny facts about the Environment: > > (a) Environment allows taking SVals of ReturnStmt, which is not an > expression, by transparently converting it into its sub-expression. In fact, > it only stores exp

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. ok. As far as I see it's not trivial to know which ReturnStmt there was when CallExitBegin is created. Do you suggest that I move it or that I try to lookup the ReturnStmt? I guess it can be looked up by looking in the predecessors in the ExplodedGraph? > Final

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D25326#564283, @NoQ wrote: > In https://reviews.llvm.org/D25326#564239, @danielmarjamaki wrote: > > > ok. As far as I see it's not trivial to know which ReturnStmt there was > > when CallExitBegin is created. > > > We're in `HandleBloc

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D25326#564291, @danielmarjamaki wrote: > In https://reviews.llvm.org/D25326#564283, @NoQ wrote: > > > In https://reviews.llvm.org/D25326#564239, @danielmarjamaki wrote: > > > > > ok. As far as I see it's not trivial to know which Return

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision. danielmarjamaki updated this revision to Diff 73926. danielmarjamaki added a comment. Refactoring. https://reviews.llvm.org/D25326 Files: include/clang/Analysis/ProgramPoint.h include/clang/StaticAnalyzer/Core/PathSensitiv

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL283554: [analyzer] Don't merge different return nodes in ExplodedGraph (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D25326?vs=73926&id=73947#toc Repository: rL LLV

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: test/Analysis/unreachable-code-path.c:201 +static int inlineFunction(const int i) { + if (table[i] != 0) +return 1; NoQ wrote: > a.sidorin wrote: > > I have a small question. Is it possible to simplify this

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-10 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D25326#564584, @zaks.anna wrote: > Please, fix the style issues before committing. Sorry I missed that. Ideally it would be possible to run clang-format on the files before committing. but currently I get lots of unrelated changes t

[PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-10-12 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added inline comments. Comment at: clang-tidy/readability/RedundantDeclarationCheck.cpp:60 +auto Diag = diag(D->getLocation(), "redundant '%0' declaration") +<< cast(D)->getName(); +if (!MultiVar && !DifferentHeaders) alexfh wrote:

[PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-10-13 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki set the repository for this revision to rL LLVM. danielmarjamaki updated this revision to Diff 74478. danielmarjamaki added a comment. Herald added a subscriber: modocache. changed cast(D)->getName() to cast(D) Repository: rL LLVM https://reviews.llvm.org/D24656 Files: clan

[PATCH] D24861: [Sema] extend Wshift-op-parentheses so it warns for multiplicative operators

2016-10-13 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. Ping Repository: rL LLVM https://reviews.llvm.org/D24861 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-13 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. I agree with the comments from you dcoughlin but I am not sure how to do it. > Can you also add a test that tests this more directly (i.e., with > clang_analyzer_warnIfReached). I don't think it is good to have the only test > for this core coverage issue to be

[PATCH] D25596: alpha.core.Conversion - Fix false positive for 'U32 += S16; ' expression, that is not unsafe

2016-10-14 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a reviewer: NoQ. danielmarjamaki added subscribers: cfe-commits, xazax.hun, dcoughlin. danielmarjamaki set the repository for this revision to rL LLVM. This patch fix false positives for loss of sign in addition and subtraction assignme

[PATCH] D25606: alpha.core.UnreachableCode - don't warn about unreachable code inside macro

2016-10-14 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added reviewers: NoQ, dcoughlin. danielmarjamaki added subscribers: cfe-commits, xazax.hun, zaks.anna, a.sidorin. danielmarjamaki set the repository for this revision to rL LLVM. This patch fixes false positives for such code: #define RETUR

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

2016-08-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 6 inline comments as done. 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(),

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

2016-08-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 68528. danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. Fixed review comments https://reviews.llvm.org/D15332 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/NonConstParameterCheck.cpp clan

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

2016-08-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 68531. danielmarjamaki added a comment. Fixed review comments about formatting in doc https://reviews.llvm.org/D15332 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/NonConstParameterCheck.cpp clang-tidy/readability/NonCons

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

2016-08-23 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL279507: [clang-tidy] readability-non-const-parameter: add new check that warns when… (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D15332?vs=68531&id=68963#toc Reposi

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

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

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

2016-08-24 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 6 inline comments as done. Comment at: clang-tidy/readability/MisplacedArrayIndexCheck.cpp:57 @@ +56,2 @@ +} // namespace tidy +} // namespace clang I removed hasMacroId() and use fixit::getText(). The replacements look good now. ==

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

2016-08-29 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 69558. danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. fix review comments https://reviews.llvm.org/D21134 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/MisplacedArrayIndexCheck.cpp clan

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

2016-08-29 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 4 inline comments 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] D24238: StaticAnalyzer CastToStruct : No memory corruption when casting array to struct

2016-09-12 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. If the -fno-strict-aliasing would fix this warning then it would be OK. If you are telling me that this CastToStruct check is about alignment or endianness then I think the message is highly misleading. We should rewrite the message. In general, using char inst

Re: [PATCH] D24238: StaticAnalyzer CastToStruct : No memory corruption when casting array to struct

2016-09-12 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki abandoned this revision. danielmarjamaki added a comment. hmm.. I don't actually care much about this specific check at the moment. I saw other false positives (unreachable code) and thought that this check made the analyzer think there was corrupted memory. Now I can't reproduc

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

2016-09-12 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL281206: [clang-tidy] readability-misplaced-array-index: add new check that warns when… (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D21134?vs=69558&id=70994#toc Repo

[PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-09-16 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a reviewer: alexfh. danielmarjamaki added a subscriber: cfe-commits. Herald added subscribers: mgorny, beanz. This is a new check that warns about redundant variable declarations. https://reviews.llvm.org/D24656 Files: clang-tidy/rea

Re: [PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-09-16 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. For information, I am testing this on debian packages right now. I will see the results next week. Comment at: clang-tidy/readability/RedundantDeclarationCheck.cpp:22 @@ +21,3 @@ +void RedundantDeclarationCheck::registerMatchers(MatchFinder *Fin

Re: [PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-09-16 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 2 inline comments as done. danielmarjamaki added a comment. https://reviews.llvm.org/D24656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-09-16 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 71614. danielmarjamaki added a comment. minor fixes https://reviews.llvm.org/D24656 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/readability/RedundantDeclarationCheck.cpp clang-tidy

[PATCH] D26911: readability-redundant-declarations: Fix crash

2016-11-21 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL287540: readability-redundant-declaration: Fix crash (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D26911?vs=78706&id=78715#toc Repository: rL LLVM https://reviews

[PATCH] D25606: alpha.core.UnreachableCode - don't warn about unreachable code inside macro

2016-10-17 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 74849. danielmarjamaki added a comment. make pattern to avoid warnings more specific Repository: rL LLVM https://reviews.llvm.org/D25606 Files: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp test/Analysis/unreachable-code-path.c Ind

[PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-10-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment. Ping. Repository: rL LLVM https://reviews.llvm.org/D24656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D25606: alpha.core.UnreachableCode - don't warn about unreachable code inside macro

2016-10-18 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL284477: alpha.core.UnreachableCode - don't warn about unreachable code inside macro (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D25606?vs=74849&id=74990#toc Reposit

[PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-11-01 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL285689: [clang-tidy] Add check readability-redundant-declaration (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D24656?vs=74478&id=76548#toc Repository: rL LLVM htt

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

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 @@ + /// b

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

2015-08-11 Thread Daniel Marjamäki via cfe-commits
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-commits

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

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

SV: [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
ideally there should be no -Wunused-parameter compiler warning when the parameter is used. would it feel better to move the "FP" warnings about virtual functions, for instance to clang-tidy? > If you enable this warning, you probably want to know about unused > parameters, independent of if y

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

2015-08-13 Thread Daniel Marjamäki via cfe-commits
Hello! > If the subset of cases where this warning fires on parameters to virtual > functions produces more noise (if a significant % of cases just result in > commenting out the parameter name rather than removing the parameter) than > signal, it's certainly within the realm of discussion tha

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

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 include/clang/Parse/Parser

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 f

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

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

2015-09-01 Thread Daniel Marjamäki via cfe-commits
Hello! > 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 > logical extension of this functionality being with local variables as >

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

2015-09-01 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-01 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 c

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

2015-09-01 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: 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 in

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 llvm_u

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 include/clang/Parse/Par

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 marked 9 inline comments as done. danielmarjamaki added a comment. I will remove test/SemaCXX/warn-nonconst-parameter.cpp in the next patch since this checker does not handle C++ yet. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:201 @@ -200,1 +200,3 @@

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 FP

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

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

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: include/clang/Bas

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

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 it

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

2015-10-19 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-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 [-Wnoncons

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

  1   2   3   >