[PATCH] D80903: [analyzer] Ignore calculated indices of <= 0 in VLASizeChecker

2020-06-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Here is an improved fix for the problem: D81061 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80903/new/ https://reviews.llvm.org/D80903 ___

[PATCH] D81061: [Analyzer][VLASizeChecker] Fix problem with zero index assumption.

2020-06-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. There may be still a problem somewhere else. I think assume of "a" and "a==0" should have the same results. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81061/new/ https://reviews.llvm.org/D81061 _

[PATCH] D83961: [Analyzer] Fix bug report source locations in minimal output.

2020-07-16 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: clang. Fix of the foll

[PATCH] D83120: [Analyzer][StreamChecker] Use BugType::SuppressOnSink at resource leak report.

2020-07-16 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/test/Analysis/stream.c:274-284 // Check that "location uniqueing" works. // This results in reporting only one occurence of resource leak for a stream. void check_leak_noreturn_2() {

[PATCH] D83961: [Analyzer] Fix bug report source locations in minimal output.

2020-07-16 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Lot of tests are failing because changed warning locations. These will be updated if the code change looks good. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83961/new/ https://reviews.llvm.org/D83961 _

[PATCH] D83961: [Analyzer] Fix bug report source locations in minimal output.

2020-07-17 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 278742. balazske marked an inline comment as done. balazske added a comment. Fixed some source location changes in tests. Re-added check for empty path. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83961/new/

[PATCH] D83961: [Analyzer] Fix bug report source locations in minimal output.

2020-07-17 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Big part of the test failures is with the `osx.cocoa.RetainCount` checker. Only a small part of the errors is fixed now. Comment at: clang/lib/Analysis/PathDiagnostic.cpp:369 +} + } if (X.getBugType() != Y.getBugType()) This c

[PATCH] D82845: [Analyzer][StreamChecker] Report every leak, clean up state.

2020-07-17 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 278755. balazske added a comment. Checking notes in test `f_leak_2`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82845/new/ https://reviews.llvm.org/D82845 Files: clang/lib/StaticAnalyzer/Checkers/StreamC

[PATCH] D83970: [ASTImporter] Refactor ASTImporter to support custom downstream tests

2020-07-17 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Future improvement: Split `ASTImporterTest.cpp` into smaller parts. It is still too large. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83970/new/ https://reviews.llvm.org/D83970 __

[PATCH] D72705: [analyzer] Added new checker 'alpha.unix.ErrorReturn'.

2020-07-17 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. The problem with `fgetc` is here that the returned value indicates not only if there was failure or not. In the following (over simplified) example no warning is needed even if there is no check for EOF. Because this case, for such kind of functions any comparison of t

[PATCH] D82845: [Analyzer][StreamChecker] Report every leak, clean up state.

2020-07-19 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 279131. balazske added a comment. Fixed formatting. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82845/new/ https://reviews.llvm.org/D82845 Files: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp clan

[PATCH] D82845: [Analyzer][StreamChecker] Report every leak, clean up state.

2020-07-20 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 279133. balazske added a comment. Rebase to master. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82845/new/ https://reviews.llvm.org/D82845 Files: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp clan

[PATCH] D82845: [Analyzer][StreamChecker] Report every leak, clean up state.

2020-07-20 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG9b7c43d341da: [Analyzer][StreamChecker] Report every leak, clean up state. (authored by balazske). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82845/new/

[PATCH] D72705: [analyzer] Added new checker 'alpha.unix.ErrorReturn'.

2020-07-20 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. This checker can have two purposes, one is to verify that all paths have the error check, other is to find at least one path without error check. The first is the one that can be done with dataflow based analysis but looks like a difficult problem. For example is it po

[PATCH] D83961: [Analyzer] Fix bug report source locations in minimal output.

2020-07-20 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added a comment. The problem in D83120 is fixed by this patch. What I figured out from the code is that `BugReporter::FlushReport` calls `findReportInEquivalenceClass` that returns a report that has not necessar

[PATCH] D72705: [analyzer] Added new checker 'alpha.unix.ErrorReturn'.

2020-07-20 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 279248. balazske added a comment. NFC code improvements. Detect expressions in conditions. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D72705/new/ https://reviews.llvm.org/D72705 Files: clang/include/clang

[PATCH] D83190: [analyzer] Model iterator random incrementation symmetrically

