[clang] [analyzer] Hotfix a boolean conversion crash in the Z3 SMTConv (PR #158276)

2025-09-22 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Following this thread gave me a sense of urgency. I'll admit, it took me much longer to write this comment than doing the review. I think the patch looks okay, given the circumstances. I'd only highlight here that I think using the argumen

[clang] [analyzer] Correct crash in Z3 wrapper (PR #158276)

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

[clang] [analyzer] Hotfix a boolean conversion crash in the Z3 SMTConv (PR #158276)

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

[clang] [analyzer] Prevent triplicate warnings for `sarif-html` (PR #158112)

2025-09-20 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,27 @@ +//==- SarifDiagnostics.h - SARIF Diagnostics for Paths --*- C++ -*-// steakhal wrote: I thin this line is not properly padded up. https://github.com/llvm/llvm-project/pull/158112 ___ cfe-commits maili

[clang] [analyzer] Improve messaging in security.VAList (PR #157846)

2025-09-20 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -101,8 +101,8 @@ void recopy(int fst, ...) { va_list va, va2; va_start(va, fst); va_copy(va2, va); // expected-note{{Initialized va_list}} - va_copy(va2, va); // expected-warning{{Initialized va_list 'va2' is initial

[clang] [analyzer] Prevent triplicate warnings for `sarif-html` (PR #158112)

2025-09-20 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,30 @@ +//==- PlistDiagnostics.h - Plist Diagnostics for Paths --*- 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: Apache-2.0 WITH

[clang] [analyzer][NFC] Modernize loops in LiveVariables analysis (PR #157670)

2025-09-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/157670 >From cb532a3e82ffd26b1f4352e8e2aa1c4aa3ef4a49 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 9 Sep 2025 16:07:51 +0200 Subject: [PATCH 1/4] [analyzer][NFC] Modernize iterator-based loop in LiveVariab

[clang] [analyzer] Show element count in ArrayBound underflow reports (PR #158639)

2025-09-18 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 Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/158639 ___ cfe-commits mailing list cf

[clang] [analyzer][NFC] Change LiveVariablesImpl::inAssignment from DenseMap to DenseSet (PR #157685)

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

[clang] [analyzer] Enhance array bound checking for `ConstantArrayType` (PR #159357)

2025-09-18 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID: In-Reply-To: @@ -637,11 +636,11 @@ static Messages getNegativeIndexMessage(StringRef Name, Name, ArraySiz

[clang] [analyzer] Enhance array bound checking for `ConstantArrayType` (PR #159357)

2025-09-18 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: steakhal wrote: > > Should we warn about flax arrays if `-fstrict-flex-arrays` is explicitly > > specified in the clang flags? > > https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fstrict-flex-arrays > > Yo

[clang] [analyzer] Revert #115918, so empty base class optimization works again (PR #157480)

2025-09-17 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/157480 Tldr; We can't unconditionally trivially copy empty classes because that would clobber the stored entries in the object that the optimized empty class overlaps with. This regression was introduced by #115918,

[clang] [clang][ASTImporter] Fixed test 'ctu-import-type-decl-definition' and ASTImporter (PR #158016)

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

[clang] [analyzer][NFC] Remove dead LiveVariables::Observer::observerKill (PR #157661)

2025-09-17 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/157661 This API was never used in the clang code base. There might be downstream users, but I highly doubt that. I think the best is to get rid of this unused API. >From 47ed659d09acefdcc4c712294f9d0fb925330ead Mon S

[clang] [analyzer][NFC] Fix a warning in RegionStore.cpp (PR #157630)

2025-09-17 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/157630 ``` clang/lib/StaticAnalyzer/Core/RegionStore.cpp: warning: bitwise operation between different enumeration types ('Kind' and '(anonymous namespace)::BindingKey::(unnamed enum at clang/lib/StaticAnalyzer/Core

[clang] [analyzer] Enhance array bound checking for `ConstantArrayType` (PR #159357)

2025-09-17 Thread Balazs Benics via cfe-commits
steakhal wrote: Should we warn about flax arrays if `-fstrict-flex-arrays` is explicitly specified in the clang flags? https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fstrict-flex-arrays https://github.com/llvm/llvm-project/pull/159357

[clang] [analyzer] Prevent triplicate warnings for `sarif-html` (PR #158112)

2025-09-16 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. > Can we have a test case for plist-html as well? Otherwise LGTM! +1 https://github.com/llvm/llvm-project/pull/158112 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [analyzer] Show element count in ArrayBound underflow reports (PR #158639)

2025-09-16 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -430,30 +419,41 @@ static bool tryDividePair(std::optional &Val1, return true; } -static Messages getExceedsMsgs(const MemSpaceRegion *Space, +static Messages getNonTaintM

[clang] [analyzer] Improve messaging in security.VAList (PR #157846)

2025-09-16 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal commented: I've quickly skimmed through, and it looks good. Nothing attacted my attention, so I didn't look closely. I was surprised though about how bad test coverage we have. I was expecting a much bigger footprint

[clang] [analyzer] Prevent triplicate warnings for `sarif-html` (PR #158112)

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

[clang] [analyzer] Prevent triplicate warnings for `sarif-html` (PR #158112)

2025-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. Makes sense. Thank you! I had a few nits, but after those we can land this. https://github.com/llvm/llvm-project/pull/158112 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [analyzer][NFC] Fix a warning in RegionStore.cpp (PR #157630)

2025-09-15 Thread Balazs Benics via cfe-commits
steakhal wrote: > @steakhal Why did you discard this patch? It looks good to me at first glance. Ah, accidentally :D I thought I already merged it. And in the `branches` section of your fork it doesn't say anything if you try to delete a branch that has an open PR. nvm. Reopening it. @NagyDon

[clang] [analyzer] Show element count in ArrayBound underflow reports (PR #158639)

2025-09-15 Thread Balazs Benics via cfe-commits
@@ -40,7 +70,7 @@ void gh86959(void) { while (rng()) TenElements[getIndex()] = 10; // expected-warning@-1 {{Out of bound access to memory preceding 'TenElements'}} - // expected-note@-2 {{Access of 'TenElements' at negative byte offset -688}} + // expected-note@-2 {{

[clang] [analyzer] Prevent triplicate warnings for `sarif-html` (PR #158112)

2025-09-15 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,30 @@ +//==- PlistDiagnostics.h - Plist Diagnostics for Paths --*- C++ -*-// steakhal wrote: Padding https://github.com/llvm/llvm-project/pull/158112 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] [analyzer] Prevent triplicate warnings for `sarif-html` (PR #158112)

2025-09-15 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,27 @@ +//==- SarifDiagnostics.h - SARIF Diagnostics for Paths --*- 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: Apache-2.0 WITH

[clang] [analyzer][NFC] Rename LivenessValues::equals to LivenessValues::operator== (PR #157657)

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

[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

2025-09-13 Thread Balazs Benics via cfe-commits
steakhal wrote: > [...] (In fact, the static analyzer already has the > [unix.Malloc](https://clang.llvm.org/docs/analyzer/checkers.html#unix-malloc-c) > checker which reports various bugs related to Malloc. If I recall correctly, > zero-sized allocations are already modeled and reported when

[clang] [analyzer] Revert #115918, so empty base class optimization works again (PR #157480)

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

[clang] [analyzer] Improve messaging in security.VAList (PR #157846)

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

[clang] [analyzer] Correct crash in Z3 wrapper (PR #158276)

2025-09-12 Thread Balazs Benics via cfe-commits
steakhal wrote: The tests look really fragile. Without knowing exactly how did we end up with a SymExpr that fails to convert to a Z3 formula, I'm tempted to push back. I think I've seen similar conversion errors and fixes from you. This suggests to me that we need to understand the underlying

[clang] [clang][ASTImporter] Fixed test 'ctu-import-type-decl-definition' and ASTImporter (PR #158016)

2025-09-12 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. https://github.com/llvm/llvm-project/pull/158016 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [analyzer] Improve messaging in security.VAList (PR #157846)

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

[clang] [analyzer][NFC] Modernize LivenessValues::isLive (PR #157800)

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

[clang] [analyzer][NFC] Modernize loops in LiveVariables analysis (PR #157670)

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

[clang] [analyzer][NFC] Modernize loops in LiveVariables analysis (PR #157670)

2025-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/157670 >From a6e7eddd339c46b47a5964ab2880c1e66a4746d5 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 9 Sep 2025 16:06:47 +0200 Subject: [PATCH 1/4] [analyzer][NFC] Modernize iterator-based loop in LiveVariab

[clang] [analyzer] In LivenessValues::equals also check liveBindings (PR #157645)

2025-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/157645 This was likely accidentally omitted when `liveBindings` was introduced. I don't think in practice it matters. >From 99e2c1391b0a4e9b7ccc412087202d60b89d08f4 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date:

[clang] [analyzer][NFC] Change LiveVariablesImpl::inAssignment from DenseMap to DenseSet (PR #157685)

2025-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/157685 The `inAssignment` variable is actually used as a set; let's declare it as a set. >From f7e4b8295a5e003ff272d9272d197e911bac30cc Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 9 Sep 2025 16:08:06 +02

[clang] [analyzer] In LivenessValues::equals also check liveBindings (PR #157645)

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

[clang] [analyzer][NFC] Modernize loops in LiveVariables analysis (PR #157670)

2025-09-09 Thread Balazs Benics via cfe-commits
steakhal wrote: Finally, I managed to reset the commit authors :sweat_smile: https://github.com/llvm/llvm-project/pull/157670 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Rename LivenessValues::equals to LivenessValues::operator== (PR #157657)

2025-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/157657 This is just more conventional. >From f0b70959750f94d5943d30efc79106ae5063265e Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 9 Sep 2025 12:52:40 +0200 Subject: [PATCH] [analyzer][NFC] Rename Liveness

[clang] [analyzer][NFC] Modernize loops in LiveVariables analysis (PR #157670)

2025-09-09 Thread Balazs Benics via cfe-commits
@@ -90,8 +90,8 @@ namespace { if (A.isEmpty()) return B; -for (typename SET::iterator it = B.begin(), ei = B.end(); it != ei; ++it) { - A = A.add(*it); +for (const auto &element : B) { steakhal wrote: Fixed in 1f10c7c79d73. https://git

[clang] [analyzer][NFC] Modernize loops in LiveVariables analysis (PR #157670)

2025-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/157670 >From 36480cff2af13ba75d94a306dabea372bb2b3614 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 9 Sep 2025 11:32:45 +0200 Subject: [PATCH 1/4] [analyzer][NFC] Modernize iterator-based loop in LiveVariab

[clang] [analyzer][NFC] Fix a warning in RegionStore.cpp (PR #157630)

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

[clang] [analyzer][NFC] Fix a warning in RegionStore.cpp (PR #157630)

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

[clang] [analyzer][NFC] Modernize loops in LiveVariables analysis (PR #157670)

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

[clang] [analyzer][NFC] Modernize iterator-based loop in LiveVariables::computeLiveness (PR #157670)

2025-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/157670 >From 36480cff2af13ba75d94a306dabea372bb2b3614 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 9 Sep 2025 11:32:45 +0200 Subject: [PATCH 1/3] [analyzer][NFC] Modernize iterator-based loop in LiveVariab

[clang] [analyzer] In LivenessValues::equals also check liveBindings (PR #157645)

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

[clang] [analyzer][NFC] Modernize iterator-based loop in LiveVariables::computeLiveness (PR #157670)

2025-09-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/157670 None >From 36480cff2af13ba75d94a306dabea372bb2b3614 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 9 Sep 2025 11:32:45 +0200 Subject: [PATCH] [analyzer][NFC] Modernize iterator-based loop in LiveVari

[clang] [analyzer][NFC] Remove dead LiveVariables::Observer::observerKill (PR #157661)

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

[clang] [analyzer][NFC] Fix a warning in RegionStore.cpp (PR #157630)

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

[clang] [analyzer] Revert #115918, so empty base class optimization works again (PR #157480)

2025-09-08 Thread Balazs Benics via cfe-commits
steakhal wrote: > Sounds reasonable. > > I feel a bit guilty that I wasn't able to predict this regression when I > reviewed the reverted commit as "LGTM, clean little patch", but I don't think > that I could've done better without investing drastically more effort into > the review. You act

[clang] [clang][analyzer] Add checker 'core.NullPointerArithm' (PR #157129)

2025-09-08 Thread Balazs Benics via cfe-commits
@@ -379,6 +386,111 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, C.addTransition(State, this); } +void DereferenceChecker::checkPreStmt(const BinaryOperator *Op, + CheckerContext &C) const { + if (!Op->isAdditiveO

[clang] [analyzer] Revert #115918, so empty base class optimization works again (PR #157480)

2025-09-08 Thread Balazs Benics via cfe-commits
steakhal wrote: FYI @ziqingluo-90 https://github.com/llvm/llvm-project/pull/157480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Revert #115918, so empty base class optimization works again (PR #157480)

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

[clang] [clang][analyzer] Add checker 'core.NullPointerArithm' (PR #157129)

2025-09-07 Thread Balazs Benics via cfe-commits
@@ -379,6 +386,111 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, C.addTransition(State, this); } +void DereferenceChecker::checkPreStmt(const BinaryOperator *Op, + CheckerContext &C) const { + if (!Op->isAdditiveO

[clang] [clang][analyzer] Model `strxfrm` (PR #156507)

2025-09-07 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -2243,6 +2246,109 @@ void CStringChecker::evalStrcpyCommon(CheckerContext &C, const CallEvent &Call,

[clang] [clang][analyzer] Model `strxfrm` (PR #156507)

2025-09-07 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/156507 _

[clang] [clang][analyzer] Add checker 'core.NullPointerArithm' (PR #157129)

2025-09-06 Thread Balazs Benics via cfe-commits
@@ -379,6 +386,111 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, C.addTransition(State, this); } +void DereferenceChecker::checkPreStmt(const BinaryOperator *Op, + CheckerContext &C) const { + if (!Op->isAdditiveO

[clang] [clang][analyzer] Add checker 'core.NullPointerArithm' (PR #157129)

2025-09-06 Thread Balazs Benics via cfe-commits
@@ -379,6 +386,111 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, C.addTransition(State, this); } +void DereferenceChecker::checkPreStmt(const BinaryOperator *Op, + CheckerContext &C) const { + if (!Op->isAdditiveO

[clang] [clang][analyzer] Add checker 'core.NullPointerArithm' (PR #157129)

2025-09-06 Thread Balazs Benics via cfe-commits
@@ -379,6 +386,111 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, C.addTransition(State, this); } +void DereferenceChecker::checkPreStmt(const BinaryOperator *Op, + CheckerContext &C) const { + if (!Op->isAdditiveO

[clang] [clang][analyzer] Model `strxfrm` (PR #156507)

2025-09-05 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =

[clang] [analyzer] Improve handling of placement new in `PointerArith` (PR #155855)

2025-09-05 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/155855 _

[clang] [clang][analyzer] Model `strxfrm` (PR #156507)

2025-09-05 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID: In-Reply-To: https://github.com/steakhal commented: I think it looks great. So my instinct w

[clang] [clang] Remove shell requirements from tests (PR #156905)

2025-09-05 Thread Balazs Benics via cfe-commits
steakhal wrote: The `clang/test/Analysis` part looks good to me. Thank you! https://github.com/llvm/llvm-project/pull/156905 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Consolidate the va_list checkers (PR #156682)

2025-09-04 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM. I skipped the tests though. Let a couple of remarks along the way. Nothing major. https://github.com/llvm/llvm-project/pull/156682 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [analyzer] Consolidate the va_list checkers (PR #156682)

2025-09-04 Thread Balazs Benics via cfe-commits
@@ -1859,6 +1859,32 @@ this) and always check the return value of these calls. This check corresponds to SEI CERT Rule `POS36-C `_. +.. _security-VAList: +

[clang] [analyzer] Consolidate the va_list checkers (PR #156682)

2025-09-04 Thread Balazs Benics via cfe-commits
@@ -1859,6 +1859,32 @@ this) and always check the return value of these calls. This check corresponds to SEI CERT Rule `POS36-C `_. +.. _security-VAList: +

[clang] [analyzer] Consolidate the va_list checkers (PR #156682)

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

[clang] [clang] Fix crash 'Cannot get layout of forward declarations' during CTU static analysis (PR #156056)

2025-09-04 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: steakhal wrote: > I still see a buildbot error in the clang-ppc64-aix builder: > > ``` > sed -i='' 's/$/.ast/' > /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/too

[clang] [analyzer] Clean up bug types in CallAndMessageChecker (PR #156073)

2025-09-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 Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/156073 _

[clang] [analyzer] Clean up bug types in CallAndMessageChecker (PR #156073)

2025-09-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/156073 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Remove checker 'alpha.core.CastSize' (PR #156350)

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

[clang] [clang][analyzer] Add plist macro formatting (PR #156046)

2025-09-02 Thread Balazs Benics via cfe-commits
steakhal wrote: > Can't find any unit tests for methods in PlistDiagnostics.cpp > > So adding the unit test in > `clang/unittests/Analysis/MacroExpansionContextTest.cpp` Since it contains > some similar MacroExpansionContextTest functionality tests. Also, since the > newly defined function `g

[clang] [analyzer] Clean up bug types in CallAndMessageChecker (PR #156073)

2025-09-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -143,68 +143,49 @@ def BitwiseShiftChecker : Checker<"BitwiseShift">, ]>, Documentation; -def CallAndMessageModeling : Checker<"CallAndMessageModeling">, - HelpText<"Responsible for essential modeling and assumptions a

[clang] [analyzer] Clean up bug types in CallAndMessageChecker (PR #156073)

2025-09-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -108,29 +109,26 @@ class CallAndMessageChecker bool PreVisitProcessArg(CheckerContext &C, SVal V, SourceRange ArgRange, const Expr *ArgEx, int ArgumentNumber, bool CheckU

[clang] [analyzer] Clean up bug types in CallAndMessageChecker (PR #156073)

2025-09-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -31,34 +31,38 @@ namespace { class CallAndMessageChecker : public Checker { - mutable std::unique_ptr BT_call_null; - mutable std::unique_ptr BT_call_undef; - mutable std::unique_ptr BT_cxx_call_null; - mutable std::u

[clang] [analyzer] Clean up bug types in CallAndMessageChecker (PR #156073)

2025-09-02 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 reasonable to me. Thank you! https://github.com/llvm/llvm-project/pull/156073 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer] Clean up bug types in CallAndMessageChecker (PR #156073)

2025-09-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -31,34 +31,38 @@ namespace { class CallAndMessageChecker : public Checker { - mutable std::unique_ptr BT_call_null; - mutable std::unique_ptr BT_call_undef; - mutable std::unique_ptr BT_cxx_call_null; - mutable std::u

[clang] [clang][analyzer] Remove checker 'alpha.core.CastSize' (PR #156350)

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

[clang] [analyzer] Improve handling of placement new in `PointerArith` (PR #155855)

2025-09-02 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: steakhal wrote: > This change itself seems to be correct, but I have doubts about the overall > viability of the implementation of this `alpha` checker. > >

[clang] [clang][analyzer] Add plist macro formatting (PR #156046)

2025-08-29 Thread Balazs Benics via cfe-commits
steakhal wrote: Speaking of testing, we should probably not overdo it. Clang format is a different component. They likely want to remain flexible. If we pin their output too hard, they would become unhappy long term. Consequently, having a couple is desired, but other than that if we want to pi

[clang] [clang][analyzer] Add plist macro formatting (PR #156046)

2025-08-29 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: Looks great. This should be tested in the unittests, somehwere the sibling APIs are tested. https://github.com/llvm/llvm-project/pull/156046 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

2025-08-29 Thread Balazs Benics via cfe-commits
steakhal wrote: > > > > I don't think I have the time to do a proper focused review, so I'd at > > > > this point forward you to @NagyDonat to finish the reviews. > > > > > > > > > @steakhal The "Requested change" review status is still active from your > > > old review. Is it just a github g

[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

2025-08-29 Thread Balazs Benics via cfe-commits
steakhal wrote: > > I don't think I have the time to do a proper focused review, so I'd at this > > point forward you to @NagyDonat to finish the reviews. > > @steakhal The "Requested change" review status is still active from your old > review. Is it just a github glitch? Im on vacation. I

[clang] [analyzer] Improve handling of placement new in `PointerArith` (PR #155855)

2025-08-28 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -165,3 +165,124 @@ void LValueToRValueBitCast_dumps(void *p, char (*array)[8]) { unsigned long ptr_arithmetic(void *p) { return __builtin_bit_cast(unsigned long, p) + 1; // no-crash } + + +void escape(int*); +

[clang] [analyzer] Improve handling of placement new in `PointerArith` (PR #155855)

2025-08-28 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -74,6 +74,26 @@ class PointerArithChecker REGISTER_MAP_WITH_PROGRAMSTATE(RegionState, const MemRegion *, AllocKind) +namespace { steakhal wrote: We follow the LLVM style guide, which promotes t

[clang] [analyzer] Improve handling of placement new in `PointerArith` (PR #155855)

2025-08-28 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -165,3 +165,124 @@ void LValueToRValueBitCast_dumps(void *p, char (*array)[8]) { unsigned long ptr_arithmetic(void *p) { return __builtin_bit_cast(unsigned long, p) + 1; // no-crash } + + +void escape(int*); +

[clang] [analyzer] Improve handling of placement new in `PointerArith` (PR #155855)

2025-08-28 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -165,3 +165,124 @@ void LValueToRValueBitCast_dumps(void *p, char (*array)[8]) { unsigned long ptr_arithmetic(void *p) { return __builtin_bit_cast(unsigned long, p) + 1; // no-crash } + + +void escape(int*); +

[clang] [analyzer] Improve handling of placement new in `PointerArith` (PR #155855)

2025-08-28 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -165,3 +165,124 @@ void LValueToRValueBitCast_dumps(void *p, char (*array)[8]) { unsigned long ptr_arithmetic(void *p) { return __builtin_bit_cast(unsigned long, p) + 1; // no-crash } + + +void escape(int*); +

[clang] [analyzer] Improve handling of placement new in `PointerArith` (PR #155855)

2025-08-28 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/steakhal requested changes to this pull request. Looks sweet. I did the first round, I'll let others to finish the rest while I'm on vacation https://github.com/llvm/llvm-project/pull/155855 ___

[clang] [analyzer] Improve handling of placement new in `PointerArith` (PR #155855)

2025-08-28 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/155855 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe

[clang] Fix unique_ptr aggregate initialization false positives (PR #155131)

2025-08-26 Thread Balazs Benics via cfe-commits
@@ -14,6 +14,8 @@ #include "Inputs/system-header-simulator-for-malloc.h" +#include steakhal wrote: Yes, that should largely work. https://github.com/llvm/llvm-project/pull/155131 ___ cfe-commits mailing list cfe-

[clang] [analyzer] Drop assertion enforcing that assume args are known constants (PR #151908)

2025-08-25 Thread Balazs Benics via cfe-commits
steakhal wrote: /cherry-pick 0a1eff2ecedcb11acb3e9d4b75ee1e1bebd69a70 6c9f1ce429809e5a91683ed6cef9a435047bebd1 https://github.com/llvm/llvm-project/pull/151908 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

2025-08-22 Thread Balazs Benics via cfe-commits
steakhal wrote: One more comment. Please don't use force-pushes on GitHub. That ruins the review experience. Use merges instead, and never break your commit history chain. Another remark would be to add the commit hash to the reply comment where you say that something was fixed. That way the

[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

2025-08-22 Thread Balazs Benics via cfe-commits
@@ -3068,12 +3124,240 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, C.addTransition(state->set(RS), N); } +// Helper function to check if a name is a recognized smart pointer name +static bool isSmartPtrName(StringRef Name) { + return Name == "unique_ptr

[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

2025-08-22 Thread Balazs Benics via cfe-commits
@@ -3068,12 +3124,240 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, C.addTransition(state->set(RS), N); } +// Helper function to check if a name is a recognized smart pointer name +static bool isSmartPtrName(StringRef Name) { + return Name == "unique_ptr

[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

2025-08-22 Thread Balazs Benics via cfe-commits
@@ -1096,6 +1104,54 @@ class StopTrackingCallback final : public SymbolVisitor { return true; } }; + +/// EscapeTrackedCallback - A SymbolVisitor that marks allocated symbols as +/// escaped. +/// +/// This visitor is used to suppress false positive leak reports when smar

[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

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

[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

2025-08-22 Thread Balazs Benics via cfe-commits
@@ -3068,12 +3124,240 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, C.addTransition(state->set(RS), N); } +// Helper function to check if a name is a recognized smart pointer name +static bool isSmartPtrName(StringRef Name) { + return Name == "unique_ptr

[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

2025-08-22 Thread Balazs Benics via cfe-commits
@@ -3068,12 +3124,240 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, C.addTransition(state->set(RS), N); } +// Helper function to check if a name is a recognized smart pointer name +static bool isSmartPtrName(StringRef Name) { + return Name == "unique_ptr

  1   2   3   4   5   6   7   8   9   10   >