[clang] [llvm] [analyzer] Correct Z3 test cases, fix exposed crashes (PR #146597)

2025-07-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, thanks for fixing these testcases! I suggested one minor simplification in an inline comment, but overall I'm satisfied with the code. https://github.com/llvm/llvm-project/pull/146597 ___

[clang] [clang] Build the Z3 mock module via CMake (PR #146284)

2025-06-30 Thread Donát Nagy via cfe-commits
NagyDonat wrote: @mgorny Thank you very much for developing this more elegant build solution for this mock module! https://github.com/llvm/llvm-project/pull/146284 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-06-30 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > I played with the idea and there is one wrinkle. EvalBinOp applies tactics > that can reduce the requested operation to known values or ranges after > applying some logic, like: > > * eagerly fold away multiplications to 1 > > * shifting 0 left or right to a cast >

[clang] [NFC][analyzer] Use %clang_analyze_cc1 consistently (PR #145895)

2025-06-30 Thread Donát Nagy via cfe-commits
NagyDonat wrote: After rebasing and validating that the tests pass locally, I'm merging this commit. https://github.com/llvm/llvm-project/pull/145895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang] [NFC][analyzer] Use %clang_analyze_cc1 consistently (PR #145895)

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

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

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

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-06-30 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > > [...] This different sort of limitation still guarantees that we cannot > > build overly complex symbols, but its implementation is significantly > > shorter (just three early return statements for unary operator, binary > > operator and cast evaluation). > > 💡 In fact, yo

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

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

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-06-30 Thread Donát Nagy via cfe-commits
NagyDonat wrote: Yet another misclick -- the cursed „Close with comment” is placed at a location where I intuitively expect a „Cancel” button. https://github.com/llvm/llvm-project/pull/144327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [NFC][analyzer] Use %clang_analyze_cc1 consistently (PR #145895)

2025-06-30 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/145895 From 06bfdd1e2ce11716dad904b8f2736c5b404f1c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Thu, 26 Jun 2025 15:17:05 +0200 Subject: [PATCH 1/2] [NFC][analyzer] Use %clang_analyze_cc1 cons

[clang] [llvm] [NFC][analyzer] Remove Z3-as-constraint-manager hacks from lit test code (PR #145731)

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

[clang] [llvm] [NFC][analyzer] Remove Z3-as-constraint-manager hacks from lit test code (PR #145731)

2025-06-26 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I showed the contents of this commit to @gamesh411 and we decided to mark the two "expected to fail" tests with XFAIL to ensure that we don't introduce new failures (he clarified that before my commit by default they were in an UNSUPPORTED state, and not a crashing/failing sta

[clang] [NFC][analyzer] Use %clang_analyze_cc1 consistently (PR #145895)

2025-06-26 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/145895 A large majority of the LIT tests of the clang static analyzer use RUN lines with the placeholder `%clang_analyze_cc1` which expands to `%clang_cc1 -analyze -setup-static-analyzer` where the only effect of `-

[clang] [llvm] [NFC][analyzer] Remove Z3-as-constraint-manager hacks from lit test code (PR #145731)

2025-06-26 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/145731 From 6e86b4b8e6e316113fcc820cd4f05f883cf0f9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 24 Jun 2025 17:44:43 +0200 Subject: [PATCH 1/5] [NFC][analyzer] Remove Z3-as-constraint-man

[clang] [analyzer] Fix tests broken by empty %z3_include_dir (PR #146042)

2025-06-27 Thread Donát Nagy via cfe-commits
@@ -173,13 +173,16 @@ def have_host_clang_repl_cuda(): config.available_features.add("staticanalyzer") tools.append("clang-check") +I_z3_include_dir = "" if config.clang_staticanalyzer_z3: config.available_features.add("z3") -config.substituti

[clang] [analyzer] Fix tests broken by empty %z3_include_dir (PR #146042)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: Apparently this does not work: https://github.com/llvm/llvm-project/pull/145731#issuecomment-3012659748 https://github.com/llvm/llvm-project/pull/146042 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] [analyzer] Fix tests broken by empty %z3_include_dir (PR #146042)

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

[clang] [llvm] [NFC][analyzer] Remove Z3-as-constraint-manager hacks from lit test code (PR #145731)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: @mgorny I was unable to reproduce the failure that you observed -- based on the error message that you posted, you're in a situation where Z3_INCLUDE_DIR is not set by the clang build system _but_ these two tests which are marked with `REQUIRES: z3` are still executed somehow.

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I'm still convinced that the solution that returns `UnknownVal`s is unacceptable from a code readability and maintainability perspective. In my opinion adding so much complexity would be only acceptable if it was the only way to fix regularly occurring crash, and enforcing thi

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

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

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

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

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > I'm still convinced that the solution that returns `UnknownVal`s is > unacceptable from a code readability and maintainability perspective. In my > opinion adding so much complexity would be only acceptable if it was the only > way to fix regularly occurring crash, and enfor

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: Closing this ticket was a misclick, sorry. https://github.com/llvm/llvm-project/pull/144327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [NFC][analyzer] Remove Z3-as-constraint-manager hacks from lit test code (PR #145731)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I created PR https://github.com/llvm/llvm-project/pull/146042 which should hopefully fix this issue. (Right now I'm rebuilding clang to ensure that it is indeed working.) https://github.com/llvm/llvm-project/pull/145731 ___ cfe-commi

[clang] [analyzer] Fix tests broken by empty %z3_include_dir (PR #146042)

2025-06-27 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/146042 From b7bfc546397c42b1e26cfd0d10bdf583d0091ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Fri, 27 Jun 2025 11:22:29 +0200 Subject: [PATCH 1/2] [analyzer] Fix tests broken by empty %z3_in

[clang] [NFC][analyzer] Use %clang_analyze_cc1 consistently (PR #145895)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I will postpone merging this until the issues with https://github.com/llvm/llvm-project/commit/40cc4379cda6e0d6efe72c55d1968f9cf427a16a are fixed (for the unlikely case if that commit ends up being reverted). https://github.com/llvm/llvm-project/pull/145895 ___

[clang] [llvm] [NFC][analyzer] Remove Z3-as-constraint-manager hacks from lit test code (PR #145731)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: Thank you, that would be very helpful! I'm not familiar with the cmake implementation details of the standalone build (until now I didn't even know about its existence), so finding a solution would've taken lots of time for me. https://github.com/llvm/llvm-project/pull/145731

[clang] [analyzer] Fix tests broken by empty %z3_include_dir (PR #146042)

2025-06-27 Thread Donát Nagy via cfe-commits
@@ -173,13 +173,16 @@ def have_host_clang_repl_cuda(): config.available_features.add("staticanalyzer") tools.append("clang-check") +I_z3_include_dir = "" if config.clang_staticanalyzer_z3: config.available_features.add("z3") -config.substituti

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > Let me know if you means something like this when you referred to "you can > insert one more early return". Yes, I thought about something like your code example. > > If you really want to bother with performance improvements that > > specifically target this 0.05% of the e

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: :thinking: I agree that it wouldn't be elegant to add > ``` > + if (isa_and_nonnull(lhs.getAsSymbol()) || > + isa_and_nonnull(rhs.getAsSymbol())) > +return UnknownVal(); > ``` because this way `SymbolOverlyComplex` would become an overcomplicated intermediate step th

[clang] [llvm] [NFC][analyzer] Remove Z3-as-constraint-manager hacks from lit test code (PR #145731)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I'll be on vacation during the weekend and on Monday, so feel free to merge the fix without me if you have it. https://github.com/llvm/llvm-project/pull/145731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] [llvm] [NFC][analyzer] Remove Z3-as-constraint-manager hacks from lit test code (PR #145731)

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

[clang] [llvm] [NFC][analyzer] Remove Z3-as-constraint-manager hacks from lit test code (PR #145731)

2025-06-26 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/145731 From 6e86b4b8e6e316113fcc820cd4f05f883cf0f9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 24 Jun 2025 17:44:43 +0200 Subject: [PATCH 1/4] [NFC][analyzer] Remove Z3-as-constraint-man

[clang] [analyzer] Fix tests broken by empty %z3_include_dir (PR #146042)

2025-06-27 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/146042 This commit should fix the build failure caused by my recent commit 40cc4379cda6e0d6efe72c55d1968f9cf427a16a From b7bfc546397c42b1e26cfd0d10bdf583d0091ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=2

[clang] [NFC][analyzer] Use %clang_analyze_cc1 consistently (PR #145895)

2025-06-27 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/145895 From 06bfdd1e2ce11716dad904b8f2736c5b404f1c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Thu, 26 Jun 2025 15:17:05 +0200 Subject: [PATCH 1/2] [NFC][analyzer] Use %clang_analyze_cc1 cons

[clang] [NFC][analyzer] Use %clang_analyze_cc1 consistently (PR #145895)

2025-06-27 Thread Donát Nagy via cfe-commits
@@ -10,7 +10,7 @@ // DEFINE: %{mocked_clang} = \ // DEFINE: LD_PRELOAD="%t/MockZ3_solver_check.so" \ -// DEFINE: %clang_cc1 %s -analyze -setup-static-analyzer \ +// DEFINE: %clang_analyze_cc1 %s -setup-static-analyzer \

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > We see a lot of `simplifySValOnce` that decomposes the symbol and traverses > the tree. With my original patch it's not present likely because the > `Unknowns` poison the the tree so there is nothing to be traversed. This is > why with my original patch we actually improve t

[clang] [llvm] [NFC][analyzer] Remove Z3-as-constraint-manager hacks from lit test code (PR #145731)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: Sorry for the failures -- I'll try to troubleshoot them ASAP. https://github.com/llvm/llvm-project/pull/145731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-06-27 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > The bug was that we inserted the `T` into the expected `InsertPos` > corresponding to the `Profile` of `T` - so far so good, but instead of > returning that, we checked if this is "overly complicated", and if so, we > created the new `SymbolOverlyComplex` symbol and returned

[clang] [clang][analyzer] Add checker 'unix.cstring.MissingTerminatingZero' (PR #146664)

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

[clang] [analyzer] Connversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-04 Thread Donát Nagy via cfe-commits
@@ -2681,27 +2693,16 @@ void MallocChecker::HandleOffsetFree(CheckerContext &C, SVal ArgVal, void MallocChecker::HandleUseAfterFree(CheckerContext &C, SourceRange Range, SymbolRef Sym) const { - - if (!ChecksEnabled[CK_MallocChecker] &&

[clang] [analyzer] Avoid unnecessary super region invalidation in `CStringChecker` (PR #146212)

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

[clang] [analyzer] Avoid unnecessary super region invalidation in `CStringChecker` (PR #146212)

2025-07-03 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: Thanks for the updates! I added a few minor comments, but I hope that after those the PR could be merged. https://github.com/llvm/llvm-project/pull/146212 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer] Avoid unnecessary super region invalidation in `CStringChecker` (PR #146212)

2025-07-03 Thread Donát Nagy via cfe-commits
@@ -0,0 +1,106 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s NagyDonat wrote: Please ensure that (the relevant parts of) `CStringChecker` is actually enabled in this test file -- its sub-checkers are in the `unix.cstring` and `alpha.unix.cstr

[clang] [analyzer] Avoid unnecessary super region invalidation in `CStringChecker` (PR #146212)

2025-07-03 Thread Donát Nagy via cfe-commits
@@ -2223,16 +2223,59 @@ void CStringChecker::evalStrcpyCommon(CheckerContext &C, const CallEvent &Call, Result = lastElement; } +// For bounded method, amountCopied take the minimum of two values, +// for ConcatFnKind::strlcat: +// amountCopied = min (

[clang] [clang][analyzer] Add checker 'unix.cstring.MissingTerminatingZero' (PR #146664)

2025-07-04 Thread Donát Nagy via cfe-commits
@@ -0,0 +1,295 @@ +//=== MissingTerminatingZeroChecker.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: Ap

[clang] [clang][analyzer] Add checker 'unix.cstring.MissingTerminatingZero' (PR #146664)

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

[clang] [clang][analyzer] Add checker 'unix.cstring.MissingTerminatingZero' (PR #146664)

2025-07-04 Thread Donát Nagy via cfe-commits
@@ -2098,6 +2098,58 @@ Check the size argument passed into C string functions for common erroneous patt // warn: potential buffer overflow } +.. _unix-cstring-MissingTerminatingZero: + +unix.cstring.MissingTerminatingZero (C) +""" +Ch

[clang] [clang][analyzer] Add checker 'unix.cstring.MissingTerminatingZero' (PR #146664)

2025-07-04 Thread Donát Nagy via cfe-commits
@@ -0,0 +1,295 @@ +//=== MissingTerminatingZeroChecker.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: Ap

[clang] [analyzer] Avoid unnecessary super region invalidation in `CStringChecker` (PR #146212)

2025-07-04 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, thanks for the updates! Before merging the commit consider adding a note to the PR description / commit message that in the case of `strlcat` you use `size` as an approximation of the exact `amountCopied`. https://github.com/llvm/

[clang] [analyzer] Connversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-04 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/147080 This commit converts MallocChecker to the new checker family framework that was introduced in the recent commit 6833076a5d9f5719539a24e900037da5a3979289 -- and gets rid of some awkward unintended interactions

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

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

[clang] [analyzer] Enforce not making overly complicated symbols (PR #144327)

2025-07-08 Thread Donát Nagy via cfe-commits
NagyDonat wrote: Thank you for the very through statistical analysis and visualization -- this paints a clear picture about the effects of the change. > In conclusion, in contrast to the originally proposed variant of this patch > this evolved version is more controversial and the benefits are

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

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

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-08 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147080 From c0e669a4f31702a871fce4c8c3805b322c331afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 2 Jul 2025 15:09:42 +0200 Subject: [PATCH 01/10] [analyzer] Connversion to CheckerFamily: M

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-08 Thread Donát Nagy via cfe-commits
@@ -333,11 +333,55 @@ template static bool isStandardNewDelete(const T &FD) { return isStandardDelete(FD) || isStandardNew(FD); } +namespace { + //===--===// -// Definition of the MallocChecker class. +/

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-08 Thread Donát Nagy via cfe-commits
@@ -333,11 +333,55 @@ template static bool isStandardNewDelete(const T &FD) { return isStandardDelete(FD) || isStandardNew(FD); } +namespace { + //===--===// -// Definition of the MallocChecker class. +/

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-08 Thread Donát Nagy via cfe-commits
@@ -333,11 +333,55 @@ template static bool isStandardNewDelete(const T &FD) { return isStandardDelete(FD) || isStandardNew(FD); } +namespace { + //===--===// -// Definition of the MallocChecker class. +/

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
@@ -327,39 +327,7 @@ void testArrayDestr() { clang_analyzer_warnIfReached(); // no-warning } -// Invalidate Region even in case of default destructor -class InvalidateDestTest { -public: - int x; - int *y; - ~InvalidateDestTest(); -}; - -int test_member_invalidation() { -

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
@@ -402,16 +449,19 @@ class MallocChecker const char *NL, const char *Sep) const override; private: - mutable std::unique_ptr BT_DoubleFree[CK_NumCheckKinds]; - mutable std::unique_ptr BT_DoubleDelete; - mutable std::unique_ptr BT_Leak[CK_NumCheckKinds]; -

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
@@ -2812,20 +2782,11 @@ void MallocChecker::HandleFunctionPtrFree(CheckerContext &C, SVal ArgVal, SourceRange Range, const Expr *FreeExpr, AllocationFa

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
@@ -3028,24 +2986,10 @@ void MallocChecker::HandleLeak(SymbolRef Sym, ExplodedNode *N, if (Family.Kind == AF_Alloca) return; - std::optional CheckKind = - getCheckIfTracked(Family, true); - - if (!CheckKind) + const Leak *Frontend = getRelevantFrontendAs(Family)

[clang] [analyzer] Avoid unnecessary super region invalidation in `CStringChecker` (PR #146212)

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

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
@@ -402,16 +449,19 @@ class MallocChecker const char *NL, const char *Sep) const override; private: - mutable std::unique_ptr BT_DoubleFree[CK_NumCheckKinds]; - mutable std::unique_ptr BT_DoubleDelete; - mutable std::unique_ptr BT_Leak[CK_NumCheckKinds]; -

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
@@ -3150,7 +3094,7 @@ void MallocChecker::checkPreCall(const CallEvent &Call, if (const auto *DC = dyn_cast(&Call)) { const CXXDeleteExpr *DE = DC->getOriginExpr(); -if (!ChecksEnabled[CK_NewDeleteChecker]) +if (!NewDeleteChecker.isEnabled()) Nag

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
@@ -3187,7 +3131,7 @@ void MallocChecker::checkPreCall(const CallEvent &Call, if (!FD) return; -if (ChecksEnabled[CK_MallocChecker] && isFreeingCall(Call)) +if (MallocChecker.isEnabled() && isFreeingCall(Call)) NagyDonat wrote: `MallocChecke

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
@@ -3902,16 +3846,15 @@ void MallocChecker::printState(raw_ostream &Out, ProgramStateRef State, for (auto [Sym, Data] : RS) { const RefState *RefS = State->get(Sym); AllocationFamily Family = RefS->getAllocationFamily(); - std::optional CheckKind = -

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
NagyDonat wrote: @gamesh411 I applied all the changes that we discussed in the interactive review. Please accept the PR formally (or add any suggestions that you realized since then). I'll probably merge this PR on 9th of July if there is no other feedback. https://github.com/llvm/llvm-projec

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
@@ -327,39 +327,7 @@ void testArrayDestr() { clang_analyzer_warnIfReached(); // no-warning } -// Invalidate Region even in case of default destructor -class InvalidateDestTest { -public: - int x; - int *y; - ~InvalidateDestTest(); -}; - -int test_member_invalidation() { -

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147080 From c0e669a4f31702a871fce4c8c3805b322c331afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 2 Jul 2025 15:09:42 +0200 Subject: [PATCH 1/6] [analyzer] Connversion to CheckerFamily: Mal

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
@@ -402,16 +449,19 @@ class MallocChecker const char *NL, const char *Sep) const override; private: - mutable std::unique_ptr BT_DoubleFree[CK_NumCheckKinds]; - mutable std::unique_ptr BT_DoubleDelete; - mutable std::unique_ptr BT_Leak[CK_NumCheckKinds]; -

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147080 From c0e669a4f31702a871fce4c8c3805b322c331afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 2 Jul 2025 15:09:42 +0200 Subject: [PATCH 1/2] [analyzer] Connversion to CheckerFamily: Mal

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-07 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147080 From c0e669a4f31702a871fce4c8c3805b322c331afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 2 Jul 2025 15:09:42 +0200 Subject: [PATCH 1/3] [analyzer] Connversion to CheckerFamily: Mal

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

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

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

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

[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

2025-07-08 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147080 From c0e669a4f31702a871fce4c8c3805b322c331afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 2 Jul 2025 15:09:42 +0200 Subject: [PATCH 1/7] [analyzer] Connversion to CheckerFamily: Mal

[clang] [analyzer][NFC] Remove irrelevant overcomplicated test (PR #147536)

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

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

2025-07-09 Thread Donát Nagy via cfe-commits
@@ -412,7 +412,7 @@ class DerefClass{ void testDoubleDeleteClassInstance() { DerefClass *foo = new DerefClass(); delete foo; - delete foo; // newdelete-warning {{Attempt to delete released memory}} + delete foo; // newdelete-warning {{Attempt to free released memory}} ---

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

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

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

2025-07-09 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147542 From 21d04521ec866b1d7850e2d7b758ceaa891359da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 8 Jul 2025 16:44:04 +0200 Subject: [PATCH 1/4] [analyzer] Remove redundant bug type DoubleD

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

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

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

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

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

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

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

2025-07-09 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147542 From 21d04521ec866b1d7850e2d7b758ceaa891359da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 8 Jul 2025 16:44:04 +0200 Subject: [PATCH 1/3] [analyzer] Remove redundant bug type DoubleD

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

2025-07-09 Thread Donát Nagy via cfe-commits
@@ -3324,7 +3298,7 @@ void MallocChecker::checkUseZeroAllocated(SymbolRef Sym, CheckerContext &C, bool MallocChecker::checkDoubleDelete(SymbolRef Sym, CheckerContext &C) const { if (isReleased(Sym, C)) { -HandleDoubleDelete(C, Sym); +HandleDoubleFree(C, SourceRange(

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

2025-07-09 Thread Donát Nagy via cfe-commits
@@ -412,7 +412,7 @@ class DerefClass{ void testDoubleDeleteClassInstance() { DerefClass *foo = new DerefClass(); delete foo; - delete foo; // newdelete-warning {{Attempt to delete released memory}} + delete foo; // newdelete-warning {{Attempt to free released memory}} ---

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

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

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

2025-07-09 Thread Donát Nagy via cfe-commits
@@ -412,7 +412,7 @@ class DerefClass{ void testDoubleDeleteClassInstance() { DerefClass *foo = new DerefClass(); delete foo; - delete foo; // newdelete-warning {{Attempt to delete released memory}} + delete foo; // newdelete-warning {{Attempt to free released memory}} ---

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

2025-07-09 Thread Donát Nagy via cfe-commits
NagyDonat wrote: The Windows CI failure is irrelevant: > llvm-lit.py: > C:\_work\llvm-project\llvm-project\llvm\utils\lit\lit\llvm\config.py:280: > fatal: Could not run process > ['c:\\_work\\llvm-project\\llvm-project\\build\\bin\\clang.exe', > '-print-file-name=include'] [6110/6127] Lin

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

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

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

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

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

2025-07-08 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147542 From 21d04521ec866b1d7850e2d7b758ceaa891359da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 8 Jul 2025 16:44:04 +0200 Subject: [PATCH 1/2] [analyzer] Remove redundant bug type DoubleD

[clang] [analyzer] Remove redundant bug type DoubleDelete (PR #147542)

2025-07-08 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/147542 This commit removes the DoubleDelete bug type from `MallocChecker.cpp` because it's completely redundant with the `DoubleFree` bug (which is already used for all allocator families, including new/delete). Th

[clang] [analyzer][NFC] Remove irrelevant overcomplicated test (PR #147536)

2025-07-08 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/147536 This commit removes the test file test-member-invalidation.cpp which was recently introduced in 39bc0529b018a89b4b6a21aaabe240cd3a65c44d by splitting off a test case from new.cpp. In that commit I preserved

[clang] [analyzer] Prettify checker registration and unittest code (PR #147797)

2025-07-10 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147797 From fc638a1d7d56becbe7e8350b46b75ade51718f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 20 May 2025 15:51:48 +0200 Subject: [PATCH 1/6] [analyzer] Prettify checker registration an

[clang] [analyzer] Prettify checker registration and unittest code (PR #147797)

2025-07-10 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147797 From fc638a1d7d56becbe7e8350b46b75ade51718f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 20 May 2025 15:51:48 +0200 Subject: [PATCH 1/7] [analyzer] Prettify checker registration an

[clang] [analyzer] Prettify checker registration and unittest code (PR #147797)

2025-07-09 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147797 From fc638a1d7d56becbe7e8350b46b75ade51718f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 20 May 2025 15:51:48 +0200 Subject: [PATCH 1/2] [analyzer] Prettify checker registration an

[clang] [analyzer] Prettify checker registration and unittest code (PR #147797)

2025-07-09 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/147797 From fc638a1d7d56becbe7e8350b46b75ade51718f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 20 May 2025 15:51:48 +0200 Subject: [PATCH 1/3] [analyzer] Prettify checker registration an

[clang] [clang][analyzer] Add C standard streams to the internal memory space (PR #147766)

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

[clang] [clang][analyzer] Add C standard streams to the internal memory space (PR #147766)

2025-07-09 Thread Donát Nagy via cfe-commits
@@ -1054,10 +1054,24 @@ const VarRegion *MemRegionManager::getVarRegion(const VarDecl *D, assert(!Ty.isNull()); if (Ty.isConstQualified()) { sReg = getGlobalsRegion(MemRegion::GlobalImmutableSpaceRegionKind); -} else if (Ctx.getSourceManager().isInSystemHeade

<    10   11   12   13   14   15   16   >