2020-07-21 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Maybe the assert `b.hasValue()` is related to the problems in D83115 or D83961 ? The changes in those affect the same functions. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION http

[PATCH] D83961: [Analyzer] Fix bug report source locations in minimal output.

2020-07-22 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/test/Analysis/malloc-plist.c:137-139 if (y) -y++; -}//expected-warning{{Potential leak}} + y++; //expected-warning{{Potential leak}} +} NoQ wrote: > Thi

[PATCH] D83961: [Analyzer] Fix bug report source locations in minimal output.

2020-07-22 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Every other test failure comes from RetainCount checker except //malloc-plist.c//. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83961/new/ https://reviews.llvm.org/D83961 __

[PATCH] D83120: [Analyzer][StreamChecker] Use BugType::SuppressOnSink at resource leak report.

2020-07-23 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG65fd651980a8: [Analyzer][StreamChecker] Use BugType::SuppressOnSink at resource leak report. (authored by balazske). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm

[PATCH] D83961: [Analyzer] Fix bug report source locations in minimal output.

2020-07-23 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 280149. balazske added a comment. Change column in malloc-plist test because code was reformatted. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83961/new/ https://reviews.llvm.org/D83961 Files: clang/lib/A

[PATCH] D84494: [Analyzer] Use of BugType in DereferenceChecker (NFC).

2020-07-24 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: clang. Use of BuiltinB

[PATCH] D84494: [Analyzer] Use of BugType in DereferenceChecker (NFC).

2020-07-24 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 280385. balazske added a comment. Fixed failed tests because change of bug category from "Logic error" to "Memory error". Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84494/new/ https://reviews.llvm.org/D844

[PATCH] D84520: [Analyzer] Improve invalid dereference bug reporting in DereferenceChecker.

2020-07-24 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: clang. Report undefine

[PATCH] D84520: [Analyzer] Improve invalid dereference bug reporting in DereferenceChecker.

2020-07-24 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added a comment. Not sure if this is a good solution. There are few tests that test the undefined reference case. But the added code should work the same way as in the null pointer case? Comment at: clang/lib/StaticAnalyzer/

[PATCH] D84520: [Analyzer] Improve invalid dereference bug reporting in DereferenceChecker.

2020-07-27 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Change of the existing error messages and checker category is not necessary but it would be improvement because more the uniform error messages. (And not the "logic error" is the best category for this checker, if this value is used at all. Other checkers have bad valu

[PATCH] D83961: [Analyzer] Fix bug report source locations in minimal output.

2020-07-27 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. From the beginning on in this patch I assumed that the location of the bug report should be the end of the bug path. But this is probably a wrong approach, specially if the bug report has uniqueing location. In that case the uniqueing location may be a better place for

[PATCH] D84494: [Analyzer] Use of BugType in DereferenceChecker (NFC).

2020-07-28 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/test/Analysis/Inputs/expected-plists/conditional-path-notes.c.plist:270 descriptionDereference of null pointer (loaded from variable 'x') - categoryLogic error + categoryMemory error typeDereference of null pointer -

[PATCH] D83961: [Analyzer] Fix bug report source locations in minimal output.

2020-07-28 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Then the current solution is good, print always end of the bug path. A change to the bug reporting component was made that caused reported position of bugs to change. New is the end of the path, old is the location set by the checker (`BugReport::getLocation` value). Th

[PATCH] D84316: [analyzer][NFC] Split CStringChecker to modeling and reporting

2020-07-28 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/CStringChecker/CStringLength.h:43 + ProgramStateRef &State, const Expr *Ex, + SVal Buf, bool Hypothetical = false); +

[PATCH] D84843: [Analyzer] Remove inclusion of uniqueing decl from diagnostic profile.

2020-07-29 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: clang. balazske request

[PATCH] D83115: [Analyzer] Report every bug if only uniqueing location differs.

2020-07-29 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Crash is fixed here: D84843 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83115/new/ https://reviews.llvm.org/D83115 ___ cfe-commits mailing li

[PATCH] D84494: [Analyzer] Use of BugType in DereferenceChecker (NFC).

2020-07-29 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 281631. balazske added a comment. Changed MemoryError back to LogicError. Improved placement and text of changed comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84494/new/ https://reviews.llvm.org/D8449

[PATCH] D84494: [Analyzer] Use of BugType in DereferenceChecker (NFC).

