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

2025-07-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: Overall I like this change, but I added a few suggestions in inline comments. Also please follow the [Coding Standard](https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly) and use `UpperCamelCase` variables

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

2025-07-02 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-02 Thread Donát Nagy via cfe-commits
@@ -2223,16 +2223,81 @@ 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] [analyzer] Avoid unnecessary super region invalidation in `CStringChecker` (PR #146212)

2025-07-02 Thread Donát Nagy via cfe-commits
@@ -2223,16 +2223,81 @@ 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] [llvm] [analyzer] Correct Z3 test cases, fix exposed crashes (PR #146597)

2025-07-02 Thread Donát Nagy via cfe-commits
@@ -598,6 +598,9 @@ class SMTConv { if (APSIntBitwidth == 1 && Ty.isNull()) return {Int.extend(Ctx.getTypeSize(Ctx.BoolTy)), getAPSIntType(Ctx, NewInt)}; +else if (APSIntBitwidth == 1 && !Ty.isNull()) + return {Int.extend(Ctx.getTypeSize(getAPSI

[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 edited https://github.com/llvm/llvm-project/pull/146597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[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] [llvm] [analyzer] Correct Z3 test cases, fix exposed crashes (PR #146597)

2025-07-02 Thread Donát Nagy via cfe-commits
@@ -598,6 +598,9 @@ class SMTConv { if (APSIntBitwidth == 1 && Ty.isNull()) return {Int.extend(Ctx.getTypeSize(Ctx.BoolTy)), getAPSIntType(Ctx, NewInt)}; +else if (APSIntBitwidth == 1 && !Ty.isNull()) + return {Int.extend(Ctx.getTypeSize(getAPSI

[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 edited https://github.com/llvm/llvm-project/pull/146597 ___ 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: > 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] [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] [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: > > [...] 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 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] [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] [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 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] [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] [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] [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] [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: > 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] [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
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] [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
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 enforcing thi

[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] [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] [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] [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] [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] [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] [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] [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] [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] [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] 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] [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 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] [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] [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 closed 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 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 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] [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] [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] [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-25 Thread Donát Nagy via cfe-commits
@@ -123,26 +123,10 @@ S getS(); S *getSP(); void testReferenceAddress(int &x) { -// FIXME: Move non-zero reference assumption out of RangeConstraintManager.cpp:422 NagyDonat wrote: This FIXME asks for ensuring that some logic is applied in all constraint ma

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

2025-06-25 Thread Donát Nagy via cfe-commits
@@ -123,26 +123,10 @@ S getS(); S *getSP(); void testReferenceAddress(int &x) { -// FIXME: Move non-zero reference assumption out of RangeConstraintManager.cpp:422 -#ifdef ANALYZER_CM_Z3 - clang_analyzer_eval(&x != 0); // expected-warning{{UNKNOWN}} - clang_analyzer_eval(&r

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

2025-06-25 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM if there are no surprising performance regressions. https://github.com/llvm/llvm-project/pull/144327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

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

2025-06-25 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] [clang][analyzer] fix crash when modelling 'getline' function in checkers (PR #145229)

2025-06-25 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, but wait a bit for @steakhal. https://github.com/llvm/llvm-project/pull/145229 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

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

2025-06-25 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/145731 Before this commit the LIT test framework of the static analyzer had a file called `analyzer_test.py` which implemented a tricky system for selecting the constraint manager: - (A) Test files without `REQUIRES

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

2025-06-25 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/3] [NFC][analyzer] Remove Z3-as-constraint-man

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

2025-06-25 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-25 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > > For background information see also some of the later comments on the > > discourse thread > > https://discourse.llvm.org/t/taking-ownership-of-clang-test-analysis/84689/6 > > Move this link into the PR summary please. Done. (Originally I didn't put this into the PR summa

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

2025-06-25 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-25 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-25 Thread Donát Nagy via cfe-commits
NagyDonat wrote: For background information see also some of the later comments on the discourse thread https://discourse.llvm.org/t/taking-ownership-of-clang-test-analysis/84689/6 https://github.com/llvm/llvm-project/pull/145731 ___ cfe-commits mail

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

2025-06-25 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/2] [NFC][analyzer] Remove Z3-as-constraint-man

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

2025-06-24 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited 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-24 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: Thanks @haoNoQ for this great idea and @balazs-benics-sonarsource for the quick implementation! I'm completely satisfied with the current direction of development on this PR -- using this fresh symbol type instead of `Unknown`s and `nullopt`s and early

[clang] [analyzer][NFC] Make SymExpr::classof methods constexpr (PR #145526)

2025-06-24 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. https://github.com/llvm/llvm-project/pull/145526 ___ 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-24 Thread Donát Nagy via cfe-commits
NagyDonat wrote: The usual regression test is completely sufficient. 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-24 Thread Donát Nagy via cfe-commits
@@ -671,17 +779,33 @@ class SymbolVisitor { virtual bool VisitMemRegion(const MemRegion *) { return true; } }; +// Returns a pointer to T if T is a SymbolData, otherwise SymExpr. NagyDonat wrote: Thanks! https://github.com/llvm/llvm-project/pull/144327 ___

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

2025-06-24 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: Thanks for your patience in this review! I'm happy to see the additional simplifications coming from just wrapping the over-complicated symbol instead of storing its parts separately. (I see that it's a bit inelegant to construct the very thing that we'r

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

2025-06-24 Thread Donát Nagy via cfe-commits
@@ -51,18 +51,18 @@ class SymExpr : public llvm::FoldingSetNode { /// Note, however, that it can't be used in Profile because SymbolManager /// needs to compute Profile before allocating SymExpr. const SymbolID Sym; + const unsigned Complexity; protected: - SymExpr(K

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

2025-06-24 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited 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-24 Thread Donát Nagy via cfe-commits
@@ -671,17 +779,33 @@ class SymbolVisitor { virtual bool VisitMemRegion(const MemRegion *) { return true; } }; +// Returns a pointer to T if T is a SymbolData, otherwise SymExpr. NagyDonat wrote: Please place a copy of this (very helpful!) comment at the de

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

2025-06-24 Thread Donát Nagy via cfe-commits
@@ -46,7 +50,7 @@ class SymbolRegionValue : public SymbolData { friend class SymExprAllocator; SymbolRegionValue(SymbolID sym, const TypedValueRegion *r) - : SymbolData(SymbolRegionValueKind, sym), R(r) { + : SymbolData(ClassKind, sym), R(r) { Na

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

2025-06-24 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited 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-24 Thread Donát Nagy via cfe-commits
@@ -46,7 +50,7 @@ class SymbolRegionValue : public SymbolData { friend class SymExprAllocator; SymbolRegionValue(SymbolID sym, const TypedValueRegion *r) - : SymbolData(SymbolRegionValueKind, sym), R(r) { + : SymbolData(ClassKind, sym), R(r) { Na

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

2025-06-23 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > I was thinking about possible ways to unblock this change. > > If the additional code complexity needs justification, by measuring the > average impact (to ensure no regression happens in the common cases), and by > repeating the measurement of the handful of edge-cases wher

[clang] [clang][analyzer] fix crash when modelling 'getline' function in checkers (PR #145229)

2025-06-23 Thread Donát Nagy via cfe-commits
NagyDonat wrote: Personally I feel that option 2 ("add more error handling to avoid crashes in `checkGetdelim`") would be more "natural" for the static analyzer, because checking the exact types of the parameters is rare in the analyzer (I don't know any significant example apart from `StdLibr

[clang] [analyzer] Conversion to CheckerFamily: DynamicTypePropagation (PR #144735)

2025-06-18 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/144735 This commit converts the class DynamicTypePropagation to a very simple checker family, which has only one checker frontend -- but also supports enabling the backend ("modeling checker") without the frontend.

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

2025-06-17 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > > > How I read this you have mainly 2 concerns: > > > > > > 1. The use of this strong-type makes it tedious the existing APIs to use > > > because one needs to unwrap the value and frequently make an early-return > > > to explicitly handle the case when a symbol-creation fai

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

2025-06-16 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > How I read this you have mainly 2 concerns: > > 1. The use of this strong-type makes it tedious the existing APIs to use > because one needs to unwrap the value and frequently make an early-return to > explicitly handle the case when a symbol-creation failed? Yes, this

[clang] [analyzer] Conversion to CheckerFamily: NullabilityChecker (PR #143735)

2025-06-16 Thread Donát Nagy via cfe-commits
NagyDonat wrote: @steakhal Thanks for spotting these broken lines – these blocks were automatically reformatted by `git-clang-format` and I didn't notice that it misformats this kind of content. https://github.com/llvm/llvm-project/pull/143735 ___ cf

[clang] [analyzer] Conversion to CheckerFamily: NullabilityChecker (PR #143735)

2025-06-16 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/143735 From 2f0abfe5e306072fc56ca93a570c58f2b9a2c967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 11 Jun 2025 17:31:43 +0200 Subject: [PATCH 1/2] [analyzer] Conversion to CheckerFamily: Nu

[clang] [analyzer] Fix a false memory leak reports involving placement new (PR #144341)

2025-06-16 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, nice little patch :smile: https://github.com/llvm/llvm-project/pull/144341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

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

2025-06-16 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited 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-16 Thread Donát Nagy via cfe-commits
@@ -317,21 +317,21 @@ class SValBuilder { return nonloc::LocAsInteger(BasicVals.getPersistentSValWithData(loc, bits)); } - nonloc::SymbolVal makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op, - APSIntPtr rhs, QualType type); + Defi

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

2025-06-16 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: Unfortunately I'm not convinced that this is the right direction for improving the analyzer runtime. On the "risks" side I think that adding the corner case that "this may also return `UnknownVal` in rare situations" into many functions complicates the

[clang] [analyzer] Conversion to CheckerFamily: NullabilityChecker (PR #143735)

2025-06-12 Thread Donát Nagy via cfe-commits
@@ -113,25 +114,21 @@ class NullabilityChecker void printState(raw_ostream &Out, ProgramStateRef State, const char *NL, const char *Sep) const override; - enum CheckKind { -CK_NullPassedToNonnull, -CK_NullReturnedFromNonnull, -CK_NullableDerefe

[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)

2025-06-11 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM but wait for the opinion of @steakhal as well. (By the way, after tweaking the testcase, did you check that it would still crash without the improvements of the commit?) https://github.com/llvm/llvm-project/pull/143310 _

[clang] [analyzer] Conversion to CheckerFamily: NullabilityChecker (PR #143735)

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

[clang] [analyzer] Conversion to CheckerFamily: NullabilityChecker (PR #143735)

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

[clang] [NFC][analyzer] Multipart checker refactor 2: NullabilityChecker (PR #132250)

2025-06-11 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I introduced the new "checker family" framework for the multipart checkers, so now this PR is superseded by https://github.com/llvm/llvm-project/pull/143735 which converts NullabilityChecker to _that_ framework. https://github.com/llvm/llvm-project/pull/132250

[clang] [NFC][analyzer] Multipart checker refactor 2: NullabilityChecker (PR #132250)

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

[clang] [analyzer] Conversion to CheckerFamily: NullabilityChecker (PR #143735)

2025-06-11 Thread Donát Nagy via cfe-commits
@@ -710,29 +706,28 @@ void NullabilityChecker::checkPreStmt(const ReturnStmt *S, Nullability RetExprTypeLevelNullability = getNullabilityAnnotation(lookThroughImplicitCasts(RetExpr)->getType()); - bool NullReturnedFromNonNull = (RequiredNullability == Nullability::N

[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)

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

[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)

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

[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)

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

[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)

2025-06-11 Thread Donát Nagy via cfe-commits
@@ -570,23 +572,35 @@ class SMTConv { // TODO: Refactor to put elsewhere static inline QualType getAPSIntType(ASTContext &Ctx, const llvm::APSInt &Int) { -return Ctx.getIntTypeForBitwidth(Int.getBitWidth(), Int.isSigned()); +Qu

[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)

2025-06-11 Thread Donát Nagy via cfe-commits
@@ -570,23 +572,35 @@ class SMTConv { // TODO: Refactor to put elsewhere static inline QualType getAPSIntType(ASTContext &Ctx, const llvm::APSInt &Int) { -return Ctx.getIntTypeForBitwidth(Int.getBitWidth(), Int.isSigned()); +Qu

[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)

2025-06-11 Thread Donát Nagy via cfe-commits
@@ -570,23 +572,35 @@ class SMTConv { // TODO: Refactor to put elsewhere static inline QualType getAPSIntType(ASTContext &Ctx, const llvm::APSInt &Int) { -return Ctx.getIntTypeForBitwidth(Int.getBitWidth(), Int.isSigned()); +Qu

[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)

2025-06-11 Thread Donát Nagy via cfe-commits
@@ -570,23 +572,35 @@ class SMTConv { // TODO: Refactor to put elsewhere static inline QualType getAPSIntType(ASTContext &Ctx, const llvm::APSInt &Int) { -return Ctx.getIntTypeForBitwidth(Int.getBitWidth(), Int.isSigned()); +Qu

[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)

2025-06-11 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: Thanks for the updates! I added a few more style nitpicks, but overall LGTM. https://github.com/llvm/llvm-project/pull/143310 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

  1   2   3   4   5   6   7   8   9   10   >