[clang] [NFC][analyzer][docs] Restore/remove orphaned images (PR #122481)

2025-01-10 Thread Donát Nagy via cfe-commits
NagyDonat wrote: The first two commits in this PR are separately reviewed at https://github.com/llvm/llvm-project/pull/122246 and I intend to merge them (squashed into a single commit) through that PR. **In this PR please only review the third commit [[NFC][analyzer][docs] Restore/remove orph

[clang] [clang][analyzer][doc] Migrate ClangSA www FAQ section (PR #112831)

2025-01-10 Thread Donát Nagy via cfe-commits
@@ -0,0 +1,208 @@ +FAQ and How to Deal with Common False Positives +=== + +.. contents:: + :local: + +Custom Assertions +- + +Q: How do I tell the analyzer that I do not want the bug being reported here since my custom

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

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

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

2025-01-17 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > The only spot I thought was questionable to change is this lower bound check > in `ArrayBoundCheckerV2`; I think it is fine to leave unchanged for now, > thoughts? > > https://github.com/llvm/llvm-project/blob/7e0758d2ead53bd4288989b8b2eda218cd6dc34a/clang/lib/StaticAnalyzer

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

2025-01-17 Thread Donát Nagy via cfe-commits
NagyDonat wrote: @Xazax-hun When you write that this commit "makes memspaces a bit more error prone to use. Do you think we could find a way to prevent using isa on memspaces?" do I understand it correctly you mean that it's error-prone to use `isa<...>(MR->getMemorySpace())` directly? This e

[clang] [NFC] [analyzer] Factor out SymbolManager::get<*> (PR #121781)

2025-01-08 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/121781 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][analyzer][docs] Migrate 'annotations.html' to RST (PR #122246)

2025-01-09 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/122246 This commit migrates the contents of 'annotations.html' in the old HTML-based documentation of the Clang static analyzer to the new RST-based documentation. During this conversion I reordered the sections of

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

2025-01-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/119388 From cb9b5ef4d8b0ed8e67276947525d327c547424fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Thu, 28 Nov 2024 17:22:58 +0100 Subject: [PATCH 1/9] [analyzer] Don't assume third iteration in

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

2025-01-02 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > My bad. I thought I already approved this one. No problem, I didn't intend to merge this during the Christmas period (when I was on vacation and didn't want to monitor the effects of the change). > Please mention this in the release notes. I added a paragraph to the release

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

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

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

2025-01-02 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/119388 From cb9b5ef4d8b0ed8e67276947525d327c547424fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Thu, 28 Nov 2024 17:22:58 +0100 Subject: [PATCH 1/8] [analyzer] Don't assume third iteration in

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

2025-01-02 Thread Donát Nagy via cfe-commits
NagyDonat wrote: If I understand correctly, I handled every review suggestion. @steakhal If there are no additional suggestions, I'd be grateful for an approval. (My follow-up commit is mostly ready, I'll release it soon after merging this.) https://github.com/llvm/llvm-project/pull/119388 __

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

2025-01-02 Thread Donát Nagy via cfe-commits
NagyDonat wrote: The LLVM Buildbot failure is clearly unrelated to this commit -- it seems to be a straightforward flakiness on a completely unrelated part of the project. https://github.com/llvm/llvm-project/pull/119388 ___ cfe-commits mailing list c

[clang] [analyzer] Add hack in ArrayBound to cover up missing casts (PR #127117)

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

[clang] [analyzer] Add hack in ArrayBound to cover up missing casts (PR #127117)

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

[clang] [analyzer] Update the undefined assignment checker diagnostics to not use the term 'garbage' (PR #126596)

2025-02-14 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > So I'm still mildly in favor of simply saying "uninitialized". It may or may > not be someone else's actively used memory but that's beyond the programmer's > control and they know it (hopefully). It would be somewhat dishonest to give > the user an impression that this chec

[clang] [analyzer] Add hack in ArrayBound to cover up missing casts (PR #127117)

2025-02-14 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/127117 From d806869ad5f7465cb771c3d918de4add46854571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Thu, 13 Feb 2025 20:31:55 +0100 Subject: [PATCH 1/2] [analyzer] Add hack in ArrayBound to cover

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

2025-02-13 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/127062 From c3dc63db8914d759b6c58611b7448d4e83c66752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Thu, 13 Feb 2025 11:35:45 +0100 Subject: [PATCH 1/2] [analyzer][NFC] Add ArrayBound tests to doc

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

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

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

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

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

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

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

2025-02-13 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/127062 From c3dc63db8914d759b6c58611b7448d4e83c66752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Thu, 13 Feb 2025 11:35:45 +0100 Subject: [PATCH 1/2] [analyzer][NFC] Add ArrayBound tests to doc

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

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

[clang] [analyzer] Add hack in ArrayBound to cover up missing casts (PR #127117)

2025-02-13 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/127117 Currently there are many casts that are not modeled (i.e. ignored) by the analyzer, which can cause paradox states (e.g. negative value stored in `unsigned` variable) and false positive reports from various c

[clang] [analyzer] Add hack in ArrayBound to cover up missing casts (PR #127117)

2025-02-13 Thread Donát Nagy via cfe-commits
@@ -188,29 +189,50 @@ int test_cast_to_unsigned(signed char x) { if (x >= 0) return x; // FIXME: Here the analyzer ignores the signed -> unsigned cast, and manages to - // load a negative value from an unsigned variable. This causes an underflow - // report, which is

[clang] [analyzer] Add hack in ArrayBound to cover up missing casts (PR #127117)

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

[clang] [analyzer][NFC] Trivial cleanup in ArrayBoundChecker (PR #126941)

2025-02-12 Thread Donát Nagy via cfe-commits
@@ -394,14 +394,13 @@ static bool tryDividePair(std::optional &Val1, return false; const bool Val1HasRemainder = Val1 && *Val1 % Divisor; const bool Val2HasRemainder = Val2 && *Val2 % Divisor; - if (!Val1HasRemainder && !Val2HasRemainder) { -if (Val1) - *Val1

[clang] [analyzer][NFC] Trivial cleanup in ArrayBoundChecker (PR #126941)

2025-02-12 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/126941 Two small stylistic improvements in code that I wrote ~a year ago: 1. fix a typo in a comment; and 2. simplify the code of `tryDividePair` by swapping the true and the false branches. From a0b6f3aff5e639d4388

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

2025-02-17 Thread Donát Nagy via cfe-commits
@@ -211,17 +211,15 @@ def DereferenceModeling : Checker<"DereferenceModeling">, Documentation, Hidden; -def NullDereferenceChecker : Checker<"NullDereference">, - HelpText<"Check for dereferences of null pointers">, - CheckerOptions<[ -CmdLineOption - ]>, - Documen

[clang] [analyzer][NFC] Trivial cleanup in ArrayBoundChecker (PR #126941)

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

[clang] [clang][analysis] Fix flaky clang/test/Analysis/live-stmts.cpp test (2nd attempt) (PR #127406)

2025-02-17 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. Let's hope that this fixes the issue. https://github.com/llvm/llvm-project/pull/127406 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [analyzer] Delay the checker constructions after parsing (PR #127409)

2025-02-17 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. I'm happy to see this opportunity to improve the code quality :slightly_smiling_face: I'm not familiar with the initialization procedure of the analyzer, but this change should affect every analysis run equally, so if you managed to run

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

2025-02-21 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat requested changes to this pull request. Overall I like the change, but I feel that the analyzer option name `suppress-all-address-spaces` is too misleading (see inline comment for more detailed suggestion). https://github.com/llvm/llvm-project/pull/127191 _

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

2025-02-21 Thread Donát Nagy via cfe-commits
@@ -0,0 +1,77 @@ +// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -analyzer-checker=core,alpha.core -std=gnu99 -analyzer-config suppress-all-address-spaces=false -verify=x86-nosuppress %s +// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -analyzer-checker=core,alph

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-21 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I tried to write down my rough ideas as a concrete commit, but I don't have enough mental acuity for it today. I'll try to make another attempt on Monday -- but if you wish to close this commit, then it's also OK if I do this refactoring in a separate follow-up commit. https:

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

2025-02-21 Thread Donát Nagy via cfe-commits
@@ -170,6 +157,16 @@ disable this behavior with the option obj->x = 1; // warn } +Null pointer dereferences of pointers with address spaces are not always defined +as error. Specifically on x86/x86-64 target if the pointer address space is +256 (x86 GS Segment), 257 (x86

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

2025-02-21 Thread Donát Nagy via cfe-commits
@@ -395,6 +395,19 @@ ANALYZER_OPTION( "flex\" won't be analyzed.", true) +ANALYZER_OPTION( +bool, ShouldSuppressAddressSpaces, "suppress-all-address-spaces", NagyDonat wrote: The name of this analyzer option is misleading: the natural guess is tha

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

2025-02-21 Thread Donát Nagy via cfe-commits
@@ -2919,6 +2916,39 @@ Check for assignment of a fixed address to a pointer. p = (int *) 0x1; // warn } +.. _alpha-core-FixedAddressDereference: + +alpha.core.FixedAddressDereference (C, C++, ObjC) +" +Check for dereferen

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

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

[clang] [CodeGen][NFC] Move test builtin_signbit.cpp to CodeGen (PR #127814)

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

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-24 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. Anyway, let's just merge this as it is now. The code is basically OK, I still don't have the brainpower to hold all the details in my mind and if I'll catch some divine inspiration in the future, I can still refactor this as a follow-up

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

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

[clang] [Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX (PR #128013)

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

[clang] [Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX (PR #128013)

2025-02-24 Thread Donát Nagy via cfe-commits
NagyDonat wrote: I'm merging this now because I feel that the current reviews are sufficient for this simple NFC change. If there are any further observations/suggestions, feel free to mention them -- I can address them in a follow-up commit. https://github.com/llvm/llvm-project/pull/128013 _

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/128508 Before commit 6e17ed9 the test files `outofbound.c` and `outofbound-notwork.c` tested the behavior of the old alpha checker `alpha.security.ArrayBound` (V1); then that commit converted them into tests for the

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: I annotated `outofbound.c` with inline comments to describe why I removed most of the testcases within it. https://github.com/llvm/llvm-project/pull/128508 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

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

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

2025-02-24 Thread Donát Nagy via cfe-commits
@@ -1,130 +0,0 @@ -// RUN: %clang_analyze_cc1 -Wno-array-bounds -verify %s \ -// RUN: -analyzer-checker=core \ -// RUN: -analyzer-checker=unix \ -// RUN: -analyzer-checker=security.ArrayBound \ -// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true - -typedef

[clang] [NFC][analyzer] OOB test consolidation III: 'outofbound' tests (PR #128508)

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

[clang] [analyzer] Update the undefined assignment checker diagnostics to not use the term 'garbage' (PR #126596)

2025-02-24 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, I agree that "uninitialized" is a better phrasing -- it's shorter and explicitly names the "normal" reason for getting `UndefinedVal`s. > I think the right path is to issue a more precise error message for > out-of-bounds reads. As

[clang] [Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX (PR #128013)

2025-02-20 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > I wonder if we should rename the directory to something like > `clang/test/StaticAnalyzer` to avoid confusion in the future. I also considered renaming the directory to `clang/test/StaticAnalyzer` and I would definitely support this idea if it doesn't cause too many difficul

[clang] [Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX (PR #128013)

2025-02-20 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/128013 Because they are the last two remaining test files that appeared under `clang/test/Analysis` but were unrelated to the clang static analyzer. For background see the following discourse thread: https://discou

[clang] [CodeGen][NFC] Move test builtin_signbit.cpp to CodeGen (PR #127814)

2025-02-20 Thread Donát Nagy via cfe-commits
NagyDonat wrote: The CI failure is in a completely unrelated test file; I'm pretty confident that it's unrelated to my commit. https://github.com/llvm/llvm-project/pull/127814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [NFC][analyzer] Simplify ownership of checker objects (PR #128887)

2025-02-26 Thread Donát Nagy via cfe-commits
@@ -185,13 +185,11 @@ class CheckerManager { StringRef OptionName, StringRef ExpectedValueDesc) const; - using CheckerRef = CheckerBase *; using CheckerTag = const void *; - using CheckerDtor =

[clang] [NFC][analyzer] Simplify ownership of checker objects (PR #128887)

2025-02-26 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/128887 Previously checker objects were created by raw `new` calls, which necessitated managing and calling their destructors explicitly. This commit refactors this convoluted logic by introducing `unique_ptr`s that

[clang] [analyzer] Update the undefined assignment checker diagnostics to not use the term 'garbage' (PR #126596)

2025-02-26 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > Do you want me to condense the change to a single commit as recommended > [here](https://llvm.org/docs/GitHub.html#landing-your-change)? Alternately, I > could post a draft commit message in a comment for use with GitHub's UI for a > squash-merge. Please put a draft commit

[clang] [analyzer] Update the undefined assignment checker diagnostics to not use the term 'garbage' (PR #126596)

2025-02-26 Thread Donát Nagy via cfe-commits
NagyDonat wrote: Thanks for the update, I'm merging the commit. By the way, Github also has built-in support for viewing the before-the-edit version of the PR description: ![image](https://github.com/user-attachments/assets/58213a41-ce76-4e1a-a850-7d4225cdd3e3) https://github.com/llvm/llvm-pr

[clang] [analyzer] Update the undefined assignment checker diagnostics to not use the term 'garbage' (PR #126596)

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

[clang] [NFC][analyzer] Simplify ownership of checker objects (PR #128887)

2025-02-27 Thread Donát Nagy via cfe-commits
@@ -185,13 +185,11 @@ class CheckerManager { StringRef OptionName, StringRef ExpectedValueDesc) const; - using CheckerRef = CheckerBase *; using CheckerTag = const void *; - using CheckerDtor =

[clang] [NFC][analyzer] Simplify ownership of checker objects (PR #128887)

2025-02-27 Thread Donát Nagy via cfe-commits
@@ -201,24 +199,24 @@ class CheckerManager { template CHECKER *registerChecker(AT &&... Args) { CheckerTag tag = getTag(); -CheckerRef &ref = CheckerTags[tag]; -assert(!ref && "Checker already registered, use getChecker!"); - -CHECKER *checker = new CHECKER

[clang] [NFC][analyzer] Simplify ownership of checker objects (PR #128887)

2025-02-27 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/128887 From 76f8417b8b46e7d036d98fa92890469654158e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 26 Feb 2025 15:41:46 +0100 Subject: [PATCH 1/5] [NFC][analyzer] Simplify ownership of check

[clang] [NFC][analyzer] Simplify ownership of checker objects (PR #128887)

2025-02-27 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/128887 From 76f8417b8b46e7d036d98fa92890469654158e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 26 Feb 2025 15:41:46 +0100 Subject: [PATCH 1/4] [NFC][analyzer] Simplify ownership of check

[clang] [NFC][analyzer] Simplify ownership of checker objects (PR #128887)

2025-02-27 Thread Donát Nagy via cfe-commits
@@ -41,8 +42,8 @@ CheckerManager::CheckerManager(AnalyzerOptions &AOptions, } CheckerManager::~CheckerManager() { NagyDonat wrote: Good suggestion, I didn't know that `= default` works with out-of-line declarations. https://github.com/llvm/llvm-project/pull

[clang] [NFC][analyzer] Simplify ownership of checker objects (PR #128887)

2025-02-27 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/128887 From 76f8417b8b46e7d036d98fa92890469654158e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 26 Feb 2025 15:41:46 +0100 Subject: [PATCH 1/6] [NFC][analyzer] Simplify ownership of check

[clang] [analyzer] Add hack in ArrayBound to cover up missing casts (PR #127117)

2025-02-17 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > That being said, I wonder if we should record the presence of casts when we > produce `ElementRegion`s to better help checks suppress potentially false > results. This would just make some workarounds easier to write rather than > having full modelling. After stabilizing th

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

2025-02-17 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. LGTM, thanks for the improvements :) In the follow-up commits let's pay attention to the `ArrayBound` lower bound check where the code says that _"A symbolic region in unknown space represents an unknown pointer that may point into the m

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-19 Thread Donát Nagy via cfe-commits
NagyDonat wrote: As I thought a bit more about the reorganization that I suggested, I realized that it can be summarized as **we should synchronize adding the default `Unknown` binding and calling `escapeValue`** -- because they correspond to the two end-points of the same "_this_ value is sto

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

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

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-18 Thread Donát Nagy via cfe-commits
@@ -483,6 +483,14 @@ ANALYZER_OPTION( "behavior, set the option to 0.", 5) +ANALYZER_OPTION( +unsigned, RegionStoreMaxBindingFanOut, "region-store-max-binding-fanout", +"This option limits how many sub-bindings a single binding operation can " +"scatter int

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-18 Thread Donát Nagy via cfe-commits
@@ -2782,6 +2865,8 @@ RegionBindingsRef RegionStoreManager::bindStruct(RegionBindingsConstRef B, if (VI == VE) break; + if (NewB.hasExhaustedBindingLimit()) +return NewB.escapeValues(VI, VE); NagyDonat wrote: This is confusing to r

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-18 Thread Donát Nagy via cfe-commits
@@ -176,31 +177,59 @@ class RegionBindingsRef : public llvm::ImmutableMapRefpush_back(V); +return *this; + } + RegionBindingsRef escapeValues(nonloc::CompoundVal::iterator Begin, + nonloc::CompoundVal::iterator End) const { +for (SVal V :

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

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

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-18 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: I'm really happy that you managed to track down and fix these slow corner cases, and overall I like the code changes, but I there were a few places where the code was difficult to understand for me (although this may be also related to the fact that I di

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

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

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-18 Thread Donát Nagy via cfe-commits
NagyDonat wrote: (I'm writing a review right now, please wait a bit -- a few hours -- before merging.) https://github.com/llvm/llvm-project/pull/127602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [analyzer] Add hack in ArrayBound to cover up missing casts (PR #127117)

2025-02-18 Thread Donát Nagy via cfe-commits
NagyDonat wrote: > An interesting thing could be to track in the analyzer the number of > suppressed underflows (i.e.: the number of times we resorted to hacking with > this solution). That way, we could have more information about how far we > deviate from the precise modelling. This could pr

[clang] [analyzer] Add hack in ArrayBound to cover up missing casts (PR #127117)

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

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-19 Thread Donát Nagy via cfe-commits
@@ -176,31 +177,59 @@ class RegionBindingsRef : public llvm::ImmutableMapRefpush_back(V); +return *this; + } + RegionBindingsRef escapeValues(nonloc::CompoundVal::iterator Begin, + nonloc::CompoundVal::iterator End) const { +for (SVal V :

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

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

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-19 Thread Donát Nagy via cfe-commits
@@ -359,7 +326,80 @@ class RegionBindingsRef : public llvm::ImmutableMapRef` Perhaps use `Limited` instead of `Bounded` in the name of this class, because the common linguistical origin of the words "Bounded" and "Binding" makes the current name a bit hard to parse. (I almost r

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-19 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: > I'm sorry if the poor code quality hindered the comprehension. I wouldn't say "poor code quality" -- the code was difficult to understand, but mostly due to the inherent complexity of the logic that's being implemented here. > In short, I decided to p

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

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

[clang] [CodeGen][NFC] Move test builtin_signbit.cpp to CodeGen (PR #127814)

2025-02-19 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/127814 Because it is one of the three "misplaced" test files that appeared under `/clang/test/Analysis` but were unrelated to the clang static analyzer. For background see the following discourse thread: https://di

[clang] [NFC][analyzer] Simplify ownership of checker objects (PR #128887)

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

[clang] [NFC][analyzer] OOB test consolidation IV: rename files (PR #129697)

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

[clang] [NFC][analyzer] Split [[assume]] tests to a separate file (PR #130763)

2025-03-11 Thread Donát Nagy via cfe-commits
NagyDonat wrote: No problem, in git we can eventually track down and resolve everything. However, let's try to pay attention to putting logically separate tests into separate files -- our tests are badly disorganized, but we can gradually improve the average quality if we spend some attention

[clang] [NFC][analyzer] Remove CheckerNameRef::getName() (PR #130780)

2025-03-11 Thread Donát Nagy via cfe-commits
NagyDonat wrote: :thinking: Instead of this change I could also imagine introducing an accurately named explicit method – e.g. `StringRef toStringRef()` – and using that for all `CheckerNameRef` → `StringRef` conversions (including the half dozen cases where the codebase already uses `operator

[clang] [NFC][analyzer] Remove CheckerNameRef::getName() (PR #130780)

2025-03-11 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/130780 `CheckerNameRef` is a trivial wrapper around a `StringRef` which is guaranteed to be owned by the `CheckerRegistry` (the only `friend` of the class) because other code can't call the private constructor. Thi

[clang] [NFC][analyzer] OOB test consolidation IV: rename files (PR #129697)

2025-03-11 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/129697 From 3a3236237e193fb1d1de1aed72e128195d4d0730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 4 Mar 2025 11:44:18 +0100 Subject: [PATCH 1/3] [NFC][analyzer] OOB test consolidation IV: r

<    5   6   7   8   9   10   11   12   >