2020-07-29 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 2 inline comments as done. balazske added a comment. The category string seems to be not really important, better not to change it. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84494/new/ https://reviews.llvm.org/D84494 __

[PATCH] D84494: [Analyzer] Use of BugType in DereferenceChecker (NFC).

2020-07-29 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGb22b97b3d0c0: [Analyzer] Use of BugType in DereferenceChecker (NFC). (authored by balazske). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84494/new/ https:

[PATCH] D84843: [Analyzer] Remove inclusion of uniqueing decl from diagnostic profile.

2020-07-30 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG1745ba41b196: [Analyzer] Remove inclusion of uniqueing decl from diagnostic profile. (authored by balazske). Repository: rG LLVM Github Monorepo

[PATCH] D75682: [Analyzer][StreamChecker] Introduction of stream error handling.

2020-04-06 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Ping. It is now testable, a sub-checker was added for testing (that can be useful at later improvements too). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75682/new/ https://reviews.llvm.org/D75682 ___

[PATCH] D77410: [analyzer] StdLibraryFunctionsChecker: match signature based on FunctionDecl

2020-04-06 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:553 +QualType ActualT = FD->getParamDecl(I)->getType().getCanonicalType(); assert(ActualT.isCanonical()); if (ActualT != FormalT) This asser

[PATCH] D75682: [Analyzer][StreamChecker] Introduction of stream error handling.

2020-04-06 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/test/Analysis/stream-error.c:1 -// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.unix.Stream -analyzer-checker=debug.ExprInspection -analyzer-store region -verify %s +// RUN: %clang_an

[PATCH] D75682: [Analyzer][StreamChecker] Introduction of stream error handling.

2020-04-06 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 255360. balazske added a comment. - Adding comment about ferror, feof. - Enabled core checker in test file. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75682/new/ https://reviews.llvm.org/D75682 Files: cl

[PATCH] D77305: [Analyzer][VLASize] Support multi-dimensional arrays.

2020-04-06 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 255388. balazske added a comment. Added comments and test for extent. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77305/new/ https://reviews.llvm.org/D77305 Files: clang/lib/StaticAnalyzer/Checkers/VLASiz

[PATCH] D75682: [Analyzer][StreamChecker] Introduction of stream error handling.

2020-04-06 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 255602. balazske marked an inline comment as done. balazske added a comment. Moved test checker to debug package, changed macro to function. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75682/new/ https://rev

[PATCH] D75682: [Analyzer][StreamChecker] Introduction of stream error handling.

2020-04-07 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 255906. balazske added a comment. Adding diff to master. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75682/new/ https://reviews.llvm.org/D75682 Files: clang/include/clang/StaticAnalyzer/Checkers/Checkers.

[PATCH] D75682: [Analyzer][StreamChecker] Introduction of stream error handling.

2020-04-08 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG11bd3e5c6549: [Analyzer][StreamChecker] Introduction of stream error handling. (authored by balazske). Changed prior to commit: https://reviews.llvm.org/D75682?vs=255906&id=255935#toc Repository: rG

[PATCH] D77658: [analyzer] StdLibraryFunctionsChecker: Add sanity checks for constraints

2020-04-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:116 +/// Do sanity check on the constraint. +virtual bool validate(const FunctionDecl *) const { return true; } ArgNo getArgNo() const { return ArgN; } --

[PATCH] D77721: [ASTImporter] Add support for importing fixed point literals

2020-04-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/unittests/AST/ASTImporterTest.cpp:1000 + hasDescendant(fixedPointLiteral(); +} + See test `ImportFloatinglLiteralExpr` for a better implementation of this test. The new test could be inc

[PATCH] D75851: [Analyzer][StreamChecker] Added evaluation of fseek.

2020-04-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:103-110 + /// Return if the specified error kind is possible on the stream in the + /// current state. + /// This depends on the stored `L

[PATCH] D75851: [Analyzer][StreamChecker] Added evaluation of fseek.

2020-04-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 256023. balazske added a comment. - Rebase - Improved comments - Changed `UnknownError` to `Unknown` - Test changes (removed unneeded test) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75851/new/ https://revi

[PATCH] D77721: [ASTImporter] Add support for importing fixed point literals

2020-04-09 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/include/clang/AST/Expr.h:1494 SourceLocation l, unsigned Scale); - // Store the int as is without any bit shifting. This line removal is not needed and can cause disturbances, it is better

