[clang] [analyzer] [MallocChecker] Less aggressive analysis of functions (PR #116383)

2024-11-18 Thread Balazs Benics via cfe-commits
steakhal wrote: The difference is that here, in this scope the dev has full context and control, and we can see that it's safe. While acrossing a function boundary a completely different set of assumptions can be made. E.g. just follow best practices and dont pass dangling pointers that the fn

[clang] [analyzer] [MallocChecker] Less aggressive analysis of functions (PR #116383)

2024-11-18 Thread Balazs Benics via cfe-commits
steakhal wrote: This example also makes sense to me. Here the dangling pointer has a well-defined value. It's not null. Its some invalid value that one should not dereference. And nobody does that so there is no issue. https://github.com/llvm/llvm-project/pull/116383 __

[clang] [analyzer] [MallocChecker] Less aggressive analysis of functions (PR #116383)

2024-11-18 Thread Balazs Benics via cfe-commits
steakhal wrote: Hi, thanks for the report. This is the intended behavior AFAICT. My question is, why would you ever pass a dangling pointer to a function? I can't think of a valid use-case for doing that. They could just pass a null-pointer if they really wanted. Am I missing something? https:

[clang] [analyzer] Avoid creating LazyCompoundVal when possible (PR #116840)

2024-11-19 Thread Balazs Benics via cfe-commits
steakhal wrote: Btw expect more patches about fixing LCVs and overall PostInitializer events and bindings. Basically, how we model the member initializers and copies. Stay tuned for those, but before that this one is a preparation patch, so I'm excited to see your comments. https://github.com

[clang] [analyzer] Handle [[assume(cond)]] as __builtin_assume(cond) (PR #116462)

2024-11-18 Thread Balazs Benics via cfe-commits
steakhal wrote: This looks really good. I'll come back and push some changes to your branch to make it more similar with our coding style. And maybe adding a few more tests. I'll expect you to then have a look at the commits I push and report back if you agree with those. Once that is done, we

[clang] [analyzer] Avoid creating LazyCompoundVal when possible (PR #116840)

2024-11-20 Thread Balazs Benics via cfe-commits
steakhal wrote: > The change LGTM and I'm happy to hear that you're improving the handling of > compound values. I hope that these foundational improvements will help > further development of checkers that deal with structured data. (Perhaps even > the iterator checkers could be stabilized eve

[clang] [analyzer] Avoid creating LazyCompoundVal when possible (PR #116840)

2024-11-20 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/116840 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Avoid creating LazyCompoundVal when possible (PR #116840)

2024-11-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/116840 In #115916 I allowed copying empty structs. Later in #115917 I changed how objects are copied, and basically when we would want to copy a struct (an LCV) of a single symbol (likely coming from an opaque fncall

[clang] [analyzer] Avoid creating LazyCompoundVal when possible (PR #116840)

2024-11-19 Thread Balazs Benics via cfe-commits
steakhal wrote: @necto Could you also review this one? https://github.com/llvm/llvm-project/pull/116840 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-19 Thread Balazs Benics via cfe-commits
steakhal wrote: Thank you for your dedication. What are your plans? Do you plan to continue pushing this? Btw why did this test only fail on Windows? https://github.com/llvm/llvm-project/pull/115579 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[clang] [analyzer] Refine LCV handling in Store for better taint propagation (PR #114835)

2024-11-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/114835 >From 26f0cfabe3328c8eb8a861dd5d1d541921499f0c Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sat, 9 Nov 2024 15:55:08 +0100 Subject: [PATCH 1/5] [analyzer][NFC] Make RegionStore dumps deterministic Dump t

[clang] [analyzer] Refine LCV handling in Store for better taint propagation (PR #114835)

2024-11-09 Thread Balazs Benics via cfe-commits
@@ -15,20 +19,103 @@ struct empty { void test_copy_return() { aggr s1 = {1, 2}; aggr const& cr1 = aggr(s1); - clang_analyzer_dump(cr1); // expected-warning-re {{&lifetime_extended_object{aggr, cr1, S{{[0-9]+}}} }} + clang_analyzer_dump_lref(cr1); // expected-warning-re

[clang] [analyzer] Refine LCV handling in Store for better taint propagation (PR #114835)

2024-11-09 Thread Balazs Benics via cfe-commits
steakhal wrote: > Thanks for the explanation -- code example reduction friendliness is a good > point that I didn't think about. Based on this, I support keeping that > commit, but perhaps add some remarks (in comments or the commit message, > wherever you think it's well-placed) that mentions

[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-09 Thread Balazs Benics via cfe-commits
steakhal wrote: Hi, thanks for the PR! I'm slightly confused that the compiler crash you refer to comes from the stdlibrary fn checker. This suggest to me a checker problem - and likely relates to the stdlibraryfn checker early return. However, this also couples with a solver change. Is this

[clang] [analyzer][NFC] Make RegionStore dumps deterministic (PR #115615)

2024-11-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/115615 Dump the memory space clusters before the other clusters, in alphabetical order. Then default bindings over direct bindings, and if any has symbolic offset, then those should come before the ones with concrete

[clang] [analyzer][NFC] Make RegionStore dumps deterministic (PR #115615)

2024-11-09 Thread Balazs Benics via cfe-commits
@@ -232,27 +233,86 @@ class RegionBindingsRef : public llvm::ImmutableMapRefhttps://github.com/llvm/llvm-project/pull/115615 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] Added a PthreadCreateChecker and attempted to register it (PR #116515)

2024-11-16 Thread Balazs Benics via cfe-commits
steakhal wrote: Could you please ellaborate your intentions and motives? The PR description wasn't clear to me. @MaxSanchez99 https://github.com/llvm/llvm-project/pull/116515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-15 Thread Balazs Benics via cfe-commits
steakhal wrote: @danix800 Could you please have a look at the failed test, such that we could reapply this PR? I reverted this soon after I realized the broken test is from this PR. https://github.com/llvm/llvm-project/pull/115579 ___ cfe-commits mail

[clang] [analyzer][taint] Recognize tainted LazyCompoundVals (4/4) (PR #115919)

2024-11-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/115919 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Trigger copy event when copying empty structs (3/4) (PR #115918)

2024-11-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/115918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[analyzer][Solver] Early return if sym is concrete on assuming" (PR #116362)

2024-11-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/116362 Reverts llvm/llvm-project#115579 This introduced a breakage: https://lab.llvm.org/buildbot/#/builders/46/builds/7928 >From 42c0948d6102cf3f5a7baad52db5e16aaf5eacc8 Mon Sep 17 00:00:00 2001 From: Balazs Benics

[clang] Revert "[analyzer][Solver] Early return if sym is concrete on assuming" (PR #116362)

2024-11-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/116362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Print the callee name in CallEnter in exploded-graph-rewriter (PR #116225)

2024-11-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/116225 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Print the PostInitializer target in exploded-graph-rewriter (PR #116034)

2024-11-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/116034 >From b815854d4b96651b483a28010b59adb889c44dbc Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Wed, 13 Nov 2024 12:55:06 +0100 Subject: [PATCH] [analyzer] Print the PostInitializer target in exploded-graph-

[clang] [analyzer] Print the callee name in CallEnter in exploded-graph-rewriter (PR #116225)

2024-11-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/116225 >From 68086287a41c534704cdbc88027f61090b0540ea Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Thu, 14 Nov 2024 14:25:31 +0100 Subject: [PATCH 1/2] [analyzer] Print the callee name in CallEnter in exploded-

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM now. Thank you for this high quality patch. This isn't the first time, I remember. Excellent track record. https://github.com/llvm/llvm-project/pull/115579 ___ cfe-commits mailing list cfe-c

[clang] [analyzer] Handle [[assume(cond)]] as __builtin_assume(cond) (PR #116462)

2024-11-18 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/116462 >From daddb9e13db6ca8373dc7298d17aa36a03014aeb Mon Sep 17 00:00:00 2001 From: Vinay Deshmukh <32487576+vinay-deshm...@users.noreply.github.com> Date: Fri, 15 Nov 2024 07:37:17 -0500 Subject: [PATCH 1/8] [analyze

[clang] [clang][NFC] Generalize getSpecificAttr for const attributes (PR #116606)

2024-11-18 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/116606 This patch allows using `getSpecificAttr` for getting `const` attributes. Previously, if users of this API would want to get a const Attribute pointer, they had to pass `getSpecificAttr()`, to get it compile.

[clang] [clang] Only build static analyzer sources if requested (PR #71653)

2024-11-26 Thread Balazs Benics via cfe-commits
steakhal wrote: As a CSA maintainer, I believe having this component optional is valuable just like @whisperity described. To me, it's not an important subject such that I'd invest time here, but I'm ready to review patches improving the status quo. What is important here that by default it wou

[clang] [clang][analyzer] Bring checker 'alpha.unix.cstring.NotNullTerminated' out of alpha (PR #113899)

2024-11-26 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/113899 ___ cfe-commits mailing list cfe-commits@lists.ll

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
steakhal wrote: > @steakhal and @NagyDonat , thanks for the comments. I'll address and update > the patch. Best @vabridgers Please avoid force pushed. Prefer `merge` over `rebase` while doing the reviews. It's okay to have a sequence of commits fixing up certain behavior. Once the review is d

[clang] [clang][NFC] Generalize getSpecificAttr for const attributes (PR #116606)

2024-11-27 Thread Balazs Benics via cfe-commits
steakhal wrote: Ping @kazutakahirata https://github.com/llvm/llvm-project/pull/116606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Avoid out-of-order node traversal on void return (PR #117863)

2024-11-27 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/117863 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Avoid out-of-order node traversal on void return (PR #117863)

2024-11-27 Thread Balazs Benics via cfe-commits
steakhal wrote: I already reviewed this change downstream. https://github.com/llvm/llvm-project/pull/117863 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/117791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -121,17 +183,40 @@ void ChrootChecker::checkPreCall(const CallEvent &Call, return; // If jail state is ROOT_CHANGED, generate BugReport. - void *const* k = C.getState()->FindGDM(ChrootChecker::getTag()); - if (k) -if (isRootChanged((intptr_t) *k)) - if (Exp

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -24,21 +26,30 @@ using namespace clang; using namespace ento; -namespace { - // enum value that represent the jail state -enum Kind { NO_CHROOT, ROOT_CHANGED, JAIL_ENTERED }; +enum ChrootKind { NO_CHROOT, ROOT_CHANGED, ROOT_CHANGE_FAILED, JAIL_ENTERED }; -bool isRootChan

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -104,15 +146,35 @@ void ChrootChecker::evalChdir(const CallEvent &Call, CheckerContext &C) const { R = R->StripCasts(); if (const StringRegion* StrRegion= dyn_cast(R)) { const StringLiteral* Str = StrRegion->getStringLiteral(); - if (Str->getString() == "

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -80,19 +88,53 @@ bool ChrootChecker::evalCall(const CallEvent &Call, CheckerContext &C) const { void ChrootChecker::evalChroot(const CallEvent &Call, CheckerContext &C) const { ProgramStateRef state = C.getState(); ProgramStateManager &Mgr = state->getStateManager(); +

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -104,15 +146,35 @@ void ChrootChecker::evalChdir(const CallEvent &Call, CheckerContext &C) const { R = R->StripCasts(); if (const StringRegion* StrRegion= dyn_cast(R)) { const StringLiteral* Str = StrRegion->getStringLiteral(); - if (Str->getString() == "

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -121,17 +183,40 @@ void ChrootChecker::checkPreCall(const CallEvent &Call, return; // If jail state is ROOT_CHANGED, generate BugReport. - void *const* k = C.getState()->FindGDM(ChrootChecker::getTag()); - if (k) -if (isRootChanged((intptr_t) *k)) - if (Exp

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -104,15 +146,35 @@ void ChrootChecker::evalChdir(const CallEvent &Call, CheckerContext &C) const { R = R->StripCasts(); if (const StringRegion* StrRegion= dyn_cast(R)) { const StringLiteral* Str = StrRegion->getStringLiteral(); - if (Str->getString() == "

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -121,17 +183,40 @@ void ChrootChecker::checkPreCall(const CallEvent &Call, return; // If jail state is ROOT_CHANGED, generate BugReport. - void *const* k = C.getState()->FindGDM(ChrootChecker::getTag()); - if (k) -if (isRootChanged((intptr_t) *k)) - if (Exp

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -80,19 +88,53 @@ bool ChrootChecker::evalCall(const CallEvent &Call, CheckerContext &C) const { void ChrootChecker::evalChroot(const CallEvent &Call, CheckerContext &C) const { ProgramStateRef state = C.getState(); ProgramStateManager &Mgr = state->getStateManager(); +

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -80,19 +88,53 @@ bool ChrootChecker::evalCall(const CallEvent &Call, CheckerContext &C) const { void ChrootChecker::evalChroot(const CallEvent &Call, CheckerContext &C) const { ProgramStateRef state = C.getState(); ProgramStateManager &Mgr = state->getStateManager(); +

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -1750,6 +1750,21 @@ Critical section handling functions modeled by this checker: } } +.. _unix-Chroot: + +unix.Chroot (C) +" steakhal wrote: ```suggestion unix.Chroot (C) """ ``` https://github.com/llvm/llvm-project/pu

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -121,17 +183,40 @@ void ChrootChecker::checkPreCall(const CallEvent &Call, return; // If jail state is ROOT_CHANGED, generate BugReport. - void *const* k = C.getState()->FindGDM(ChrootChecker::getTag()); - if (k) -if (isRootChanged((intptr_t) *k)) - if (Exp

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. This checker deserved some love for sure. Thank you for pushing for this. I left quite a few comments, touching style and also direction of this patch. Thanks Vince! https://github.com/llvm/llvm-project/pull/117791 _

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -121,17 +183,40 @@ void ChrootChecker::checkPreCall(const CallEvent &Call, return; // If jail state is ROOT_CHANGED, generate BugReport. - void *const* k = C.getState()->FindGDM(ChrootChecker::getTag()); - if (k) -if (isRootChanged((intptr_t) *k)) - if (Exp

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -80,19 +88,53 @@ bool ChrootChecker::evalCall(const CallEvent &Call, CheckerContext &C) const { void ChrootChecker::evalChroot(const CallEvent &Call, CheckerContext &C) const { ProgramStateRef state = C.getState(); ProgramStateManager &Mgr = state->getStateManager(); +

[clang] [analyzer] Modernize, improve and promote chroot checker (PR #117791)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -1750,6 +1750,21 @@ Critical section handling functions modeled by this checker: } } +.. _unix-Chroot: + +unix.Chroot (C) +" +Check improper use of chroot. steakhal wrote: This documentation should explain how is `chroot` used inco

[clang] [analyzer] Avoid out-of-order node traversal on void return (PR #117863)

2024-11-27 Thread Balazs Benics via cfe-commits
@@ -278,7 +278,9 @@ class ExplodedNode : public llvm::FoldingSetNode { /// Useful for explaining control flow that follows the current node. /// If the statement belongs to a body-farmed definition, retrieve the /// call site for that definition. - const Stmt *getNextStm

[clang] [analyzer] Avoid out-of-order node traversal on void return (PR #117863)

2024-11-27 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/117863 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Avoid out-of-order node traversal on void return (PR #117863)

2024-11-27 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/117863 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Avoid out-of-order node traversal on void return (PR #117863)

2024-11-27 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/117863 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] FixedAddressChecker: no warning if system macro is used (PR #108993)

2024-09-17 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/108993 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Don't copy field-by-field conjured LazyCompoundVals (2/4) (PR #115917)

2024-11-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/115917 >From 548ad576b27e7ecfa29a78c13db5ef04c1ea8e7c Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun, 3 Nov 2024 09:41:33 +0100 Subject: [PATCH 1/2] [analyzer] Don't copy field-by-field conjured LazyCompoundV

[clang] [analyzer] Don't copy field-by-field conjured LazyCompoundVals (2/4) (PR #115917)

2024-11-14 Thread Balazs Benics via cfe-commits
@@ -2609,9 +2611,42 @@ RegionBindingsRef RegionStoreManager::bindVector(RegionBindingsConstRef B, return NewB; } +std::optional +RegionStoreManager::getUniqueDefaultBinding(Store S, +const MemRegion *BaseR) const { + assert(BaseR

[clang] [analyzer] Print the PostInitializer target in exploded-graph-rewriter (PR #116034)

2024-11-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/116034 >From 7faee31bc4bc0b1a9fd037a99f54856c84affc91 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Wed, 13 Nov 2024 12:55:06 +0100 Subject: [PATCH 1/2] [analyzer] Print the PostInitializer target in exploded-gr

[clang] [analyzer] Don't copy field-by-field conjured LazyCompoundVals (2/4) (PR #115917)

2024-11-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/115917 >From 548ad576b27e7ecfa29a78c13db5ef04c1ea8e7c Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun, 3 Nov 2024 09:41:33 +0100 Subject: [PATCH 1/3] [analyzer] Don't copy field-by-field conjured LazyCompoundV

[clang] [analyzer] Don't copy field-by-field conjured LazyCompoundVals (2/4) (PR #115917)

2024-11-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/115917 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Trigger copy event when copying empty structs (3/4) (PR #115918)

2024-11-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/115918 >From 697e09d0bc97230240b3d127a310e49ddd4d44b7 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sat, 2 Nov 2024 14:15:41 +0100 Subject: [PATCH] [analyzer] Trigger copy event when copying empty structs (3/4)

[clang] [analyzer][taint] Recognize tainted LazyCompoundVals (4/4) (PR #115919)

2024-11-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/115919 >From 697e09d0bc97230240b3d127a310e49ddd4d44b7 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sat, 2 Nov 2024 14:15:41 +0100 Subject: [PATCH 1/2] [analyzer] Trigger copy event when copying empty structs (3

[clang] [analyzer] Print the callee name in CallEnter in exploded-graph-rewriter (PR #116225)

2024-11-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/116225 ![image](https://github.com/user-attachments/assets/22a82950-d6e1-4e1f-8f82-2f33240b382a) >From 68086287a41c534704cdbc88027f61090b0540ea Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Thu, 14 Nov 2024 14:

[clang] [analyzer] Don't copy field-by-field conjured LazyCompoundVals (2/4) (PR #115917)

2024-11-14 Thread Balazs Benics via cfe-commits
@@ -2609,9 +2611,42 @@ RegionBindingsRef RegionStoreManager::bindVector(RegionBindingsConstRef B, return NewB; } +std::optional +RegionStoreManager::getUniqueDefaultBinding(Store S, +const MemRegion *BaseR) const { + assert(BaseR

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-14 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=debug.ExprInspection \ +// RUN: -verify steakhal wrote: I think you need to pin the target triple as in the test you have an assumption about the size of int, as the upperbound of a

[clang] [analyzer] Don't copy field-by-field conjured LazyCompoundVals (2/4) (PR #115917)

2024-11-14 Thread Balazs Benics via cfe-commits
@@ -2609,9 +2611,42 @@ RegionBindingsRef RegionStoreManager::bindVector(RegionBindingsConstRef B, return NewB; } +std::optional +RegionStoreManager::getUniqueDefaultBinding(Store S, +const MemRegion *BaseR) const { + assert(BaseR

[clang] [analyzer] Don't copy field-by-field conjured LazyCompoundVals (2/4) (PR #115917)

2024-11-14 Thread Balazs Benics via cfe-commits
@@ -2609,9 +2611,42 @@ RegionBindingsRef RegionStoreManager::bindVector(RegionBindingsConstRef B, return NewB; } +std::optional +RegionStoreManager::getUniqueDefaultBinding(Store S, +const MemRegion *BaseR) const { + assert(BaseR

[clang] [analyzer] Allow copying empty structs (1/4) (PR #115916)

2024-11-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/115916 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-14 Thread Balazs Benics via cfe-commits
steakhal wrote: I see your point, but I'm still not convinced. Anyways, that's partially beyond this PR. What we have here I can completely agree with. I just have the feeling it solved one particular case, and not a class of bugs - which is fine. https://github.com/llvm/llvm-project/pull/1155

[clang] [Analyzer][CFG] Correctly handle rebuilt default arg and default init expression (PR #117437)

2024-11-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/117437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [StaticAnalyzer] Migrate away from PointerUnion::{is,get} (NFC) (PR #118421)

2024-12-02 Thread Balazs Benics via cfe-commits
@@ -1068,10 +1068,10 @@ const VarRegion *MemRegionManager::getVarRegion(const VarDecl *D, llvm::PointerUnion V = getStackOrCaptureRegionForDeclContext(LC, DC, D); -if (V.is()) - return V.get(); +if (isa(V)) steakhal wrote: I wonder if

[clang] [StaticAnalyzer] Migrate away from PointerUnion::{is,get} (NFC) (PR #118421)

2024-12-02 Thread Balazs Benics via cfe-commits
@@ -196,13 +196,13 @@ const PointerToMemberData *BasicValueFactory::accumCXXBase( const NamedDecl *ND = nullptr; llvm::ImmutableList BaseSpecList; - if (PTMDT.isNull() || PTMDT.is()) { -if (PTMDT.is()) - ND = PTMDT.get(); + if (PTMDT.isNull() || isa(PTMDT)) { +

[clang] [StaticAnalyzer] Migrate away from PointerUnion::{is,get} (NFC) (PR #118421)

2024-12-02 Thread Balazs Benics via cfe-commits
@@ -196,13 +196,13 @@ const PointerToMemberData *BasicValueFactory::accumCXXBase( const NamedDecl *ND = nullptr; llvm::ImmutableList BaseSpecList; - if (PTMDT.isNull() || PTMDT.is()) { -if (PTMDT.is()) - ND = PTMDT.get(); + if (PTMDT.isNull() || isa(PTMDT)) { +

[clang] [StaticAnalyzer] Migrate away from PointerUnion::{is,get} (NFC) (PR #118421)

2024-12-02 Thread Balazs Benics via cfe-commits
@@ -222,23 +222,23 @@ void ExplodedNode::NodeGroup::addNode(ExplodedNode *N, ExplodedGraph &G) { GroupStorage &Storage = reinterpret_cast(P); if (Storage.isNull()) { Storage = N; -assert(Storage.is()); +assert(isa(Storage)); return; } ExplodedNodeV

[clang] [StaticAnalyzer] Migrate away from PointerUnion::{is,get} (NFC) (PR #118421)

2024-12-02 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. Hi Kazu I always welcome your patches! True gems. I left a couple of comments, mostly about following llvm style guides. https://github.com/llvm/llvm-project/pull/118421 ___ cfe-commi

[clang] [StaticAnalyzer] Migrate away from PointerUnion::{is,get} (NFC) (PR #118421)

2024-12-02 Thread Balazs Benics via cfe-commits
@@ -205,10 +205,10 @@ const NamedDecl *nonloc::PointerToMember::getDecl() const { return nullptr; const NamedDecl *ND = nullptr; - if (PTMD.is()) -ND = PTMD.get(); + if (isa(PTMD)) steakhal wrote: I think we should use dyn_cast here. https://git

[clang] [StaticAnalyzer] Migrate away from PointerUnion::{is,get} (NFC) (PR #118421)

2024-12-02 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/118421 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [StaticAnalyzer] Migrate away from PointerUnion::{is,get} (NFC) (PR #118421)

2024-12-02 Thread Balazs Benics via cfe-commits
@@ -211,8 +211,8 @@ class MallocSizeofChecker : public Checker { continue; const TypeSourceInfo *TSI = nullptr; -if (CallRec.CastedExprParent.is()) { - TSI = CallRec.CastedExprParent.get() +if (isa(CallRec.CastedExprParent)) { --

[clang] [analyzer][Z3] Restore the original timeout of 15s (PR #118291)

2024-12-03 Thread Balazs Benics via cfe-commits
@@ -74,13 +74,13 @@ TEST_F(Z3CrosscheckOracleTest, SATWhenItGoesOverTime) { } TEST_F(Z3CrosscheckOracleTest, UNSATWhenItGoesOverTime) { - ASSERT_EQ(RejectEQClass, interpretQueryResult({UNSAT, 310_ms, 1000_step})); + ASSERT_EQ(RejectReport, interpretQueryResult({UNSAT, 310_ms

[clang] [analyzer][Z3] Restore the original timeout of 15s (PR #118291)

2024-12-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/118291 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][Z3] Restore the original timeout of 15s (PR #118291)

2024-12-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. I have no major concerns with this patch. I proposed some wording changes, and I think we should test the configuration we had for the defaults we had prior to this patch to showcase that what is the expected behavior for the s

[clang] [analyzer][Z3] Restore the original timeout of 15s (PR #118291)

2024-12-03 Thread Balazs Benics via cfe-commits
@@ -189,20 +189,23 @@ ANALYZER_OPTION( "crosscheck-with-z3-eqclass-timeout-threshold", "Set a timeout for bug report equivalence classes in milliseconds. " "If we exhaust this threshold, we will drop the bug report eqclass " -"instead of doing more Z3 queries. S

[clang] [analyzer][Z3] Restore the original timeout of 15s (PR #118291)

2024-12-03 Thread Balazs Benics via cfe-commits
@@ -189,20 +189,23 @@ ANALYZER_OPTION( "crosscheck-with-z3-eqclass-timeout-threshold", "Set a timeout for bug report equivalence classes in milliseconds. " "If we exhaust this threshold, we will drop the bug report eqclass " -"instead of doing more Z3 queries. S

[clang] [analyzer][Z3] Restore the original timeout of 15s (PR #118291)

2024-12-03 Thread Balazs Benics via cfe-commits
@@ -189,20 +189,23 @@ ANALYZER_OPTION( "crosscheck-with-z3-eqclass-timeout-threshold", "Set a timeout for bug report equivalence classes in milliseconds. " "If we exhaust this threshold, we will drop the bug report eqclass " -"instead of doing more Z3 queries. S

[clang] [clang][NFC] Generalize getSpecificAttr for const attributes (PR #116606)

2024-12-04 Thread Balazs Benics via cfe-commits
steakhal wrote: Thanks Aaron! https://github.com/llvm/llvm-project/pull/116606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Generalize getSpecificAttr for const attributes (PR #116606)

2024-12-04 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/116606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Handle [[assume(cond)]] as __builtin_assume(cond) (PR #116462)

2024-12-04 Thread Balazs Benics via cfe-commits
steakhal wrote: I was thinking about the case, and I think it's okay to have state-splits in the subexpressions coming from an assume expression - given that the assume expression has no side effects. This way we should have 2 paths after the assume expression (but still before the first if st

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-28 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Looks wonderful now. I had recommended one simplification, but other than that we can merge this. Thanks again! https://github.com/llvm/llvm-project/pull/121203 ___ cfe-commits mailing list cfe-c

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-28 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-28 Thread Balazs Benics via cfe-commits
@@ -283,10 +283,12 @@ static bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx, llvm::APInt InitNum = Matches[0].getNodeAs("initNum")->getValue(); auto CondOp = Matches[0].getNodeAs("conditionOperator"); - if (InitNum.getBitWidth() != BoundNum.get

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-28 Thread Balazs Benics via cfe-commits
@@ -283,10 +283,12 @@ static bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx, llvm::APInt InitNum = Matches[0].getNodeAs("initNum")->getValue(); auto CondOp = Matches[0].getNodeAs("conditionOperator"); - if (InitNum.getBitWidth() != BoundNum.get

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-28 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/121203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -1389,6 +1389,68 @@ Query for this attribute with ``__has_attribute(overloadable)``. }]; } +def OwnershipDocs : Documentation { + let Heading = "ownership_holds, ownership_returns, ownership_takes (Clang " +"Static Analyzer)"; + let Category = DocCatFun

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -1389,6 +1389,68 @@ Query for this attribute with ``__has_attribute(overloadable)``. }]; } +def OwnershipDocs : Documentation { + let Heading = "ownership_holds, ownership_returns, ownership_takes (Clang " +"Static Analyzer)"; + let Category = DocCatFun

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Looks pretty good. Thanks for the docs. That's always a nice way to start a year. https://github.com/llvm/llvm-project/pull/121759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -1389,6 +1389,68 @@ Query for this attribute with ``__has_attribute(overloadable)``. }]; } +def OwnershipDocs : Documentation { + let Heading = "ownership_holds, ownership_returns, ownership_takes (Clang " +"Static Analyzer)"; + let Category = DocCatFun

[clang] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with-z3-retries-on-timeout" times (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
steakhal wrote: > I'm a bit surprised by the idea of using multiple attempts instead of a > single run with a larger timeout -- intuitively we're wasting the already > performed calculations if we are impatient and abort+restart the calculations > after each short timeout (instead of allocatin

[clang] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with-z3-retries-on-timeout" times (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -213,6 +215,15 @@ ANALYZER_OPTION( "400'000 should on average make Z3 queries run for up to 100ms on modern " "hardware. Set 0 for unlimited.", 0) +ANALYZER_OPTION( +unsigned, Z3CrosscheckRetriesOnTimeout, +"crosscheck-with-z3-retries-on-timeout", +"Set

<    13   14   15   16   17   18   19   20   21   22   >