[clang] [analyzer][NFC] Migrate loc::ConcreteInt to use APSIntPtr (3/4) (PR #120437)

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

[clang] [analyzer][NFC] Migrate loc::ConcreteInt to use APSIntPtr (3/4) (PR #120437)

2024-12-19 Thread Balazs Benics via cfe-commits
steakhal wrote: ### Merge activity * **Dec 19, 6:57 AM EST**: A user merged this pull request with [Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/120437). https://github.com/llvm/llvm-project/pull/120437 ___ cfe-commits mailing list

[clang] [analyzer][NFC] Migrate {SymInt, IntSym}Expr to use APSIntPtr (4/4) (PR #120438)

2024-12-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/120438 >From a5f566aff5cfef5c56b1bc7d122fd58e2ccd4357 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Wed, 18 Dec 2024 15:59:23 +0100 Subject: [PATCH] [analyzer][NFC] Migrate {SymInt,IntSym}Expr to use APSIntPtr (

[clang] [analyzer][NFC] Migrate {SymInt, IntSym}Expr to use APSIntPtr (4/4) (PR #120438)

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

[clang] [analyzer][NFC] Migrate {SymInt, IntSym}Expr to use APSIntPtr (4/4) (PR #120438)

2024-12-19 Thread Balazs Benics via cfe-commits
steakhal wrote: ### Merge activity * **Dec 19, 7:01 AM EST**: A user merged this pull request with [Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/120438). https://github.com/llvm/llvm-project/pull/120438 ___ cfe-commits mailing list

[clang] [analyzer][NFC] Introduce APSIntPtr, a safe wrapper of APSInt (1/4) (PR #120435)

2024-12-19 Thread Balazs Benics via cfe-commits
@@ -165,79 +166,70 @@ class BasicValueFactory { /// Convert - Create a new persistent APSInt with the same value as 'From' /// but with the bitwidth and signedness of 'To'. - const llvm::APSInt &Convert(const llvm::APSInt& To, - const llvm::A

[clang] [analyzer][NFC] Introduce APSIntPtr, a safe wrapper of APSInt (1/4) (PR #120435)

2024-12-19 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,64 @@ +//== APSIntPtr.h - Wrapper for APSInt objects owned separately -*- C++ -*--==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apach

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

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

[clang] [analyzer] Model [[assume]] attributes without side-effects (PR #120572)

2024-12-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/120572 This PR splits the existing modeling of builtin assume from the BuiltinFunctionChecker. We just sink the execution path if we are about to leave the assume expression with a false assumption. Assumptions with

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

2024-12-19 Thread Balazs Benics via cfe-commits
steakhal wrote: I made the followup for this one in #120572 https://github.com/llvm/llvm-project/pull/116462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Sink execution if the assumption of [[assume]] is false (PR #120572)

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

[clang] [analyzer] Sink execution if the assumption of [[assume]] is false (PR #120572)

2024-12-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/120572 >From 097d7feb474e7eca884730dc8eebbb8b1bdef2e1 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Thu, 19 Dec 2024 13:45:58 +0100 Subject: [PATCH 1/2] [analyzer] Model [[assume]] attributes without side-ffects

[clang] [clang analyzer]consume `llvm::Error` (PR #120597)

2024-12-19 Thread Balazs Benics via cfe-commits
steakhal wrote: How did you notice this? If its from a real case then we could add a regression test for this too. https://github.com/llvm/llvm-project/pull/120597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

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

2024-11-22 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/116034 ___ 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-05 Thread Balazs Benics via cfe-commits
steakhal wrote: I took the time to update the branch with my recommendations. Please confirm if you agree with the current status. tldr; I only made sure the tests actually test what they intended now that the default threshold has changed. I also added a couple more tests where it made sense,

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

2024-12-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. 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-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/118291 >From 1fb92742a066444d4a074655704c8148ce1f8326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Mon, 2 Dec 2024 11:21:05 +0100 Subject: [PATCH 1/5] [analyzer][Z3] Restore the original timeo

[clang] [analyzer] Widen loops: Augment assignment note when values invalidated at the start of a loop (PR #122398)

2025-01-11 Thread Balazs Benics via cfe-commits
steakhal wrote: > I agree that it would make more sense to generalize this beyond loop > widening. However, I'm having a hard time understanding how your proposal > would fit in to the augmentation of the assignment message like I do in this > PR. > > The part I'm most confused about is how w

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-11 Thread Balazs Benics via cfe-commits
steakhal wrote: My current stance is that we should have the memoryspace trait only for memregions that have an UnknownSpace memspace, becuase that would be the least amount of work. So it would be a hybrid solution. We have the memspaces as we have today, but for UnknownSpace you would need to

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and checker part (PR #122139)

2025-01-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -351,12 +356,30 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, C.addTransition(State, this); } -void ento::registerDereferenceChecker(CheckerManager &mgr) { - auto *Chk = mgr.registerChecker(); -

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and checker part (PR #122139)

2025-01-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -351,12 +356,30 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, C.addTransition(State, this); } -void ento::registerDereferenceChecker(CheckerManager &mgr) { - auto *Chk = mgr.registerChecker(); -

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and checker part (PR #122139)

2025-01-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/122139 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and checker part (PR #122139)

2025-01-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: @@ -155,22 +155,27 @@ static bool isDeclRefExprToReference(const Expr *E) { void DereferenceChecker::reportBug(DerefKind K, ProgramStateRef State, const Stmt *S, CheckerContext &C)

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and checker part (PR #122139)

2025-01-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/122139 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Widen loops: Augment assignment note when values invalidated at the start of a loop (PR #122398)

2025-01-10 Thread Balazs Benics via cfe-commits
steakhal wrote: I agree that it's important to augment the bug reports with information about the source of the symbols. Especially for conjured and derived symbols that are produced widely because of invalidations. Loop widening is just one source of invalidation, and we could generalize it s

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_analyze_cc1 -triple=x86_64-pc-linux-gnu -analyzer-checker=core,unix.Stream,debug.ExprInspection \ +// RUN: -analyzer-config eagerly-assume=false,unix.Stream:Pedantic=true -verify %s +// RUN: %clang_analyze_cc1 -triple=armv8-none-linux-eabi -an

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_analyze_cc1 -triple=x86_64-pc-linux-gnu -analyzer-checker=core,unix.Stream,debug.ExprInspection \ +// RUN: -analyzer-config eagerly-assume=false,unix.Stream:Pedantic=true -verify %s +// RUN: %clang_analyze_cc1 -triple=armv8-none-linux-eabi -an

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
@@ -952,6 +952,12 @@ SVal SimpleSValBuilder::evalBinOpLL(ProgramStateRef state, const MemSpaceRegion *RightMS = RightBase->getMemorySpace(); const MemSpaceRegion *UnknownMS = MemMgr.getUnknownRegion(); +if (LeftMS != RightMS && +((isa(LeftMS) && isa(RightMS

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

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

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. In general, the concept of having the memory space directly embedded into a memory region is flawed. And that is the root cause of the problem. Ideally, the property of "in what memory space does this region live in" is a trai

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_analyze_cc1 -triple=x86_64-pc-linux-gnu -analyzer-checker=core,unix.Stream,debug.ExprInspection \ +// RUN: -analyzer-config eagerly-assume=false,unix.Stream:Pedantic=true -verify %s +// RUN: %clang_analyze_cc1 -triple=armv8-none-linux-eabi -an

[clang] [analyzer] Widen loops: Augment assignment note when values invalidated at the start of a loop (PR #122398)

2025-01-22 Thread Balazs Benics via cfe-commits
steakhal wrote: > Hi @steakhal . > > Thank you for the further clarification and example. I now understand how > your proposal fits in with what I'm trying to accomplish. Thank you for your time for considering it! > I've started to implement the proposal but I have a few questions: > > * Wh

[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

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

[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

2025-01-22 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,72 @@ +//===-- MemSpaces.cpp -*- C++ -*--// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

2025-01-22 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: I had a quick look at the PR, and over all it looks as expected. Good job! Have you considered changing `MemRegion::getMemorySpace()` into `MemRegion::getMemorySpace(ProgramStateRef)`? This should lessen the confusion of which APIs should a dev use to get

[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

2025-01-24 Thread Balazs Benics via cfe-commits
steakhal wrote: > Working on some benchmarking. Posted some problems in the discord channel, > but working through it now, and benchmarking with the CodeChecker tool using > only clangsa. Is there an already established set of benchmarks y'all use > somewhere? IIRC, there was some github repo

[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

2025-01-24 Thread Balazs Benics via cfe-commits
@@ -437,7 +437,7 @@ bool SymbolReaper::isLiveRegion(const MemRegion *MR) { // tell if anything still refers to this region. Unlike SymbolicRegions, // AllocaRegions don't have associated symbols, though, so we don't actually // have a way to track their liveness. - retur

[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

2025-01-24 Thread Balazs Benics via cfe-commits
steakhal wrote: > Benchmarking is taking a while for me, and I can only really run benchmarks > with low run-time variance overnight. I will post more over time as I get > more benchmark projects added. > > Here is the result from benchmarking one C project, libsodium, so far. These > results

[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

2025-01-24 Thread Balazs Benics via cfe-commits
@@ -437,7 +437,7 @@ bool SymbolReaper::isLiveRegion(const MemRegion *MR) { // tell if anything still refers to this region. Unlike SymbolicRegions, // AllocaRegions don't have associated symbols, though, so we don't actually // have a way to track their liveness. - retur

[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

2025-01-24 Thread Balazs Benics via cfe-commits
steakhal wrote: > > Have you considered changing `MemRegion::getMemorySpace()` into > > `MemRegion::getMemorySpace(ProgramStateRef)`? > > I thought about this, but I decided against it since I am thinking that > MemSpaces will eventually be their own separate thing, not part of the > MemRegio

[clang] [StaticAnalyzer] Fix state update in VisitObjCForCollectionStmt (PR #124477)

2025-01-27 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: This change affects how an AST node is modeled. Consequently, it's a core change. As such a change, we should have a test. Overall, I really liked how thoroughly you described what caused the issue, and that helped to justify the fix. On that front, it lo

[clang] [StaticAnalyzer] Fix state update in VisitObjCForCollectionStmt (PR #124477)

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

[clang] [StaticAnalyzer] Fix state update in VisitObjCForCollectionStmt (PR #124477)

2025-01-27 Thread Balazs Benics via cfe-commits
@@ -124,24 +124,26 @@ void ExprEngine::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S, bool isContainerNull = state->isNull(collectionV).isConstrainedTrue(); - ExplodedNodeSet dstLocation; - evalLocation(dstLocation, S, elem, Pred, state, elementV, false); +

[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

2025-01-27 Thread Balazs Benics via cfe-commits
@@ -119,7 +120,26 @@ class MemRegion : public llvm::FoldingSetNode { virtual MemRegionManager &getMemRegionManager() const = 0; - LLVM_ATTRIBUTE_RETURNS_NONNULL const MemSpaceRegion *getMemorySpace() const; + /// Deprecated. Gets the 'raw' memory space of a memory region'

[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

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

[clang] [analyzer][docs] CSA release notes for clang-20 (PR #124798)

2025-01-28 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/124798 The commits were gathered using: ```sh git log --reverse --oneline llvmorg-20-init..llvm/main \ clang/{lib/StaticAnalyzer,include/clang/StaticAnalyzer} | grep -v NFC | grep -v OpenACC | grep -v -i revert ```

[clang] [analyzer][docs] CSA release notes for clang-20 (PR #124798)

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

[clang] [analyzer][docs] CSA release notes for clang-20 (PR #124798)

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

[clang] [analyzer][docs] CSA release notes for clang-20 (PR #124798)

2025-01-28 Thread Balazs Benics via cfe-commits
steakhal wrote: ![page1](https://github.com/user-attachments/assets/5f0c96be-0a83-44e8-a29f-a03cacf7ab50) ![page2](https://github.com/user-attachments/assets/09db787a-8ca4-48b7-b1fd-725b70158464) https://github.com/llvm/llvm-project/pull/124798 ___ cf

[clang] [analyzer][docs] CSA release notes for clang-20 (PR #124798)

2025-01-28 Thread Balazs Benics via cfe-commits
steakhal wrote: @necto as you also contributed a signifficant amount in this release. https://github.com/llvm/llvm-project/pull/124798 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Relax assertion in BugReporterVisitors.cpp isInitializationOfVar (PR #125044)

2025-01-30 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/125044 If we see a variable declaration (aka. DeclStmt), and the VarRegion it declared doesn't have Stack memspace, we assumed that it must be a local static variable. However, the declared variable may be an extern d

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2025-01-02 Thread Balazs Benics via cfe-commits
@@ -427,8 +434,8 @@ class BinarySymExprImpl : public BinarySymExpr { public: BinarySymExprImpl(LHSTYPE lhs, BinaryOperator::Opcode op, RHSTYPE rhs, -QualType t) - : BinarySymExpr(ClassKind, op, t), LHS(lhs), RHS(rhs) { +QualType t

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

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

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
@@ -56,6 +68,8 @@ class SymExpr : public llvm::FoldingSetNode { Kind getKind() const { return K; } + SymbolID getSymbolID() const { return Sym; } steakhal wrote: This is expected to be a fairly infrequently used API. I think this deserves to be highlight

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
@@ -687,4 +711,35 @@ class SymbolVisitor { } // namespace clang +// Override the default definition that would use pointer values of SymbolRefs +// to order them, which is unstable due to ASLR. +// Use the SymbolID instead which reflect the order in which the symbols were +//

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
@@ -687,4 +711,35 @@ class SymbolVisitor { } // namespace clang +// Override the default definition that would use pointer values of SymbolRefs +// to order them, which is unstable due to ASLR. +// Use the SymbolID instead which reflect the order in which the symbols were +//

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
@@ -687,4 +711,35 @@ class SymbolVisitor { } // namespace clang +// Override the default definition that would use pointer values of SymbolRefs +// to order them, which is unstable due to ASLR. +// Use the SymbolID instead which reflect the order in which the symbols were +//

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: @Xazax-hun I'm pretty happy with this PR, but I'm curious about your opinion on adding the `SymbolID Sym` member to the SymExprs. https://github.com/llvm/llvm-project/pull/121551 ___ cfe-commits mailing list cfe-

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM, thanks. https://github.com/llvm/llvm-project/pull/121551 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

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

[clang] Revert "[clang][analyzer] Stable order for SymbolRef-keyed containers" (PR #121592)

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

[clang] Revert "[clang][analyzer] Stable order for SymbolRef-keyed containers" (PR #121592)

2025-01-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/121592 Reverts llvm/llvm-project#121551 We had a bunch of build errors caused by this PR. https://lab.llvm.org/buildbot/#/builders/144/builds/14875 >From 81d2afb2991e636de374eb1d1b550786618ed036 Mon Sep 17 00:00:00

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
steakhal wrote: @necto Please have a look at the build failures. There are plenty. For the time being, I reverted this PR. https://github.com/llvm/llvm-project/pull/121551 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-31 Thread Balazs Benics via cfe-commits
@@ -427,8 +434,8 @@ class BinarySymExprImpl : public BinarySymExpr { public: BinarySymExprImpl(LHSTYPE lhs, BinaryOperator::Opcode op, RHSTYPE rhs, -QualType t) - : BinarySymExpr(ClassKind, op, t), LHS(lhs), RHS(rhs) { +QualType t

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-31 Thread Balazs Benics via cfe-commits
@@ -401,7 +401,22 @@ class RangeSet { friend class Factory; }; -using ConstraintMap = llvm::ImmutableMap; +struct ConstraintKVInfo : llvm::ImutKeyValueInfo { + static inline bool isEqual(key_type_ref L, key_type_ref R) { +return L->getAllocID() == R->getAllocID(); + }

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-31 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: The content look narrow and precise. It raises me questions why is the only user of this new field the Constraint manager? And if the constraint manager is the only user, why is the SMT-based solver not using this? Should all the other immutableSet/Map ben

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

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

[clang] [analyzer] Simplify CallEvent castArgToParamTypeIfNeeded (PR #120981)

2024-12-23 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/120981 I noticed recently that this code (that I wrote xD) uses the `getRuntimeDefinition()` which isn't quite necessary for the simple task this function was designed for. Why would it be better not using this API

[clang] [analyzer][NFC] Update stale test after #97265 (PR #122272)

2025-01-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/122272 In my patch there, I left a test expectation stale. Tests with `REQUIRES: Z3` never run because no bots check such configurations. Here I'm adjusting the test expectations to meet reality. >From 70d29e2ed8a98

[clang] [NFC][analyzer][docs] Remove some orphaned images (PR #122249)

2025-01-09 Thread Balazs Benics via cfe-commits
steakhal wrote: Now that I looked at that PR, it was merged without approval, while having open comments. https://github.com/llvm/llvm-project/pull/122249 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and reporting (PR #122139)

2025-01-09 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/122139 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][analyzer][docs] Remove some orphaned images (PR #122249)

2025-01-09 Thread Balazs Benics via cfe-commits
steakhal wrote: Its usually good practice to refer to the last commit where the dead resources become dead. You can use the git log -S to find out about the commits the thing is mentioned. Example: `git log -Sexample_custom_assert -- clang/www/analyzer/`, will mention: ``` 61a76f58ebf161c739fb1

[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2025-01-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal appr

[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2025-01-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. > If I understand correctly, I handled every review suggestion. >

[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2025-01-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/119388 _

[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2025-01-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -910,38 +910,51 @@ void pr6302(id x, Class y) { //===-

[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2025-01-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy Message-ID: In-Reply-To: steakhal wrote: One more thing. Please mention this in the release notes. https://github.c

[clang] [clang][analysis] Fix flaky clang/test/Analysis/live-stmts.cpp test (PR #126913)

2025-02-12 Thread Balazs Benics via cfe-commits
steakhal wrote: > Unfortunately the test still seems to be flaky. With EXPENSIVE_CHECKS I often > see it fail on the RHEL8 x86_64 machines I use. > E.g. > ``` > FAIL: Clang :: Analysis/live-stmts.cpp (1 of 1) > TEST 'Clang :: Analysis/live-stmts.cpp' FAILED > **

[clang] [clang][analysis] Fix flaky clang/test/Analysis/live-stmts.cpp test (PR #126913)

2025-02-13 Thread Balazs Benics via cfe-commits
steakhal wrote: > For what it worth this change made it persistently failing in my setup. I'm not sure I follow you. The test is disabled on all platforms unconditionally on main. Since e823f14eab4762bdf8483d02e2684f24ec4f100b https://github.com/llvm/llvm-project/pull/126913 ___

[clang] [clang][analysis] Fix flaky clang/test/Analysis/live-stmts.cpp test (PR #126913)

2025-02-13 Thread Balazs Benics via cfe-commits
steakhal wrote: > @steakhal : Sure I can do some tests if you come up with a fix. Right now, > with an EXPENSIVE_CHECKS build it fails in 30-40% of the runs for me so it > should be pretty quick to see if a fix works or not. I've never seen it fail > without EXPENSIVE_CHECKS. I could reproduc

[clang] [analyzer] Disable a flaky test while triaging why its flaky (PR #127034)

2025-02-13 Thread Balazs Benics via cfe-commits
steakhal wrote: Now it says: ``` UNSUPPORTED: Clang :: Analysis/live-stmts.cpp (1 of 1) Test does not support the following features and/or targets: true, true

[clang] [analyzer] Disable a flaky test while triaging why its flaky (PR #127034)

2025-02-13 Thread Balazs Benics via cfe-commits
steakhal wrote: ``` ValueError: Error in UNSUPPORTED list: couldn't parse text: '*'

[clang] [analyzer] Disable a flaky test while triaging why its flaky (PR #127034)

2025-02-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/127034 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Add ArrayBound tests to document casting bug (PR #127062)

2025-02-13 Thread Balazs Benics via cfe-commits
@@ -194,3 +194,34 @@ char test_comparison_with_extent_symbol(struct incomplete *p) { return ((char *)p)[-1]; // no-warning } +int table[256], small_table[128]; +int test_cast_to_unsigned(signed char x) { + unsigned char y = x; + if (x >= 0) +return x; + // FIXME: Her

[clang] [analyzer][NFC] Add ArrayBound tests to document casting bug (PR #127062)

2025-02-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Makes sense. https://github.com/llvm/llvm-project/pull/127062 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Add ArrayBound tests to document casting bug (PR #127062)

2025-02-13 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. Looks great. Thanks. https://github.com/llvm/llvm-project/pull/127062 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [analyzer][NFC] Add ArrayBound tests to document casting bug (PR #127062)

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

[clang] [NFC] Avoid potential null dereference. (PR #127017)

2025-02-13 Thread Balazs Benics via cfe-commits
@@ -314,6 +314,7 @@ void MacOSKeychainAPIChecker::checkPreStmt(const CallExpr *CE, RegionArgIsBad = true; } + assert(ArgSM); steakhal wrote: I'm okay with this assert. It shouldn't change much though because the very next lookup would fail if this wa

[clang] [clang][NFC] Avoid potential null dereferences (PR #127017)

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

[clang] [analyzer] Disable a flaky test while triaging why its flaky (PR #127034)

2025-02-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/127034 >From 518e232d68b73c884bc6c9a56b0d7c7e217e3d13 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Thu, 13 Feb 2025 10:36:42 +0100 Subject: [PATCH 1/2] [analyzer] Disable a flaky test while triaging why its fla

[clang] [analyzer] Disable a flaky test while triaging why its flaky (PR #127034)

2025-02-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/127034 I had previous attempts for fixing this flaky test. Let's admit I failed so far, and disable this until we have a permanent fix. See the discussion at: https://github.com/llvm/llvm-project/pull/126913#issuecom

[clang-tools-extra] [clang-tidy] Add performance-redundant-lookup check (PR #125420)

2025-02-08 Thread Balazs Benics via cfe-commits
steakhal wrote: I revisited the check using `ExprSequence`. It became more actionable from what I can tell, but exposes weaknesses of `ExprSequence` too, which I'll later demonstrate. My approach with my prototype using `ExprSequence` was: 1) Collect lookups just like before. 2) Take the cros

[clang-tools-extra] [clang-tidy] Add performance-redundant-lookup check (PR #125420)

2025-02-15 Thread Balazs Benics via cfe-commits
@@ -91,6 +91,12 @@ Improvements to clang-tidy New checks ^^ +- New :doc:`performance-redundant-lookup + ` check. + + This check warns about potential redundant container lookup operations within steakhal wrote: Dropped in c6a681c955fef8b933374a05a15

[clang-tools-extra] [clang-tidy] Add performance-redundant-lookup check (PR #125420)

2025-02-15 Thread Balazs Benics via cfe-commits
steakhal wrote: > @steakhal: Please fix documentation and Release Notes wording that I > mentioned already. Thanks, fixed! I'm actually more curious about the semantic requirements, and about what directions should I explore more. https://github.com/llvm/llvm-project/pull/125420 _

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

2025-02-15 Thread Balazs Benics via cfe-commits
@@ -2464,6 +2464,10 @@ CFGBlock *CFGBuilder::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *Init, autoCreateBlock(); appendStmt(Block, Init); } + +// Unlike CXXDefaultArgExpr::getExpr stripped off the top level FullExpr and +// ConstantExpr, CXXDefaultIni

[clang] [NFC] [clang] fix unused variable warning (PR #126796)

2025-02-11 Thread Balazs Benics via cfe-commits
steakhal wrote: Ah, so this one is already merged. Then nvm. It's not worth a followup. https://github.com/llvm/llvm-project/pull/126796 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add performance-redundant-lookup check (PR #125420)

2025-02-15 Thread Balazs Benics via cfe-commits
steakhal wrote: > Thanks for the insight. Take your time. So, I spent a few hours experimenting and it's really difficult to do, only using `ExprSequence`. Just to recap, my idea was to match the assignments and inc/dec unary operator calls to detect if the container or the key object is mutat

[clang] [clang][analyzer] Add checker 'alpha.core.FixedAddressDereference' (PR #127191)

2025-02-15 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -129,6 +129,8 @@ The ``SuppressAddressSpaces`` option suppresses warnings for null dereferences of all pointers with address spaces. You can disable this behavior with the option ``-analyzer-config core.NullDereference:Supp

[clang] [clang][analyzer] Add checker 'alpha.core.FixedAddressDereference' (PR #127191)

2025-02-15 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: @@ -2919,6 +2921,42 @@ Check for assignment of a fixed address to a pointer. p = (int *) 0x1; // warn } +.. _alpha-core-FixedAddressDereference: + +alpha.core.FixedAddressDereference (C, C++, ObjC) +

[clang] [clang][analyzer] Add checker 'alpha.core.FixedAddressDereference' (PR #127191)

2025-02-15 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -1,7 +1,163 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -verify %s -// expected-no-diagnostics -void foo(void) { +extern void __assert_fail (__const char *__assertion, __const char *__file, +unsigned

<    16   17   18   19   20   21   22   23   24   25   >