[PATCH] D77305: [Analyzer][VLASize] Support multi-dimensional arrays.

2020-04-09 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 256307. balazske marked 3 inline comments as done. balazske added a comment. Small renamings and reformatting. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77305/new/ https://reviews.llvm.org/D77305 Files:

[PATCH] D75851: [Analyzer][StreamChecker] Added evaluation of fseek.

2020-04-09 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 256317. balazske added a comment. Addressed review comments (reformat and rename). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75851/new/ https://reviews.llvm.org/D75851 Files: clang/lib/StaticAnalyzer/Ch

[PATCH] D77809: [Analyzer] Include typedef statements in CFG build.

2020-04-09 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: clang. Array size expr

[PATCH] D77809: [Analyzer] Include typedef statements in CFG build.

2020-04-14 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. I looked at the graphical CFG dump and observed that the added code makes the same parts appear that are there in a VLA declaration but missing if a VLA typedef is used. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77809

[PATCH] D77305: [Analyzer][VLASize] Support multi-dimensional arrays.

2020-04-14 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG37ac1c19bed7: [Analyzer][VLASize] Support multi-dimensional arrays. (authored by balazske). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77305/new/ https:/

[PATCH] D75851: [Analyzer][StreamChecker] Added evaluation of fseek.

2020-04-14 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGf2b5e60dfd09: [Analyzer][StreamChecker] Added evaluation of fseek. (authored by balazske). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75851/new/ https://

[PATCH] D77809: [Analyzer] Include typedef statements in CFG build.

2020-04-14 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 257330. balazske added a comment. - Added tests. - Updated a comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77809/new/ https://reviews.llvm.org/D77809 Files: clang/lib/Analysis/CFG.cpp clang/test/

[PATCH] D77809: [Analyzer] Include typedef statements in CFG build.

2020-04-14 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added a comment. Without the new code the CFG dump for `vla_typedef` contains: [B1] 1: VLA vla; Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77809/new/ https://reviews.llvm.org/D77809

[PATCH] D78126: [analyzer][NFC] Don't allow dependency checkers to emit diagnostics

2020-04-15 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:153 +#undef CHECKER_DEPENDENCY +#undef GET_CHECKER_DEPENDENCIES + } Probably too much of assert here (but it works)? (There is not a way to get the de

[PATCH] D78120: [analyzer][StreamChecker] Don't make StreamTestChecker depend on StreamChecker for the time being

2020-04-15 Thread Balázs Kéri via Phabricator via cfe-commits
balazske accepted this revision. balazske added a comment. This revision is now accepted and ready to land. LGTM But a better approach can be to make a new kind of dependency. (Or split the StreamChecker.) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.o

[PATCH] D77866: [analyzer][CallAndMessage] Add checker options for each bug category

