[PATCH] D126481: [analyzer] Handle SymbolCast in SValBuilder

2022-05-27 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:1359 + return cache(S, + SVB.evalCast(Op, S->getType(), S->getOperand()->getType())); +} steakhal wrote: > Hoist this common subexpression.

[PATCH] D126215: [analyzer] Deprecate `-analyzer-store region` flag

2022-05-27 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. Still looks good. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126215/new/ https://reviews.llvm.org/D126215 ___ cfe-commits mailing list

[PATCH] D103096: [analyzer] Implement cast for ranges of symbolic integers

2022-05-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Denys, I've created a very simple patch that makes the SValBuilder to be able to look up and use a constraint for an operand of a SymbolCast. That change passes 2 of your test cases, thus I made that a parent patch. Comment at:

[PATCH] D126481: [analyzer] Handle SymbolCast in SValBuilder

2022-05-26 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: ASDenysPetrov, steakhal, NoQ. Herald added subscribers: manas, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project:

[PATCH] D125400: [clang][Analyzer] Add errno state to standard functions modeling.

2022-05-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Nice work, looks promising! Once this https://reviews.llvm.org/D125400?vs=431909=431924#inline-1206369 is addressed I will accept. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:2273 +// here) may indicate failure.

[PATCH] D125986: [clang][ASTImporter] Add support for import of UsingPackDecl.

