[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-09-25 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D30295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-09-27 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 116865. danielmarjamaki added a comment. fixed review comments Repository: rL LLVM https://reviews.llvm.org/D30295 Files: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h lib/StaticAnalyzer/Checkers/ConversionChecker.cpp lib

[PATCH] D28148: [Sema] Suppress warnings for C's zero initializer

2017-09-29 Thread Daniel Marjamäki via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL314499: [Sema] Suppress warnings for C's zero initializer (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D28148?vs=82849&id=117107#toc Repository: rL LLVM https://r

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-10-04 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D30295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

2017-10-04 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D36471 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-10-06 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 117956. danielmarjamaki added a comment. Herald added a subscriber: szepet. Fixes according to review comments. Reuse ast matchers in LoopUnrolling.cpp. Avoid some recursion (however the isChanged() is still recursive but it is very small and simple)

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-10-06 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki marked an inline comment as done. danielmarjamaki added inline comments. Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:107 +/** Recursively check if variable is changed in code. */ +static bool isChanged(const Stmt *S, const VarDecl *VD, bool Write) { + if (

[PATCH] D38675: [analyzer] MisusedMovedObjectChecker: Moving the checker out of alpha state

2017-10-09 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a reviewer: danielmarjamaki. danielmarjamaki added a comment. > However, the checker seems to work with a low false positive rate. (<15 on > the LLVM, 6 effectively different) This does not sound like a low false positive rate to me. Could you describe what the false posi

[PATCH] D38674: [analyzer] MisusedMovedObjectChecker: More precise warning message

2017-10-09 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. LGTM https://reviews.llvm.org/D38674 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D38675: [analyzer] MisusedMovedObjectChecker: Moving the checker out of alpha state

2017-10-10 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D38675#891912, @xazax.hun wrote: > In https://reviews.llvm.org/D38675#891750, @danielmarjamaki wrote: > > > > However, the checker seems to work with a low false positive rate. (<15 > > > on the LLVM, 6 effectively different) > > > >

[PATCH] D38718: Patch to Bugzilla 20951

2017-10-10 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a reviewer: danielmarjamaki. danielmarjamaki added a comment. I think a test for -Wtautological-pointer-compare should be added that shows that the bug is fixed. Comment at: test/Sema/conditional-expr.c:84 + //char x; + return (((x != ((void *) 0)) ? (*

[PATCH] D38718: [Sema] No -Wtautological-pointer-compare warning on variables within parentheses

2017-10-10 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. LGTM! However I would like to see a review from somebody else also. There are a number of diagnostics that might be affected. The Sema::DiagnoseAlwaysNonNullPointer diagnoses these: diag::warn_this_null_compare diag::warn_this_bool_conversion diag::warn_address_

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

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

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-10-11 Thread Daniel Marjamäki via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL315462: [Analyzer] Clarify error messages for undefined result (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D30295?vs=116865&id=118620#toc Repository: rL LLVM htt

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-10-11 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D37897#892667, @dcoughlin wrote: > Apologies for the delay reviewing! As I noted inline, I'm pretty worried > about the performance impact of this. Is it possible to do the analysis in a > single traversal of the translation unit? I

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-10-12 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments. Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:123 + // Is variable changed anywhere in TU? + for (const Decl *D : AMgr.getASTContext().getTranslationUnitDecl()->decls()) { +if (isChanged(D, VD)) dcoughlin wrote:

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-10-12 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments. Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:123 + // Is variable changed anywhere in TU? + for (const Decl *D : AMgr.getASTContext().getTranslationUnitDecl()->decls()) { +if (isChanged(D, VD)) danielmarjamaki w

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-10-13 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 118947. danielmarjamaki added a comment. Track modification of global static variables in CallGraph construction Repository: rL LLVM https://reviews.llvm.org/D37897 Files: include/clang/AST/Decl.h include/clang/StaticAnalyzer/Core/PathSensiti

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-10-13 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments. Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:123 + // Is variable changed anywhere in TU? + for (const Decl *D : AMgr.getASTContext().getTranslationUnitDecl()->decls()) { +if (isChanged(D, VD)) danielmarjamaki w

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

2017-10-16 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D36471 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D38921: [analyzer] LoopUnrolling: update the matched assignment operators

2017-10-16 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. LGTM.. however I would like approval from somebody else also. https://reviews.llvm.org/D38921 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D38801: [analyzer] In getSVal() API, disable auto-detection of void type as char type.

2017-10-16 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. LGTM https://reviews.llvm.org/D38801 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D39049: [analyzer] Fix wrong calculation of offset in ArrayBoundsV2

2017-10-18 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki created this revision. Herald added a subscriber: szepet. Example code: void test3_simplified_offset(int x, unsigned long long y) { int buf[100]; if (x < 0) x = 0; for (int i = y - x; i > 0 && i < 100; i++) buf[i] = 0; // no-warning } Without this patc

[PATCH] D39031: [Analyzer] Correctly handle parameters passed by reference when bodyfarming std::call_once

2017-10-19 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a reviewer: danielmarjamaki. danielmarjamaki added a comment. Stylistically this looks pretty good to me. Just a minor nit. Comment at: lib/Analysis/BodyFarm.cpp:389 + for (unsigned int i = 2; i < D->getNumParams(); i++) { + +const ParmVarDecl *PDecl

[PATCH] D35109: [Analyzer] SValBuilder Comparison Rearrangement

2017-10-19 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. I like this patch overall.. here are some stylistic nits. Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:610 +} else { + if (*lInt >= *rInt) { +newRhsExt = lInt->getExtValue() - rInt->getExtVal

[PATCH] D38986: [Analyzer] Better unreachable message in enumeration

2017-10-19 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. > I think it is much better when the assert failure tells the developer _what_ > value is failing, rather than saying "oops we are dead". yes of course, more informative assert messages is better. https://reviews.llvm.org/D38986 _

[PATCH] D39015: [Analyzer] Always use non-reference types when creating expressions in BodyFarm, removes std::call_once crash

2017-10-19 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments. Comment at: cfe/trunk/lib/Analysis/BodyFarm.cpp:139 -DeclRefExpr *ASTMaker::makeDeclRefExpr(const VarDecl *D, - bool RefersToEnclosingVariableOrCapture, - bool Get

[PATCH] D30489: [analyzer] catch out of bounds for VLA

2017-10-19 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 119590. danielmarjamaki added a comment. Herald added a subscriber: szepet. As suggested, use a ProgramState trait to detect VLA overflows. I did not yet manage to get a SubRegion from the DeclStmt that matches the location SubRegion. Therefore I am

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-05-26 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D30295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-05-26 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D31029 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-06-19 Thread Daniel Marjamäki via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. danielmarjamaki marked an inline comment as done. Closed by commit rL305669: [analyzer] Fix logical not for pointers with different bit width (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.or

[PATCH] D32346: [clang-tidy] New readability check for strlen argument

2017-06-19 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki abandoned this revision. danielmarjamaki added a comment. I will not continue working on this checker Repository: rL LLVM https://reviews.llvm.org/D32346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.or

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-06-22 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 103585. danielmarjamaki added a comment. Fix review comments Repository: rL LLVM https://reviews.llvm.org/D30295 Files: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h lib/StaticAnalyzer/Checkers/ConversionChecker.cpp lib/S

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-06-22 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki marked 4 inline comments as done. danielmarjamaki added inline comments. Comment at: lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp:126 + << BinaryOperator::getOpcodeStr(B->getOpcode()) + << "' expression is undefined due to shift count >=

[PATCH] D36670: misc-misplaced-widening-cast: fix assertion

2017-08-28 Thread Daniel Marjamäki via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL311984: [clang-tidy] Fix 'misc-misplaced-widening-cast' assertion error. (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D36670?vs=110940&id=113026#toc Repository: rL

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-08-31 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D30295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D30691: [analyzer] Support for naive cross translational unit analysis

2017-08-31 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments. Comment at: tools/scan-build-py/libscanbuild/analyze.py:165 +with open(filename, 'r') as in_file: +for line in in_file: +yield line I believe you can write: for line in op

[PATCH] D34512: Add preliminary Cross Translation Unit support library

2017-08-31 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. small nits Comment at: include/clang/CrossTU/CrossTranslationUnit.h:58 + +/// \brief This function can parse an index file that determines which +///translation unit contains which definition. I suggest that "can" is rem

[PATCH] D30691: [analyzer] Support for naive cross translational unit analysis

2017-09-01 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki accepted this revision. danielmarjamaki added inline comments. This revision is now accepted and ready to land. Comment at: tools/scan-build-py/libscanbuild/analyze.py:165 +with open(filename, 'r') as in_file: +for line in in_file: +

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-09-06 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D30295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

2017-09-06 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 113969. danielmarjamaki added a comment. minor code cleanup Repository: rL LLVM https://reviews.llvm.org/D36471 Files: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h lib/StaticAnalyzer/Core/ExprEngineC.cpp lib/StaticAna

[PATCH] D28148: [Sema] Suppress warnings for C's zero initializer

2017-09-06 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. This is not committed as far as I see.. do you have write permission or do you want that I commit it? https://reviews.llvm.org/D28148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-09-14 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D30295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

2017-09-14 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D36471 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-09-15 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki created this revision. I saw a false positive where the analyzer made wrong conclusions about a static variable. Static variables that are not written have known values (initialized values). This is the (simplified) code that motivated me to create this patch: static char *al

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-09-15 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 115385. danielmarjamaki added a comment. Minor cleanups. Changed names. Updated comments. Repository: rL LLVM https://reviews.llvm.org/D37897 Files: include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h lib/StaticAnalyzer/Core/ExprEngi

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-09-15 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D37897#871858, @xazax.hun wrote: > Out of curiosity, does the false positive disappear after making the static > variables const? Yes that fixes the false positive Repository: rL LLVM https://reviews.llvm.org/D37897 _

[PATCH] D36141: [StaticAnalyzer] Fix FP in UnreachableCodeChecker

2017-08-01 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki created this revision. Herald added a subscriber: whisperity. This fixes a FP. Without the fix, the checker says that "static int x;" is unreachable. Repository: rL LLVM https://reviews.llvm.org/D36141 Files: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp test/An

[PATCH] D36141: [StaticAnalyzer] Fix FP in UnreachableCodeChecker

2017-08-02 Thread Daniel Marjamäki via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL309799: [StaticAnalyzer] Fix false positives for unreachable code in macros. (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D36141?vs=109086&id=109294#toc Repository:

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-08-03 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 109590. danielmarjamaki added a comment. Cleaned up the patch a little. Thanks Gabor for telling me about SValBuilder::getKnownValue() Repository: rL LLVM https://reviews.llvm.org/D30295 Files: include/clang/StaticAnalyzer/Core/PathSensitive/C

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

2017-08-08 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki created this revision. In the code below the division result should be a value between 5 and 25. if (a >= 10 && a <= 50) { int b = a / 2; } This patch will calculate results for additions, subtractions and divisions. I intentionally do not try to handle all possible case

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

2017-08-08 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 110220. danielmarjamaki added a comment. A minor code cleanup. No functional change. Repository: rL LLVM https://reviews.llvm.org/D36471 Files: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h lib/StaticAnalyzer/Core/ExprEn

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

2017-08-08 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D36471#835410, @xazax.hun wrote: > Can't you reuse somehow some machinery already available to evaluate the > arithmetic operators? Those should already handle most of your TODOs and > overflows. Sounds good.. I have not seen that m

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

2017-08-09 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 110378. danielmarjamaki added a comment. Refactoring, use BasicValueFactory::evalAPSInt Repository: rL LLVM https://reviews.llvm.org/D36471 Files: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h lib/StaticAnalyzer/Core/Exp

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

2017-08-09 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. Should evalAPSInt() have machinery to do standard sign/type promotions? I suggest that I add one more argument `bool promote = false`, do you think that sounds good? Repository: rL LLVM https://reviews.llvm.org/D36471 _

[PATCH] D36670: misc-misplaced-widening-cast: fix assertion

2017-08-14 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. LGTM. I let others approve this. Repository: rL LLVM https://reviews.llvm.org/D36670 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D36672: [clang-tidy] readability-non-const-parameter: fixit on all function declarations

2017-08-14 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. LGTM. But others should approve. Repository: rL LLVM https://reviews.llvm.org/D36672 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-08-23 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D30295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D92634: [Analyzer] Diagnose signed integer overflow

2020-12-14 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki abandoned this revision. danielmarjamaki added a comment. No reviews => I will not contribute. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92634/new/ https://reviews.llvm.org/D92634 ___

[PATCH] D92634: [Analyzer] Diagnose signed integer overflow

2020-12-03 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added reviewers: NoQ, xazax.hun. Herald added subscribers: steakhal, ASDenysPetrov, martong, Charusso, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. danielmarjamaki requested review of this r

[PATCH] D39049: [analyzer] Fix wrong calculation of offset in ArrayBoundsV2

2017-10-26 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. > Do you mind writing some tests with multidimensional arrays to check what do > we lose if we remove that code? I have spent a few hours trying to write a test case that shows there is false negatives caused by this change. And fail. I see lots of false negati

[PATCH] D36471: [StaticAnalyzer] Try to calculate arithmetic result when operand has a range of possible values

2017-11-06 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 121726. danielmarjamaki added a comment. Herald added a subscriber: szepet. I have updated the patch so it uses evalBinOpNN. This seems to work properly. I have a number of TODOs in the test cases that should be fixed. Truncations are not handled pro

[PATCH] D39049: [analyzer] Fix wrong calculation of offset in ArrayBoundsV2

2017-11-15 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. > Could you do a similar analysis that I did above to check why does this not > work for the multidimensional case? (I.e.: checking what constraints are > generated and what the analyzer does with them.) the "location.dump()" will just say "x". the ProgramState

[PATCH] D39049: [analyzer] Fix wrong calculation of offset in ArrayBoundsV2

2017-11-17 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. > So what are the arguments that are passed to getSimplifiedOffset() in that > case? 0? That does not seem to be correct. yes. so the conclusion is: - this code does not work - this code is untested - this code is not even used in the use cases it was intended

[PATCH] D28148: [Sema] Suppress warnings for C's zero initializer

2017-01-02 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. Thanks for working on these. imo these are false positives. Comment at: lib/AST/Expr.cpp:1893 + + const IntegerLiteral *lit = dyn_cast(getInit(0)); + if (!lit) { I would recommend capital first letter for this variable =

[PATCH] D28278: [StaticAnalyzer] dont show wrong 'garbage value' warning when there is array index out of bounds

2017-01-03 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added reviewers: zaks.anna, dcoughlin. danielmarjamaki added a subscriber: cfe-commits. danielmarjamaki set the repository for this revision to rL LLVM. Example code: void f1(int x) { int a[20] = {0}; if (x==25) {} if (a[x] == 1

[PATCH] D28297: [StaticAnalyzer] Fix crash in CastToStructChecker

2017-01-04 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki created this revision. danielmarjamaki added a reviewer: NoQ. danielmarjamaki added a subscriber: cfe-commits. danielmarjamaki set the repository for this revision to rL LLVM. This fix the crash reported in https://llvm.org/bugs/show_bug.cgi?id=31173 Repository: rL LLVM https:

[PATCH] D28278: [StaticAnalyzer] dont show wrong 'garbage value' warning when there is array index out of bounds

2017-01-10 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D28278#639710, @xazax.hun wrote: > Did you experience any problems with the array out of bounds check lately? In > case it was stable on large code-bases and did not give too many false > positives, I think it might be worth to move t

[PATCH] D28148: [Sema] Suppress warnings for C's zero initializer

2017-01-11 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki accepted this revision. danielmarjamaki added a reviewer: danielmarjamaki. danielmarjamaki added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D28148 ___ cfe-commits mailing list cfe-commit

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-03-15 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. Ping Repository: rL LLVM https://reviews.llvm.org/D30295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-03-16 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki created this revision. The Static Analyzer assumed that all pointers had the same bit width. Now pass the type to the 'makeNull' method, to construct a null pointer of the appropiate bit width. Example code that does not work well: int main(void) {   __cm void *cm_p = 0;  

[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-03-16 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. I am not sure where to look. I heard somebody say OpenCL has different pointer widths. Repository: rL LLVM https://reviews.llvm.org/D31029 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-03-17 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 92150. danielmarjamaki added a comment. Fix review comments Repository: rL LLVM https://reviews.llvm.org/D30295 Files: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h lib/StaticAnalyzer/Checkers/ConversionChecker.cpp lib/St

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-03-17 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki marked 2 inline comments as done. danielmarjamaki added inline comments. Comment at: lib/StaticAnalyzer/Core/CheckerHelpers.cpp:100 + BinaryOperatorKind BOK, +

[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls

2017-03-17 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki created this revision. Herald added a subscriber: JDevlieghere. This patch fixes https://bugs.llvm.org/show_bug.cgi?id=32246 To avoid spurious warnings, clang-tidy should not warn about misplaced widening casts for implicit casts in function calls. Repository: rL LLVM https:

[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls

2017-03-17 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In my opinion, we should stop warning about all implicit casts. Take for instance: long l1; if (condition) l1 = n << 8; // <- implicit cast else l1 = ~0L; That is fine. Nothing suspicious. Just because the destination variable is long doesn't hav

[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls

2017-03-20 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D31097#704628, @alexfh wrote: > In https://reviews.llvm.org/D31097#704626, @alexfh wrote: > > > In https://reviews.llvm.org/D31097#704621, @xazax.hun wrote: > > > > > I wonder whether warning on implicit casts still makes sense for ex

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-03-20 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 92315. danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. Fix review comment. Made isShiftOverflow() static. Repository: rL LLVM https://reviews.llvm.org/D30295 Files: include/clang/StaticAnalyzer/Core/PathSensit

[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls

2017-03-20 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 92322. danielmarjamaki added a comment. Remove warnings for implicit casts. Repository: rL LLVM https://reviews.llvm.org/D31097 Files: clang-tidy/misc/MisplacedWideningCastCheck.cpp clang-tidy/misc/MisplacedWideningCastCheck.h docs/clang-ti

[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls

2017-03-20 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. I believe there is pointless code in relativeIntSizes etc. If there is for instance "a+b" then the result can't be a char type. static int relativeIntSizes(BuiltinType::Kind Kind) { switch (Kind) { case BuiltinType::UChar: return 1; case Built

[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls

2017-03-22 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D31097#707385, @baloghadamsoftware wrote: > Hi! > > There is an option to disable the checking of widening casts. It is enabled > by default. You can disable it any time. Or, if you find too much false > positives, we can discuss abou

[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls

2017-03-22 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. Well.. feel free to provide an alternative fix. If the message is more specific and it must be enabled explicitly by an option then maybe it's good enough for me. Repository: rL LLVM https://reviews.llvm.org/D31097

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

2017-03-22 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 92634. danielmarjamaki added a comment. I added more testcases. There are several undetected "TODO: loss of precision" right now in the tests that I would like to fix. If this patch to fix FP is accepted I will commit it and continue working on the T

[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-03-23 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 92773. danielmarjamaki added a comment. Added a testcase that will crash without the fix. Used the amdgcn target as that happens to use different pointer bit widths for different address spaces. Updated the comment. I am not good at english so I hope

[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-03-23 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D31029#703428, @zaks.anna wrote: > Are there other cases where makeNull would need to be replaced? There might be. As I understand it, this is the only known case at the moment. Repository: rL LLVM https://reviews.llvm.org/D31029

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

2017-03-23 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 92810. danielmarjamaki added a comment. Updated the patch so all the loss of precision are detected also Repository: rL LLVM https://reviews.llvm.org/D25596 Files: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp test/Analysis/conversion.c

[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-03-23 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki marked an inline comment as done. danielmarjamaki added a comment. In https://reviews.llvm.org/D31029#708567, @danielmarjamaki wrote: > In https://reviews.llvm.org/D31029#703428, @zaks.anna wrote: > > > Are there other cases where makeNull would need to be replaced? > > > There mi

[PATCH] D30691: [analyzer] Support for naive cross translational unit analysis

2017-03-31 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments. Comment at: include/clang/AST/ASTContext.h:42 #include "clang/Basic/Specifiers.h" +#include "clang/Basic/VersionTuple.h" #include "llvm/ADT/APSInt.h" I don't see why this is included here. Comment at: in

[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-04-03 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. Ping Repository: rL LLVM https://reviews.llvm.org/D31029 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

2017-04-03 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. Ping Repository: rL LLVM https://reviews.llvm.org/D30295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2017-04-03 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. Ping Repository: rL LLVM https://reviews.llvm.org/D25596 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D30691: [analyzer] Support for naive cross translational unit analysis

2017-04-03 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments. Comment at: tools/xtu-analysis/xtu-analyze.py:29 + +threading_factor = int(multiprocessing.cpu_count() * 1.5) +analyser_output_formats = ['plist-multi-file', 'plist', 'plist-html', gerazo wrote: > danielmarjamaki wrote: > >

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

2017-04-05 Thread Daniel Marjamäki via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL299523: [analyzer] alpha.core.Conversion - Fix false positive for 'U32 += S16;'… (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D25596?vs=92810&id=94176#toc Repository

[PATCH] D31650: [Analyzer] Detect when function pointer is freed

2017-04-05 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D31650#717691, @NoQ wrote: > Is freeing function pointers always undefined? I guess not.. however I don't personally see why it would be useful to allocate function pointers with malloc. > I wonder what happens if we take some JIT

[PATCH] D31650: [Analyzer] Detect when function pointer is freed

2017-04-05 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. > void *p = malloc(sizeof(fnptr)); sorry ... I guess that should be something like "void *p = malloc(100);" Repository: rL LLVM https://reviews.llvm.org/D31650 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[PATCH] D30489: [analyzer] catch out of bounds for VLA

2017-04-10 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 94509. danielmarjamaki added a comment. This is just work in progress!! With these changes Clang static analyzer will detect overflow in this sample code: void foo(int X) { char *Data = new char[X]; Data[X] = 0; // <- error delete[] Da

[PATCH] D31886: [analyzer] Simplify values in binary operations more aggressively

2017-04-12 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments. Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:49 + /// Recursively descends into symbolic expressions and replaces symbols + /// with thier known values (in the sense of the getKnownValue() method). + SVal simplifySVal(Program

[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

2017-04-12 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. Thanks! Looks like a valueable addition. Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2004 +void CStringChecker::evalMemset(CheckerContext &C, const CallExpr *CE) const { + if (CE->getNumArgs() < 3) +return; e

[PATCH] D30909: [Analyzer] Finish taint propagation to derived symbols of tainted regions

2017-04-12 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h:45 +: public ProgramStatePartialTrait { + static void *GDMIndex() { static int index = 0; return &index; } +}; Nit: =0 is redundant https://

[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

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

  1   2   >