2020-04-15 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h:194 + const ProgramPointTag *Tag = nullptr) { +// Say this 3 times fast. +State = State ? State : getState(); martong wrote:

[PATCH] D77809: [Analyzer] Include typedef statements in CFG build.

2020-04-16 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. > I also see that the typedef constitutes a `DeclStmt` in the AST. Can we > include that in the CFG as well? In the static analyzer that'll be the place > where we actually start tracking that typedef, because without it the size > expression value will be quickly clea

[PATCH] D77809: [Analyzer] Include typedef statements in CFG build.

2020-04-16 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/lib/Analysis/CFG.cpp:2855 + VarDecl *VD = dyn_cast(DS->getSingleDecl()); Szelethus wrote: > How about `using`? How about some other shenanigans that obscure the size

[PATCH] D78280: [Analyzer][StreamChecker] Track streams that were not found to be opened.

2020-04-16 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: clang. If a stream ope

[PATCH] D78374: [Analyzer][StreamChecker] Added evaluation of fread and fwrite.

2020-06-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske abandoned this revision. balazske added a comment. Yes, closing it. (Will change `StreamErrorState` probably to bitfield later.) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78374/new/ https://reviews.llvm.org/D78374 __

[PATCH] D81061: [Analyzer][VLASizeChecker] Fix problem with zero index assumption.

2020-06-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 2 inline comments as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp:127-129 +// Despite the previous assumptions for non-zero and positiveness, +// this value might be zero or negative. +

[PATCH] D81061: [Analyzer][VLASizeChecker] Fix problem with zero index assumption.

2020-06-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 268216. balazske added a comment. Improved assumption on array size. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81061/new/ https://reviews.llvm.org/D81061 Files: clang/lib/StaticAnalyzer/Checkers/VLASize

[PATCH] D80699: [Analyzer][StreamChecker] Add check for pointer escape.

2020-06-04 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 2 inline comments as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:439-441 + // Do not handle untracked stream. It is probably escaped. + if (!State->get(StreamSym)) +return; Szelethus

[PATCH] D80699: [Analyzer][StreamChecker] Add check for pointer escape.

2020-06-04 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 268459. balazske added a comment. Using range-based for loop. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80699/new/ https://reviews.llvm.org/D80699 Files: clang/lib/StaticAnalyzer/Checkers/StreamChecker.

[PATCH] D80725: [Analyzer][StreamChecker] Updated initialization of BugType's.

2020-06-04 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG0bfd70bdad7e: [Analyzer][StreamChecker] Updated initialization of BugType's. (authored by balazske). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80725/new/

[PATCH] D80699: [Analyzer][StreamChecker] Add check for pointer escape.

2020-06-05 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 268696. balazske added a comment. Rebased. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80699/new/ https://reviews.llvm.org/D80699 Files: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp clang/test/An

[PATCH] D80699: [Analyzer][StreamChecker] Add check for pointer escape.

2020-06-05 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 268701. balazske added a comment. Removed bad empty line. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80699/new/ https://reviews.llvm.org/D80699 Files: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp

[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: clang. Bug reports of

[PATCH] D81061: [Analyzer][VLASizeChecker] Fix problem with zero index assumption.

2020-06-09 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 2 inline comments as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp:130-131 +// At least check for zero again. +// Assume that this is a more exact fact than the previous assumptions +

[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-11 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. In D81407#2080273 , @Szelethus wrote: > > If there are multiple resource leak paths for the same stream, only one wil > > be reported. > > What is the rationale behind this? Do all leaks from the same opening > describe the same

[PATCH] D72705: [analyzer] Added new checker 'alpha.unix.ErrorReturn'.

2020-06-11 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. After running the checker I could observe the following problems: time_t now = time(NULL); if (now > 0) { ... } Here only `now == EOF` would be correct for the checker, so this case is reported (false positive). It may be better if the checker finds any "now > //x

[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-11 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 270140. balazske added a comment. - Report every path of resource leak. - Do not report if non-returning function was encountered. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81407/new/ https://reviews.llvm.

[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-11 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 270161. balazske added a comment. - Added tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81407/new/ https://reviews.llvm.org/D81407 Files: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp clang/t

[PATCH] D80699: [Analyzer][StreamChecker] Add check for pointer escape.

2020-06-15 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGefa8b6e884aa: [Analyzer][StreamChecker] Add check for pointer escape. (authored by balazske). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80699/new/ https

[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-16 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 270974. balazske added a comment. - Rebase - Added check for checker in NoteTag function. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81407/new/ https://reviews.llvm.org/D81407 Files: clang/lib/StaticAnal

[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-16 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 271007. balazske marked an inline comment as done. balazske added a comment. - Re-added the location uniqueing feature. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81407/new/ https://reviews.llvm.org/D81407

[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-17 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 271291. balazske marked 2 inline comments as done. balazske added a comment. Corrected command line arguments in tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81407/new/ https://reviews.llvm.org/D81407

[PATCH] D81761: [analyzer] Force dependency checkers to be hidden

2020-06-17 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. My observation is, if there is an example checker, it should be really "example" and not "test". (The "custom" is probably good to rename to "test" but not the "example".) (The names of these files look not good too: A **CheckerOptionHandling.cpp** contains an example

[PATCH] D81407: [Analyzer][StreamChecker] Add note tags for file opening.

2020-06-18 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 3 inline comments as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:406 +const ExplodedNode *StreamChecker::getAcquisitionSite(const ExplodedNode *N, + Sy

[PATCH] D82568: [clang][CrossTU] Invalidate parent map after get cross TU definition.

2020-07-01 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/lib/CrossTU/CrossTranslationUnit.cpp:723 + // Parent map is invalidated after changing the AST. + ToDecl->getASTContext().getParentMapContext().clear(); + balazske wrot

[PATCH] D82845: [Analyzer][StreamChecker] Report every leak, clean up state.

2020-07-01 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. The problem is that `PathDiagnostic::Profile` does not use the uniqueing locations. Two `PathDiagnostic` objects with different uniqueing location but otherwise same data are counted as "same" and only one is kept (`BugReporter::FlushReport`). How to fix this? - Add u

[PATCH] D82845: [Analyzer][StreamChecker] Report every leak, clean up state.

2020-07-02 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:969 + // Do not warn for non-closed stream at program exit. + if (Pred && Pred->getCFGBlock() && Pred->getCFGBlock()->hasNoReturnElement())

[PATCH] D79431: [analyzer] StdLibraryFunctionsChecker: Add better diagnostics

2020-07-02 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:323 +std::string("Function argument constraint is not satisfied, ") + +VC->getName().data() + ", ArgN: " + std::to_string(VC->getArgNo()); if (!BT_Inv

[PATCH] D83115: [Analyzer] Report every bug if only uniqueing location differs.

2020-07-02 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: clang. Two CSA bug rep

[PATCH] D82845: [Analyzer][StreamChecker] Report every leak, clean up state.

2020-07-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 275311. balazske added a comment. Rebase, added a FIXME Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82845/new/ https://reviews.llvm.org/D82845 Files: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp

[PATCH] D83120: [Analyzer][StreamChecker] Using BugType::SuppressOnSink at resource leak report.

2020-07-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: clang. The previous ch

[PATCH] D75740: [ASTImporter] Corrected import of repeated friend declarations.

2020-07-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 275343. balazske added a comment. Rebase Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75740/new/ https://reviews.llvm.org/D75740 Files: clang/lib/AST/ASTImporter.cpp clang/unittests/AST/ASTImporterTest.c

[PATCH] D83115: [Analyzer] Report every bug if only uniqueing location differs.

2020-07-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 2 inline comments as done. balazske added inline comments. Comment at: clang/lib/Analysis/PathDiagnostic.cpp:333 + if (XL.isValid() && YL.isInvalid()) +return false; std::pair XOffs = XL.getDecomposedLoc(); baloghadamsoftware wrote: > Why

[PATCH] D82585: [analyzer][NFC] Move the data structures from CheckerRegistry to the Core library

2020-07-03 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Basically this looks good in the current way too, but I can only assume that the code was copied correctly. A rule could be that the `CheckerRegistryData` is manipulated only by `CheckerRegistry` but get or print functions can be in `CheckerRegistryData`. ==

[PATCH] D69318: [analyzer] Add SufficientSizeArrayIndexingChecker

2020-07-07 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SufficientSizeArrayIndexingChecker.cpp:27 +: public Checker> { + mutable std::unique_ptr BT; + The bug type can be initialized here: `BT{this, "...", "..."}` How did this compile

[PATCH] D75740: [ASTImporter] Corrected import of repeated friend declarations.

2020-07-07 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG85f5d1261c9a: [ASTImporter] Corrected import of repeated friend declarations. (authored by balazske). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75740/new

[PATCH] D75740: [ASTImporter] Corrected import of repeated friend declarations.

2020-07-07 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG85f5d1261c9a: [ASTImporter] Corrected import of repeated friend declarations. (authored by balazske). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75740/new

[PATCH] D81061: [Analyzer][VLASizeChecker] Fix problem with zero index assumption.

2020-07-07 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Ping This is a better fix for the previous problem, and makes the code better too. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81061/new/ https://reviews.llvm.org/D81061 ___

[PATCH] D72705: [analyzer] Added new checker 'alpha.unix.ErrorReturn'.

2020-07-07 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. The original plan was to enable the check for the functions listed in ERR33-C . But there are many other functions that work in similar way (like `mmap` that is not in the

[PATCH] D72705: [analyzer] Added new checker 'alpha.unix.ErrorReturn'.

2020-07-07 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Possible improvements (this is at least a note for me): - The checker can try to find a check for error-return value until the symbol (to check) is released. The warning is generated only if no check for error-return was found. This way works for functions that return

[PATCH] D83407: [analyzer][StdLibraryFunctionsChecker] Add POSIX networking functions

2020-07-09 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Are not some functions missing from the list (`shutdown`, `sockatmark`, `socket`) (these come from )? And `getnameinfo` comes from with many other functions that are not added. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctio

<    1   2   3   4   5   6   7   8   9   10   >