2022-05-26 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM! Thanks! And sorry for the delay in the review, please ping me next time. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125986/new/

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/test/Analysis/unary-sym-expr.c:35 +return; + clang_analyzer_eval(-(x + y) == -3); // expected-warning{{TRUE}} +} steakhal wrote: > martong wrote: > > steakhal wrote: > > > Does it work if you swap x and y? >

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-26 Thread Gabor Marton 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 rGcd5783d3e82b: [analyzer][solver] Handle UnarySymExpr in SMTConv (authored by martong). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D125395: [analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver

2022-05-26 Thread Gabor Marton 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 rG88abc50398eb: [analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver (authored by martong). Changed prior to commit:

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-26 Thread Gabor Marton via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. martong marked 2 inline comments as done. Closed by commit rGb5b2aec1ff51: [analyzer] Add UnarySymExpr (authored by martong). Changed prior to commit:

[PATCH] D126406: [analyzer] Return from reAssume if State is posteriorly overconstrained

2022-05-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:118 + // Make internal constraint solver entities friends so they can access the + // overconstrained related functions. We want to keep this API inaccessible + //

[PATCH] D126406: [analyzer] Return from reAssume if State is posteriorly overconstrained

2022-05-26 Thread Gabor Marton via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. martong marked an inline comment as done. Closed by commit rGca3d962548b9: [analyzer] Return from reAssume if State is posteriorly overconstrained (authored by

[PATCH] D126406: [analyzer] Return from reAssume if State is posteriorly overconstrained

2022-05-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:127 + +public: bool isPosteriorlyOverconstrained() const { steakhal wrote: > This shouldnt be the way. > Consider fwd declaring and making it

[PATCH] D126406: [analyzer] Return from reAssume if State is posteriorly overconstrained

2022-05-26 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 432225. martong marked 5 inline comments as done. martong added a comment. - Make reAssume friend, pin the target in the test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126406/new/

[PATCH] D126406: [analyzer] Return from reAssume if State is posteriorly overconstrained

2022-05-25 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2547 if (Constraint->encodesFalseRange()) return State->assume(DefinedVal, false); I am wondering, that maybe it would be better to check for

[PATCH] D126406: [analyzer] Return from reAssume if State is posteriorly overconstrained

2022-05-25 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: NoQ, steakhal. Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a

[PATCH] D124758: [analyzer] Implement assume in terms of assumeDual

2022-05-25 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. > This change in itself reduced the run-time of the analysis to 16 seconds, on > my machine. However, the repetition of States should still be addressed. I am > going to upload the upper patch for a starter. Sorry, in that 16s, I measured also the rebuild and linkage

[PATCH] D124758: [analyzer] Implement assume in terms of assumeDual

2022-05-25 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Thanks Balazs for the report. Here is my analysis. Looks like during the recursive simplification, `reAssume` produces `State`s that had been created by a previous `reAssume`. Before this change, to stop the recursion it was enough to to check if the `OldState`

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-25 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 432019. martong marked an inline comment as done. martong added a comment. - Compare the size of the types instead of the type pointers Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125547/new/

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-25 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h:463 + // has a different type than the unary itself. + if (OperandTy != Sym->getType()) { +if (hasComparison)

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-25 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 431970. martong added a comment. - Fix Assertion `*Solver->getSort(LHS) == *Solver->getSort(RHS) && "AST's must have the same sort!"' failed. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125547/new/

[PATCH] D126281: [analyzer] Fix symbol simplification assertion failure

2022-05-25 Thread Gabor Marton 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 rGf75bc5bfc8f8: [analyzer] Fix symbol simplification assertion failure (authored by martong). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D126281: [analyzer] Fix symbol simplification assertion failure

2022-05-24 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/test/Analysis/symbol-simplification-assertion.c:27 + assert(a + L1 + 1 + b != c); + assert(a == 0); // no-assertion +} steakhal wrote: > Is this statement still reachable? Demonstrate it by using the >

[PATCH] D126281: [analyzer] Fix symbol simplification assertion failure

2022-05-24 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 431635. martong marked an inline comment as done. martong added a comment. - Add clang_analyzer_warnIfReached() to the test and remove unused debug function decls Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D126123: [analyzer][NFC] MemRegion::getRegion() never returns null

2022-05-24 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D126123#3531150 , @steakhal wrote: > In D126123#3531112 , @martong wrote: > >> Is it documented with `getRegion`? Could we decorate that with >> `returns-nonnull` >>

[PATCH] D126281: [analyzer] Fix symbol simplification assertion failure

2022-05-24 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. > Point 2) above has negligible performance impact, empirical measurements do > not show any noticeable difference in the run-time. Attaching the measurement results that show the run-time difference is not noticeable, or rather it is within the margin of error.

[PATCH] D126215: [analyzer] Deprecate `-analyzer-store region` flag

2022-05-24 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126215/new/ https://reviews.llvm.org/D126215

[PATCH] D126281: [analyzer] Fix symbol simplification assertion failure

2022-05-24 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/test/Analysis/symbol-simplification-assertion.c:15-18 +void clang_analyzer_printState(); +void clang_analyzer_dump(long); +void clang_analyzer_eval(int); + TODO remove. Repository: rG LLVM Github Monorepo

[PATCH] D126281: [analyzer] Fix symbol simplification assertion failure

2022-05-24 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: NoQ, steakhal. Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a

[PATCH] D126215: [analyzer] Deprecate `-analyzer-store region` flag

2022-05-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. > We should support deprecated analyzer flags for at least one release. In this > case I'm planning to drop this flag in clang-17 Should we emit a warning for the user about the deprecation? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D126216: [analyzer][NFC] Remove unused RegionStoreFeatures

2022-05-23 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126216/new/ https://reviews.llvm.org/D126216

[PATCH] D126198: [analyzer][NFCi] Annotate major nonnull returning functions

2022-05-23 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. Looks good, with minor revisions. Comment at: clang/include/clang/Analysis/AnalysisDeclContext.h:233 + : Kind(k), Ctx(ctx), Parent(parent), ID(ID) { +assert(Ctx);

[PATCH] D126123: [analyzer][NFC] MemRegion::getRegion() never returns null

2022-05-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Is it documented with `getRegion`? Could we decorate that with `returns-nonnull` https://clang.llvm.org/docs/AttributeReference.html#returns-nonnull ? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126123/new/

[PATCH] D126130: [analyzer][NFC] Remove unused SVal::hasConjuredSymbol

2022-05-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. > Remove unused SVal::hasConjuredSymbol The title seems to be off with the changes. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126130/new/ https://reviews.llvm.org/D126130

[PATCH] D126128: [analyzer][NFC] Inline loc::ConcreteInt::evalBinOp

2022-05-23 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. Looks, good, but it was a struggle to follow if you did the inlining right or not. TBH, someone else should also check it. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D126127: [analyzer][NFC] Relocate unary transfer functions

2022-05-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. > This is an initial step of removing the SimpleSValBuilder abstraction. The > SValBuilder alone should be enough. Perhaps this should be part of another patch stack? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D126126: [analyzer][NFC] Inline and simplify nonloc::ConcreteInt functions

2022-05-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:90 -SVal SimpleSValBuilder::evalMinus(NonLoc val) { - switch (val.getSubKind()) { - case nonloc::ConcreteIntKind: I'd rather keep the `switch` because in D125318 we

[PATCH] D125954: [analyzer][NFC] Factor out the copy-paste code repetition of assumeDual and assumeInclusiveRangeDual

2022-05-23 Thread Gabor Marton 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 rG96fba640cf58: [analyzer][NFC] Factor out the copy-paste code repetition of assumeDual and… (authored by martong). Repository: rG LLVM Github

[PATCH] D125892: [analyzer] Implement assumeInclusiveRange in terms of assumeInclusiveRangeDual

2022-05-23 Thread Gabor Marton 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 rG32f189b0d9a8: [analyzer] Implement assumeInclusiveRange in terms of assumeInclusiveRangeDual (authored by martong). Repository: rG LLVM Github

[PATCH] D126067: [analyzer] Drop the unused 'analyzer-opt-analyze-nested-blocks' cc1 flag

2022-05-20 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Uhh, ohh, don't forget to reflect this change in the ReleaseNotes.rst, so urers will be notified! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126067/new/ https://reviews.llvm.org/D126067

[PATCH] D126067: [analyzer] Drop the unused 'analyzer-opt-analyze-nested-blocks' cc1 flag

2022-05-20 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. > However, this arises a couple of burning questions. > > Should the cc1 frontend still accept this flag - to keep tools/users passing > this flag directly to cc1 (which is unsupported,

[PATCH] D125986: [clang][ASTImporter] Add support for import of UsingPackDecl.

2022-05-20 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/AST/ASTImporter.cpp:4861 + ToUsingPack->setLexicalDeclContext(LexicalDC); + LexicalDC->addDeclInternal(ToUsingPack); + Why don't we use `addDeclToContexts`? Comment at:

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-19 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. There are Z3 refutation related assertions on open-source projects once the patch stack is applied. Interestingly it happens in `fromBinOp`. clang-14: ../../git/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h:96: static const

[PATCH] D125892: [analyzer] Implement assumeInclusiveRange in terms of assumeInclusiveRangeDual

2022-05-19 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D125892#3524453 , @steakhal wrote: > Now I see, the summary confused me. > >> This includes the refactoring of the common assumle*Dual logic into the >> function template assumeDualImpl. > > I felt like this is a refactoring

[PATCH] D125892: [analyzer] Implement assumeInclusiveRange in terms of assumeInclusiveRangeDual

2022-05-19 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 430637. martong marked an inline comment as done. martong edited the summary of this revision. martong added a comment. - Move SimpleConstraintManager's assume*Internal functions to be protected Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D125920: [analyzer][NFC] Remove the unused LocAsInteger::getPersistentLoc()

2022-05-19 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM. Are there any other `getPersistentLoc` function definitions in other SVals? Might they be also unused? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D125954: [analyzer][NFC] Factor out the copy-paste code repetition of assumeDual and assumeInclusiveRangeDual

2022-05-19 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: NoQ, steakhal. Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a

[PATCH] D125892: [analyzer] Implement assumeInclusiveRange in terms of assumeInclusiveRangeDual

2022-05-19 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 430611. martong added a comment. - Split into two patches, this first patch will be just the no-brainer copy-paste from assumeDual implementaton. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125892/new/

[PATCH] D125892: [analyzer] Implement assumeInclusiveRange in terms of assumeInclusiveRangeDual

2022-05-19 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D125892#3523296 , @steakhal wrote: > Okay, it took me a while to get what's going on. > Do you have anything in mind to express it by slightly less indirection, > references, templates and well, virtual functions xD Okay, I

[PATCH] D125871: [analyzer] Delete alpha.deadcode.UnreachableCode checker

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added a comment. In D125871#3521967 , @steakhal wrote: > Could you please give a few examples of these FPs for the record? Out of thin air I could come up with the following one below. Seems like `try`

[PATCH] D125892: [analyzer] Implement assumeInclusiveRange in terms of assumeInclusiveRangeDual

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: steakhal, NoQ. Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a

[PATCH] D125871: [analyzer] Delete alpha.deadcode.UnreachableCode checker

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:847 -let ParentPackage = DeadCodeAlpha in { - TODO, update the ReleseNotes. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D125871: [analyzer] Delete alpha.deadcode.UnreachableCode checker

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: NoQ, steakhal, Szelethus. Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun, mgorny. Herald added a project: All. martong requested

[PATCH] D123773: [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. martong marked an inline comment as done. Closed by commit rG56b9b97c1ef5: [clang][analyzer][ctu] Make CTU a two phase analysis (authored by martong). Changed prior

[PATCH] D123685: [clang][ASTImporter] Add isNewDecl

2022-05-18 Thread Gabor Marton 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 rG25ac078a961d: [clang][ASTImporter] Add isNewDecl (authored by martong). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D123773: [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added inline comments. Comment at: clang/docs/ReleaseNotes.rst:352 + reports are lost compared to single-TU analysis, the lost reports are highly + likely to be false positives. xazax.hun wrote: > I wonder if

[PATCH] D123773: [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 430047. martong added a comment. - Update ReleaseNotes.rst Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123773/new/ https://reviews.llvm.org/D123773 Files: clang/docs/ReleaseNotes.rst

[PATCH] D125771: [clang-tidy] Add a useful note about -std=c++11-or-later

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang-tools-extra/test/clang-tidy/check_clang_tidy.py:31 + -std=c++11-or-later: +This flag will cause multiple runs withing the same check_clang_tidy +execution. Make sure you don't have shared state across these runs.

[PATCH] D123784: [clang][analyzer][ctu] Traverse the ctu CallEnter nodes in reverse order

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong abandoned this revision. martong marked an inline comment as done. martong added a comment. Abandoning because by using a `bool` in `ctuBifurcate`, the CTUWorklist will not have more than one elements during the first phase. Details:

[PATCH] D123773: [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 430023. martong marked an inline comment as done. martong added a comment. - Change ctuBifurcate to use bool in GDM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123773/new/ https://reviews.llvm.org/D123773

[PATCH] D123773: [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:446 +} +const bool BState = State->contains(D); +if (!BState) { // This is the first time we see this foreign function.

[PATCH] D125708: [analyzer][NFC] Remove unused default SVal constructors

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125708/new/ https://reviews.llvm.org/D125708

[PATCH] D125707: [analyzer][NFC] Remove unused friend SVal declarations

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125707/new/ https://reviews.llvm.org/D125707

[PATCH] D125706: [analyzer][NFC] Use idiomatic classof instead of isKind

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125706/new/ https://reviews.llvm.org/D125706

[PATCH] D125709: [analyzer][Casting] Support isa, cast, dyn_cast of SVals

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. > I'm not sure, shall I add tests? Yes, please. Unit tests for `dyn_cast` and `isa` should be easy. However, I am not sure how to test `cast` for the failure cases. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D125400: [clang][Analyzer] Add errno state to standard functions modeling.

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:435 + assert(Cond); + State = State->assume(*Cond, true); + return errno_modeling::setErrnoValue(State, C.getLocationContext(), balazske

[PATCH] D125400: [clang][Analyzer] Add errno state to standard functions modeling.

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D125400#3516164 , @balazske wrote: > @martong Do you mean that a "describe" function is needed for the return > value constraint of the function and for the errno constraint type? Then a > note tag can contain what the

[PATCH] D125400: [clang][Analyzer] Add errno state to standard functions modeling.

2022-05-17 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D125400#3508955 , @balazske wrote: > Function `mkdir` is modeled incorrectly by the checker. According to the man > page it can return 0 or -1 only (-1 is error) but the checker allows > non-negative value at success. So the

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-16 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D125547#3515259 , @steakhal wrote: > Something is messed up with the diff. You refer to `fromUnOp()` but it's not > defined anywhere. No. There is no mess up here, the diff is correct. `fromUnOp` had been implemented way

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-16 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 429633. martong marked 2 inline comments as done. martong added a comment. - Use existing fromUnOp - pass nullptr as FromTy Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125547/new/

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-16 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 2 inline comments as done. martong added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h:258 + static inline llvm::SMTExprRef fromUnary(llvm::SMTSolverRef , + ASTContext ,

[PATCH] D125524: [BoundV2] ArrayBoundV2 checks if the extent is tainted

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp:208 if (state_exceedsUpperBound && state_withinUpperBound) { - SVal ByteOffset = rawOffset.getByteOffset(); - if (isTainted(state, ByteOffset)) { + if

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: steakhal, NoQ, mikhail.ramalho. Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project:

[PATCH] D123685: [clang][ASTImporter] Add isNewDecl

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 429212. martong added a comment. - setNewDecl -> markAsNewDecl Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123685/new/ https://reviews.llvm.org/D123685 Files:

[PATCH] D125524: [BoundV2] ArrayBoundV2 checks if the extent is tainted

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp:208 if (state_exceedsUpperBound && state_withinUpperBound) { - SVal ByteOffset = rawOffset.getByteOffset(); - if (isTainted(state, ByteOffset)) { + if

[PATCH] D125532: [analyzer] Introduce clang_analyzer_dumpSvalType introspection function

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp:268 + QualType Ty = C.getSVal(Arg).getType(C.getASTContext()); + reportBug(Ty.getAsString(),

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 2 inline comments as done. martong added inline comments. Comment at: clang/test/Analysis/unary-sym-expr.c:35 +return; + clang_analyzer_eval(-(x + y) == -3); // expected-warning{{TRUE}} +} steakhal wrote: > Does it work if you swap x and y?

[PATCH] D125395: [analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 429208. martong added a comment. - Add a test case for casts related crash Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125395/new/ https://reviews.llvm.org/D125395 Files:

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 429207. martong added a comment. - Revert "Add type parameter to evalMinus and evalComplement" Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125318/new/ https://reviews.llvm.org/D125318 Files:

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:107 +return makeNonLoc(X.castAs().getSymbol(), UO_Not, + X.getType(Context)); default: steakhal wrote: > martong wrote: > > steakhal wrote:

[PATCH] D123773: [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 429172. martong marked 7 inline comments as done. martong added a comment. - Change -mul to -pct - Change default values to ctu-max-nodes-pct = 50 and ctu-max-nodes-min = 1 - Rename isCTUInFirtstPhase to isSecondPhaseCTU and invert the condition - Check

[PATCH] D123773: [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 15 inline comments as done. martong added inline comments. Comment at: clang/include/clang/AST/ASTImporterSharedState.h:83 + + void setNewDecl(Decl *ToD) { NewDecls.insert(ToD); } }; whisperity wrote: > (The naming of this function feels a bit

[PATCH] D123685: [clang][ASTImporter] Add isNewDecl

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 4 inline comments as done. martong added inline comments. Comment at: clang/include/clang/AST/ASTImporterSharedState.h:83 + + void setNewDecl(Decl *ToD) { NewDecls.insert(ToD); } }; `markAsNewDecl` sounds better, I'll update before commit.

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 429152. martong marked an inline comment as done. martong added a comment. - Add type parameter to evalMinus and evalComplement - Correct dumpToStream in case of binary sub expressions Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-13 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:107 +return makeNonLoc(X.castAs().getSymbol(), UO_Not, + X.getType(Context)); default: steakhal

[PATCH] D125463: [analyzer][NFC] Tighten some of the SValBuilder return types

2022-05-12 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. Seems like it compiles, so LGTM. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125463/new/ https://reviews.llvm.org/D125463

[PATCH] D125395: [analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver

2022-05-12 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 428932. martong marked 6 inline comments as done. martong added a comment. - Address steakhal review comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125395/new/ https://reviews.llvm.org/D125395 Files:

[PATCH] D125395: [analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver

2022-05-12 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 13 inline comments as done. martong added a comment. In D125395#3506854 , @steakhal wrote: > Great content! > I've got a long list of nits though. Nothing personal :D No worries, thank you for being assiduous. Comment

[PATCH] D125400: [clang][Analyzer] Add errno state to standard functions modeling.

2022-05-12 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. The bugreports look promising. However, I think we desperately need a note that describes which function has set the `errno_modeling` state. Below I'd expect the following notes for the highlighted function call. - assuming return value of `mkdir` is in range [0,

[PATCH] D123773: [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-12 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 3 inline comments as done. martong added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:116 + const bool Foreign = false; // From CTU. + xazax.hun wrote: > martong wrote: > > martong wrote: > > >

[PATCH] D125400: [clang][Analyzer] Add errno state to standard functions modeling.

2022-05-12 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Nice work! Could you pleas add some lit tests that describe an errno related bugreport for a standard lib function? Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:381 + class ErrnoConstraintKind { + public:

[PATCH] D125360: [analyzer] Add taint to the BoolAssignmentChecker

2022-05-12 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. Herald added a subscriber: rnkovacs. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125360/new/ https://reviews.llvm.org/D125360

[PATCH] D124674: [analyzer] Indicate if a parent state is infeasible

2022-05-12 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp:46 +ConstraintManager::ProgramStatePair +ConstraintManager::assumeDual(ProgramStateRef State, DefinedSVal Cond) { + ProgramStateRef StTrue = assume(State, Cond, true);

[PATCH] D125340: [clang][NFC][AST] rename the ImportError to ASTImportError

2022-05-12 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. Yeah, okay, this patch makes sense now that I've seen a clash with python's ImportError . I've checked lldb c++ files and `ImportError`

[PATCH] D125395: [analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver

2022-05-11 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Fixes https://github.com/llvm/llvm-project/issues/55241 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125395/new/ https://reviews.llvm.org/D125395 ___ cfe-commits mailing list

[PATCH] D125395: [analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver

2022-05-11 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 428683. martong added a comment. - Add false positive test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125395/new/ https://reviews.llvm.org/D125395 Files:

[PATCH] D125395: [analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver

2022-05-11 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: steakhal, NoQ. Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a

[PATCH] D125379: [analyzer][solver] Do not negate unsigned ranges

2022-05-11 Thread Gabor Marton via Phabricator via cfe-commits
martong abandoned this revision. martong added inline comments. Comment at: clang/test/Analysis/constraint_manager_negate_difference.c:125-130 void negate_unsigned_mid(unsigned m, unsigned n) { if (m - n == UINT_MID) { -clang_analyzer_eval(n - m == UINT_MID); //

[PATCH] D125379: [analyzer][solver] Do not negate unsigned ranges

2022-05-11 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: NoQ, steakhal. Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a

[PATCH] D125340: [clang][NFC][AST] rename the ImportError to ASTImportError

2022-05-11 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. What are the benefits of this renaming? I mean is there a name clash? Do we have another kind of "import" in Clang or in some of the dependent projects, don't we? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125340/new/

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