[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -194,3 +199,99 @@ char test_comparison_with_extent_symbol(struct incomplete *p) { return ((char *)p)[-1]; // no-warning } +// WeakLoopAssumption suppression +/// + +int GlobalArray[100]; +int loop_suppre

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -194,3 +199,99 @@ char test_comparison_with_extent_symbol(struct incomplete *p) { return ((char *)p)[-1]; // no-warning } +// WeakLoopAssumption suppression +/// + +int GlobalArray[100]; +int loop_suppre

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -212,6 +212,25 @@ typedef llvm::ImmutableMap REGISTER_TRAIT_WITH_PROGRAMSTATE(PendingArrayDestruction, PendingArrayDestructionMap) +// This trait is used to heuristically filter out results produced from +// execution paths that took "weak"

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -323,12 +342,13 @@ class ExprEngine { /// ProcessBranch - Called by CoreEngine. Used to generate successor /// nodes by processing the 'effects' of a branch condition. - void processBranch(const Stmt *Condition, - NodeBuilderContext& BuilderCtx, -

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -583,11 +603,11 @@ class ExprEngine { ExplodedNode *Pred, ExplodedNodeSet &Dst); - /// evalEagerlyAssumeBinOpBifurcation - Given the nodes in 'Src', eagerly assume symbolic - /// expressions of the form 'x

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -2808,27 +2825,63 @@ void ExprEngine::processBranch(const Stmt *Condition, std::tie(StTrue, StFalse) = *KnownCondValueAssumption; else { assert(!isa(Condition)); + // TODO: instead of this shortcut perhaps it would be better to "rejoin" + // the com

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -697,6 +697,11 @@ void ArrayBoundCheckerV2::reportOOB(CheckerContext &C, ProgramStateRef ErrorState, Messages Msgs, NonLoc Offset, std::optional Extent, bool IsTaintB

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -212,6 +212,25 @@ typedef llvm::ImmutableMap REGISTER_TRAIT_WITH_PROGRAMSTATE(PendingArrayDestruction, PendingArrayDestructionMap) +// This trait is used to heuristically filter out results produced from +// execution paths that took "weak"

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -2808,27 +2825,63 @@ void ExprEngine::processBranch(const Stmt *Condition, std::tie(StTrue, StFalse) = *KnownCondValueAssumption; else { assert(!isa(Condition)); + // TODO: instead of this shortcut perhaps it would be better to "rejoin" + // the com

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -2808,27 +2825,63 @@ void ExprEngine::processBranch(const Stmt *Condition, std::tie(StTrue, StFalse) = *KnownCondValueAssumption; else { assert(!isa(Condition)); + // TODO: instead of this shortcut perhaps it would be better to "rejoin" + // the com

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -2808,27 +2825,63 @@ void ExprEngine::processBranch(const Stmt *Condition, std::tie(StTrue, StFalse) = *KnownCondValueAssumption; else { assert(!isa(Condition)); + // TODO: instead of this shortcut perhaps it would be better to "rejoin" + // the com

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -2808,27 +2825,63 @@ void ExprEngine::processBranch(const Stmt *Condition, std::tie(StTrue, StFalse) = *KnownCondValueAssumption; else { assert(!isa(Condition)); + // TODO: instead of this shortcut perhaps it would be better to "rejoin" + // the com

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -2808,27 +2825,63 @@ void ExprEngine::processBranch(const Stmt *Condition, std::tie(StTrue, StFalse) = *KnownCondValueAssumption; else { assert(!isa(Condition)); + // TODO: instead of this shortcut perhaps it would be better to "rejoin" + // the com

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -2808,27 +2825,63 @@ void ExprEngine::processBranch(const Stmt *Condition, std::tie(StTrue, StFalse) = *KnownCondValueAssumption; else { assert(!isa(Condition)); + // TODO: instead of this shortcut perhaps it would be better to "rejoin" + // the com

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -3776,6 +3829,11 @@ void ExprEngine::evalEagerlyAssumeBinOpBifurcation(ExplodedNodeSet &Dst, ProgramStateRef StateTrue, StateFalse; std::tie(StateTrue, StateFalse) = state->assume(*SEV); + if (StateTrue && StateFalse) { +StateTrue = StateTrue->set(

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -194,3 +199,99 @@ char test_comparison_with_extent_symbol(struct incomplete *p) { return ((char *)p)[-1]; // no-warning } +// WeakLoopAssumption suppression +/// + +int GlobalArray[100]; +int loop_suppre

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > If I understand it correctly, we want to use (very likely) incorrect > assumptions to suppress false positives produced by an alpha checker, which > receives otherwise wrong assumptions. [...] I think the correct solution to > this problem is to investigate why the specific

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -194,3 +199,99 @@ char test_comparison_with_extent_symbol(struct incomplete *p) { return ((char *)p)[-1]; // no-warning } +// WeakLoopAssumption suppression +/// + +int GlobalArray[100]; +int loop_suppre

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -121,6 +121,25 @@ struct EvalCallOptions { EvalCallOptions() {} }; +/// Simple control flow statements like `if` only produce a single state split, +/// so the fact that they are included in the source code implies that both +/// branches are possible (at least under some

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-09-25 Thread Donát Nagy via cfe-commits
@@ -121,6 +121,25 @@ struct EvalCallOptions { EvalCallOptions() {} }; +/// Simple control flow statements like `if` only produce a single state split, +/// so the fact that they are included in the source code implies that both +/// branches are possible (at least under some

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-10-02 Thread Donát Nagy via cfe-commits
@@ -194,3 +199,99 @@ char test_comparison_with_extent_symbol(struct incomplete *p) { return ((char *)p)[-1]; // no-warning } +// WeakLoopAssumption suppression +/// + +int GlobalArray[100]; +int loop_suppre

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-10-02 Thread Donát Nagy via cfe-commits
@@ -2808,27 +2825,63 @@ void ExprEngine::processBranch(const Stmt *Condition, std::tie(StTrue, StFalse) = *KnownCondValueAssumption; else { assert(!isa(Condition)); + // TODO: instead of this shortcut perhaps it would be better to "rejoin" + // the com

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-10-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/109804 From 23b27377e556085054621f27d97059618b416695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Mon, 23 Sep 2024 15:42:20 +0200 Subject: [PATCH 1/7] [analyzer] Suppress out of bounds reports a

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-10-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/109804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-10-02 Thread Donát Nagy via cfe-commits
NagyDonat wrote: @isuckatcs If I am not mistaken, I reacted to every comment in your first review. I'm sorry for the salty initial reactions -- after thinking about this topic for months, I ended up feeling that everything is _so obvious_, while in fact it's a really complicated topic and per

[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)

2024-10-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/109804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Check initialization and argument passing in FixedAddressChecker (PR #110977)

2024-10-03 Thread Donát Nagy via cfe-commits
@@ -63,11 +62,39 @@ void FixedAddressChecker::checkPreStmt(const BinaryOperator *B, "Using a fixed address is not portable because that address will " "probably not be valid in all environments or platforms."; auto R = std::make_unique(BT, Msg, N); -R->

[clang] [clang][analyzer] Check initialization and argument passing in FixedAddressChecker (PR #110977)

2024-10-03 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: Nice improvement, thanks for the patch! I read the code but I don't have anything to mention which isn't covered by the review of @steakhal . https://github.com/llvm/llvm-project/pull/110977 ___ cfe-commits mail

[clang] [analyzer][NFC] Remove check::BranchCondition from debug.DumpTraversal (PR #113906)

2024-11-07 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat closed https://github.com/llvm/llvm-project/pull/113906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Remove check::BranchCondition from debug.DumpTraversal (PR #113906)

2024-11-07 Thread Donát Nagy via cfe-commits
NagyDonat wrote: Thanks for the information! I'll merge this now and I might create a followup commit to remove the rest of `TraversalChecker.cpp` later. https://github.com/llvm/llvm-project/pull/113906 ___ cfe-commits mailing list cfe-commits@lists.

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

2024-11-06 Thread Donát Nagy via cfe-commits
NagyDonat wrote: Thanks for handling this issue! My quick first impression is that I'm satisfied with your changes. However, I'm a bit confused because as far as I see, the empty struct is _unable to_ transfer any attacker-controlled data, and therefore I don't know what does it mean that it'

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

2024-11-07 Thread Donát Nagy via cfe-commits
NagyDonat 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 code r

[clang] [clang][analyzer] Check initialization and argument passing in FixedAddressChecker (PR #110977)

2024-11-07 Thread Donát Nagy via cfe-commits
NagyDonat wrote: @balazske As we discussed in person, I think you switch to detecting _dereference_ of fixed addresses (instead of extending the current "store of fixed address in pointer value" model e.g. by the commit under review). I think you should briefly look at DereferenceChecker and c

[clang] [analyzer] Never create Regions wrapping reference TypedValueRegions (NFCI) (PR #118096)

2024-11-29 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > The second is, how can we end up with such subregions. I think the only way > is by field regions. If we had something that I missed, the assert would > catch it. Quick guesses: can we form a base or derived object subregion from them? Is there some hacky pathway where we c

[clang] [analyzer][NFC] Cleanup BranchNodeBuilder (PR #117898)

2024-11-28 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I didn't run an analysis yet, because I was convinced about the correctness of this change based on an understanding of the source code (and the fact that the lit tests pass). However, I started a test run now to double-check this. I'll merge this commit if it reveals no discr

[clang] [analyzer][NFC] Cleanup BranchNodeBuilder (PR #117898)

2024-11-27 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/117898 Previously `BranchNodeBuilder` had a machinery to mark the two possible branches (true, false) as infeasible, but this was completely useless in practice, because the `BranchNodeBuilder` objects where short-l

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

2024-11-20 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat 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-20 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. 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

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

2024-11-15 Thread Donát Nagy via cfe-commits
@@ -86,6 +86,8 @@ def __init__(self, json_pp): if json_pp["location"] is not None else None ) +elif self.kind == "CallEnter": +self.callee_decl = json_pp["callee_decl"] if "callee_decl" in json_pp else "None"

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

2024-11-15 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, with one minor simplification suggestion marked in an inline comment. Disclaimer: I don't use this exploded-graph-rewriter tool, but the change seems to be straightforward and useful. https://github.com/llvm/llvm-project/pull/11622

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

2024-11-15 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited 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] Avoid out-of-order node traversal on void return (PR #117863)

2024-11-27 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. I didn't systematically analyze all the small details of this commit, but overall it looks good to me. https://github.com/llvm/llvm-project/pull/117863 ___ cfe-commits mailing list cfe-commits@l

[clang] [analyzer] Indicate UnarySymExpr is not supported by Z3 (PR #108900)

2024-09-17 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: Do I understand it correctly that this deficiency affects the standalone Z3 analysis mode (as opposed to the "Z3 refutation" where the analysis is performed with the native range-based constraint manager, and then the results are validated with Z3 to dis

[clang] [analyzer] Indicate UnarySymExpr is not supported by Z3 (PR #108900)

2024-09-17 Thread Donát Nagy via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s \ +// RUN: -analyzer-constraints=z3 + +// REQUIRES: Z3 +// +// This LIT covers a crash associated with this test. +// The expectation is to not crash! NagyDonat

[clang] [analyzer] Indicate UnarySymExpr is not supported by Z3 (PR #108900)

2024-09-17 Thread Donát Nagy via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s \ +// RUN: -analyzer-constraints=z3 + +// REQUIRES: Z3 +// +// This LIT covers a crash associated with this test. +// The expectation is to not crash! +// + +long a; +void b() {

[clang] [analyzer] Indicate UnarySymExpr is not supported by Z3 (PR #108900)

2024-09-17 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/108900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Indicate UnarySymExpr is not supported by Z3 (PR #108900)

2024-09-17 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/108900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Indicate UnarySymExpr is not supported by Z3 (PR #108900)

2024-09-17 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/108900 ___ 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-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. The commit which introduced the new Z3 timeout logic (https://github.com/llvm/llvm-project/pull/97298) was landed with my approval, but since then I realized that this was a mistake -- in particular the concrete fine-tuned default values

[clang] [analyzer][NFC] Cleanup BranchNodeBuilder (PR #117898)

2024-12-02 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I tested this commit on several open source projects, and as there were no changes in the results, I'm merging this PR now. https://github.com/llvm/llvm-project/pull/117898 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [analyzer][NFC] Cleanup BranchNodeBuilder (PR #117898)

2024-12-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat closed https://github.com/llvm/llvm-project/pull/117898 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-14 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, as we discussed earlier. 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] Don't copy field-by-field conjured LazyCompoundVals (2/4) (PR #115917)

2024-11-14 Thread Donát Nagy 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 Donát Nagy via cfe-commits
https://github.com/NagyDonat edited 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] Don't copy field-by-field conjured LazyCompoundVals (2/4) (PR #115917)

2024-11-14 Thread Donát Nagy 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 Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. Overall LGTM, I added a few minor inline comments, but they are not blocking issues. https://github.com/llvm/llvm-project/pull/115917 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

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

2024-11-14 Thread Donát Nagy 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 Donát Nagy via cfe-commits
@@ -2605,9 +2608,43 @@ RegionBindingsRef RegionStoreManager::bindVector(RegionBindingsConstRef B, return NewB; } +std::optional +RegionStoreManager::getUniqueDefaultBinding(nonloc::LazyCompoundVal LCV) const { + const MemRegion *BaseR = LCV.getRegion(); + + // We only ha

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

2024-11-14 Thread Donát Nagy 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 Donát Nagy 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] Trigger copy event when copying empty structs (3/4) (PR #115918)

2024-11-14 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, clean little patch, I don't have anything to say here. https://github.com/llvm/llvm-project/pull/115918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

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

2024-11-26 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, thanks for the updates. https://github.com/llvm/llvm-project/pull/113899 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analysis][NFC]add static for internal linkage function (PR #117481)

2024-11-26 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. I'm not familiar with these files, but the change seems to be harmless enough... Let's hope that it doesn't cause any weird bugs. https://github.com/llvm/llvm-project/pull/117481 ___ cfe-commits

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

2025-01-06 Thread Donát Nagy 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

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

2025-01-06 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > I adjusted the first commit message to highlight my answer to these > questions. I hope that's clear enough. Ok, I'd say that this explanation is _good enough_ to claim that "this change may be helpful" -- which is sufficient to merge this change, because it's conservative,

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

2025-01-06 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/120239 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-06 Thread Donát Nagy via cfe-commits
@@ -77,16 +80,32 @@ void Z3CrosscheckVisitor::finalizeVisitor(BugReporterContext &BRC, RefutationSolver->addConstraint(SMTConstraints); } - // And check for satisfiability - llvm::TimeRecord Start = llvm::TimeRecord::getCurrentTime(/*Start=*/true); - std::optional Is

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

2025-01-06 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: I'm really grateful that you implemented my request about defining this option as a positive value; especially considering that it ended up being more work than what I expected. (I guessed that we must already had precedent(s) for positive (or at least o

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

2025-01-06 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, thanks for the updates! If the updated test passes, feel free to merge it. https://github.com/llvm/llvm-project/pull/120239 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. https://github.com/llvm/llvm-project/pull/120239 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-06 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/121781 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-06 Thread Donát Nagy via cfe-commits
@@ -224,6 +224,8 @@ class SymbolMetadata : public SymbolData { const Stmt *S; QualType T; const LocationContext *LCtx; + /// Count can be used to differentiate regions corresponding to + /// different loop iterations, thus, making the symbol path-dependent.

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-06 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: I'm grateful for this code quality improvement, it's nice to see that you got rid of 180 lines of boilerplate :smile: I have one minor inline suggestion that it would be nice to document the purpose of this new template method; but otherwise the change i

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-06 Thread Donát Nagy via cfe-commits
@@ -525,14 +527,14 @@ class SymbolManager { static bool canSymbolicate(QualType T); - /// Make a unique symbol for MemRegion R according to its kind. - const SymbolRegionValue* getRegionValueSymbol(const TypedValueRegion* R); + template const T *get(Args &&...args); ---

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Donát Nagy 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

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Donát Nagy 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

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/120239 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify PositiveAnalyzerOption handling (PR #121910)

2025-01-07 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, straightforward improvement. https://github.com/llvm/llvm-project/pull/121910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-07 Thread Donát Nagy via cfe-commits
@@ -525,14 +527,14 @@ class SymbolManager { static bool canSymbolicate(QualType T); - /// Make a unique symbol for MemRegion R according to its kind. - const SymbolRegionValue* getRegionValueSymbol(const TypedValueRegion* R); + template const T *get(Args &&...args); ---

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-07 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/121781 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify PositiveAnalyzerOption handling (PR #121910)

2025-01-07 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/121910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-07 Thread Donát Nagy via cfe-commits
NagyDonat wrote: My first idea is a "down to earth", not so modern, but more backwards compatible approach: - the analyzer option type stays plain `unsigned`; - we introduce a new method called `validateAnalyzerOptionValues()` or something similar; - in this method we specify that `if (Z3Crossc

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-07 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/121781 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-07 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/121781 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-07 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/121781 ___ 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 Donát Nagy via cfe-commits
https://github.com/NagyDonat 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 Donát Nagy 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 Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, thanks for adding this documentation! I added an inline suggestion that -- hopefully -- clarifies the differences between held and taken memory areas; but the original is also completely OK. Feel free to ignore or tweak my suggesti

[clang] [analyzer] Add option assume-one-iteration (PR #125494)

2025-02-03 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > My preference would be to not have NFC tags for off by default features. OK, I removed the [NFC] tag from the PR title and adjusted the description accordingly. https://github.com/llvm/llvm-project/pull/125494 ___ cfe-commits maili

[clang] [analyzer][NFC] Add option assume-one-iteration (PR #125494)

2025-02-03 Thread Donát Nagy via cfe-commits
@@ -294,6 +294,16 @@ ANALYZER_OPTION( bool, ShouldUnrollLoops, "unroll-loops", "Whether the analysis should try to unroll loops with known bounds.", false) +ANALYZER_OPTION( +bool, ShouldAssumeOneIteration, "assume-one-iteration", +"Whether the analyzer should

[clang] [analyzer][NFC] Add option assume-one-iteration (PR #125494)

2025-02-03 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/125494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add option assume-one-iteration (PR #125494)

2025-02-03 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/125494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add option assume-one-iteration (PR #125494)

2025-02-03 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/125494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Add option assume-one-iteration (PR #125494)

2025-02-03 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/125494 This commit adds the new analyzer option `assume-one-iteration`, which is `false` by default, but can be set to `true` to ensure that the analyzer always assumes (at least) one iteration in loops. In some si

[clang] [analyzer][NFC] Add option assume-one-iteration (PR #125494)

2025-02-03 Thread Donát Nagy via cfe-commits
NagyDonat wrote: By the way is the "NFC" tag justified for this "add an off-by-default option" commit? I used this because e.g. if somebody is looking for a bug, they can safely skip this commit -- but OTOH this _does_ add a new feature. https://github.com/llvm/llvm-project/pull/125494 ___

[clang] [llvm] [analyzer] Consolidate array bound checkers (PR #125534)

2025-02-03 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/125534 Before this commit, there were two alpha checkers that used different algorithms/logic for detecting out of bounds memory access: the old `alpha.security.ArrayBound` and the experimental, more complex `alpha

[clang] [llvm] [analyzer] Consolidate array bound checkers (PR #125534)

2025-02-04 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I evaluated a sample of 10 random ArrayBoundV2 results from FFMPEG and I found the following: - [Unjustified assumption of third iteration](https://codechecker-demo.eastus.cloudapp.azure.com/Default/report-detail?run=ffmpeg_n4.3.1_edonnag_llvm-main_1883de3&newcheck=ffmpeg_n4.3.

[clang] [llvm] [analyzer] Consolidate array bound checkers (PR #125534)

2025-02-04 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/125534 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add option assume-one-iteration (PR #125494)

2025-02-04 Thread Donát Nagy via cfe-commits
@@ -294,6 +294,16 @@ ANALYZER_OPTION( bool, ShouldUnrollLoops, "unroll-loops", "Whether the analysis should try to unroll loops with known bounds.", false) +ANALYZER_OPTION( +bool, ShouldAssumeOneIteration, "assume-one-iteration", +"Whether the analyzer should

[clang] [llvm] [analyzer] Consolidate array bound checkers (PR #125534)

2025-02-04 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/125534 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    3   4   5   6   7   8   9   10   11   12   >