[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

[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 commented: I think it looks pretty good. A lot of improvements! 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. https://github.com/llvm/llvm-project/pull/152751 _

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

2025-08-22 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,44 @@ +// RUN: %clang_analyze_cc1 -verify -analyzer-output=text %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=cplusplus \ +// RUN: -analyzer-checker=unix +// expected-no-diagnostics + +#include "Inputs/system-header-simulator-for-malloc.h" + +/

[clang] [clang-tools-extra] [Clang] [C2y] Implement N3355 ‘NamedLoops’ (PR #152870)

2025-08-22 Thread Balazs Benics via cfe-commits
steakhal wrote: I was initially surprised that the clang CFG was not changed in the PR. This made me suspicious. Later realized that since this change was implemented in terms of the `BreakStmt`, everything should work out of the box. I started playing with it and everything looked correct to me

[clang] [Clang][analyzer][NFC] Const-correct CheckerContext API (PR #154741)

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

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

2025-08-21 Thread Balazs Benics via cfe-commits
steakhal wrote: @tru I have this (https://github.com/llvm/llvm-project/commit/0a1eff2ecedcb11acb3e9d4b75ee1e1bebd69a70) simple patch that I want to backport to clang-21, however, it broke the CI build on main, so there was a followup patch (https://github.com/llvm/llvm-project/commit/6c9f1ce4

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

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

[clang] [Analyzer] No longer crash with VLA operands to unary type traits (PR #151719)

2025-08-21 Thread Balazs Benics via cfe-commits
steakhal wrote: The clang-21 backport PR is #154738. https://github.com/llvm/llvm-project/pull/151719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Update diagnostics and documentation for type aware allocators (PR #148576)

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

[clang] [clang] Update diagnostics and documentation for type aware allocators (PR #148576)

2025-08-20 Thread Balazs Benics via cfe-commits
@@ -1191,6 +1189,9 @@ New features so frequent 'not yet implemented' diagnostics should be expected. Also, the ACC MLIR dialect does not currently implement any lowering to LLVM-IR, so no code generation is possible for OpenACC. +- Implemented `P2719R5 Type-aware allocat

[clang] [OpenACC][Docs] Add a release note for Clang 21 (PR #145938)

2025-08-20 Thread Balazs Benics via cfe-commits
steakhal wrote: Hi, I was about to update the Static Analyzer release notes, and I noticed that it had this entry. Could you please move it somewhere more appropriate? I don't think the content right now relates to the Clang Static Analyzer. https://github.com/llvm/llvm-project/pull/145938

[clang] [Analyzer] No longer crash with VLA operands to unary type traits (PR #151719)

2025-08-20 Thread Balazs Benics via cfe-commits
steakhal wrote: /cherry-pick 17327482f045b7119e116320db3e9c12fcf250ae https://github.com/llvm/llvm-project/pull/151719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Analyzer] No longer crash with VLA operands to unary type traits (PR #151719)

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

[clang] [Analyzer] No longer crash with VLA operands to unary type traits (PR #151719)

2025-08-20 Thread Balazs Benics via cfe-commits
steakhal wrote: /cherry-pick 17327482f045b7119e116320db3e9c12fcf250ae https://github.com/llvm/llvm-project/pull/151719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Relax assertion for non-default address spaces in the cstring checker (PR #153498)

2025-08-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/153498 ___ 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 check 'bugprone-cast-to-struct' (PR #153428)

2025-08-19 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -0,0 +1,33 @@ +// RUN: %check_clang_tidy %s bugprone-cast-to-struct %t -- \ +// RUN: -config="{CheckOptions: {bugprone-cast-to-struct.IgnoredCasts: 'char;S1;int;Other*'}}" steakhal

[clang-tools-extra] [clang-tidy] Add check 'bugprone-cast-to-struct' (PR #153428)

2025-08-19 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= , =?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: https://github.com/steakhal requested changes to this pull request. https://github.com/llvm/llvm-project/pull/153428 ___ cfe-commits mailing list cfe-comm

[clang-tools-extra] [clang-tidy] Add check 'bugprone-cast-to-struct' (PR #153428)

2025-08-19 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -0,0 +1,82 @@ +//===--- CastToStructCheck.cpp - clang-tidy ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://

[clang] [clang] Replace SmallSet with SmallPtrSet (NFC) (PR #154262)

2025-08-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Thanks https://github.com/llvm/llvm-project/pull/154262 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Remove trivially true condition (PR #152850)

2025-08-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/152850 ___ 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-09 Thread Balazs Benics via cfe-commits
@@ -3068,11 +3111,174 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, C.addTransition(state->set(RS), N); } +// Use isWithinStdNamespace from CheckerHelpers.h instead of custom +// implementation + +// Allowlist of owning smart pointers we want to recognize

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

2025-08-09 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-09 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,80 @@ +// RUN: %clang_analyze_cc1 -verify -analyzer-output=text %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=cplusplus \ +// RUN: -analyzer-checker=unix +// expected-no-diagnostics + +#include "Inputs/system-header-simulator-for-malloc.h" + +/

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

2025-08-09 Thread Balazs Benics via cfe-commits
@@ -3068,11 +3111,174 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, C.addTransition(state->set(RS), N); } +// Use isWithinStdNamespace from CheckerHelpers.h instead of custom +// implementation + +// Allowlist of owning smart pointers we want to recognize

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

2025-08-09 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,80 @@ +// RUN: %clang_analyze_cc1 -verify -analyzer-output=text %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=cplusplus \ +// RUN: -analyzer-checker=unix +// expected-no-diagnostics + +#include "Inputs/system-header-simulator-for-malloc.h" + +/

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

2025-08-09 Thread Balazs Benics via cfe-commits
@@ -3068,11 +3111,174 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, C.addTransition(state->set(RS), N); } +// Use isWithinStdNamespace from CheckerHelpers.h instead of custom +// implementation + +// Allowlist of owning smart pointers we want to recognize

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

2025-08-09 Thread Balazs Benics via cfe-commits
@@ -3107,24 +3111,13 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, C.addTransition(state->set(RS), N); } -static QualType canonicalStrip(QualType QT) { - return QT.getCanonicalType().getUnqualifiedType(); -} - -static bool isInStdNamespace(const DeclCont

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

2025-08-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. I like the progress. It's definitely going in the right direction. Keep it up! https://github.com/llvm/llvm-project/pull/152751 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2025-08-09 Thread Balazs Benics via cfe-commits
@@ -1096,6 +1098,47 @@ 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-09 Thread Balazs Benics via cfe-commits
@@ -52,6 +52,7 @@ #include "clang/AST/DeclTemplate.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" + steakhal wrote: ```suggestion ``` https://github.com/llvm/llvm-project/pull/152751 ___ cfe-commits m

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

2025-08-09 Thread Balazs Benics via cfe-commits
@@ -1096,6 +1098,47 @@ 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-09 Thread Balazs Benics via cfe-commits
@@ -1096,6 +1098,47 @@ 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-09 Thread Balazs Benics via cfe-commits
@@ -3068,11 +3111,174 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, C.addTransition(state->set(RS), N); } +// Use isWithinStdNamespace from CheckerHelpers.h instead of custom +// implementation + +// Allowlist of owning smart pointers we want to recognize

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

2025-08-09 Thread Balazs Benics via cfe-commits
@@ -3068,11 +3107,217 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, C.addTransition(state->set(RS), N); } +static QualType canonicalStrip(QualType QT) { + return QT.getCanonicalType().getUnqualifiedType(); +} + +static bool isInStdNamespace(const DeclCon

  1   2   3   4   5   6   7   8   9   10   >