[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-22 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: > a function that returns a pointer and takes a reference (or a pointer) to a > length variable Yes, this one should be easy to catch. Both values will be `SymbolConjured` pointing to the same function call expression / program point. (The out-parameter value may also be `Symbol

[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-22 Thread Artem Dergachev via cfe-commits
@@ -0,0 +1,199 @@ +//== BoundsInformationChecker.cpp - bounds information checker --*- 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] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-22 Thread Artem Dergachev via cfe-commits
@@ -0,0 +1,199 @@ +//== BoundsInformationChecker.cpp - bounds information checker --*- 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] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-22 Thread David Kilzer via cfe-commits
ddkilzer wrote: Thanks for the feedback! I will work on updates this week (around the WebKit Contributors meeting, which happens to be the same week as the LLVM Developer's Meeting). In the meantime, the checker (using the original PR) has already found some `std::span` anti-patterns in WebK

[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-21 Thread Gábor Horváth via cfe-commits
@@ -0,0 +1,199 @@ +//== BoundsInformationChecker.cpp - bounds information checker --*- 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] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-21 Thread Gábor Horváth via cfe-commits
@@ -0,0 +1,199 @@ +//== BoundsInformationChecker.cpp - bounds information checker --*- 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] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-21 Thread Gábor Horváth via cfe-commits
@@ -0,0 +1,199 @@ +//== BoundsInformationChecker.cpp - bounds information checker --*- 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] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-21 Thread Gábor Horváth via cfe-commits
@@ -0,0 +1,199 @@ +//== BoundsInformationChecker.cpp - bounds information checker --*- 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] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-21 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/112784 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-21 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun commented: Overall, the direction looks good to me, some nitpicky comments inline. https://github.com/llvm/llvm-project/pull/112784 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-20 Thread Artem Dergachev via cfe-commits
@@ -0,0 +1,199 @@ +//== BoundsInformationChecker.cpp - bounds information checker --*- 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] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-20 Thread Artem Dergachev via cfe-commits
@@ -0,0 +1,199 @@ +//== BoundsInformationChecker.cpp - bounds information checker --*- 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] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-20 Thread Artem Dergachev via cfe-commits
@@ -0,0 +1,76 @@ +// RUN: %clang %s -std=c++20 -Xclang -verify --analyze \ +// RUN: -Xclang -analyzer-checker=core,alpha.cplusplus.BoundsInformation \ +// RUN: -Xclang -analyzer-checker=debug.ExprInspection haoNoQ wrote: `ExprInspection` is probably unnecessa

[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-20 Thread Artem Dergachev via cfe-commits
@@ -0,0 +1,199 @@ +//== BoundsInformationChecker.cpp - bounds information checker --*- 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] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-18 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: > but not to replace it And it doesn't necessarily need it in the first place! I think it's most likely going to be useful as a standalone checker even when you never needed `-Wunsafe-buffer-usage`. It's a bit coding-convention-y: roughly on the same level of "speculative" as t

[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-17 Thread David Kilzer via cfe-commits
ddkilzer wrote: This checker is intended to be a companion to [C++ Safe Buffers](https://clang.llvm.org/docs/SafeBuffers.html) and [`-Wunsafe-buffer-usage`](https://clang.llvm.org/docs/DiagnosticsReference.html#wunsafe-buffer-usage), but not replace it. https://github.com/llvm/llvm-project/p

[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-17 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-static-analyzer-1 Author: David Kilzer (ddkilzer) Changes Initial version of a bounds information checker to warn when the two-argument std::span constructor has a suspicious-looking size. --- Full diff: https://github.com/llvm/llvm-project/pull/

[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-17 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: David Kilzer (ddkilzer) Changes Initial version of a bounds information checker to warn when the two-argument std::span constructor has a suspicious-looking size. --- Full diff: https://github.com/llvm/llvm-project/pull/112784.diff 5 Fi

[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-17 Thread via cfe-commits
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it

[clang] [analyzer] Add alpha.cplusplus.BoundsInformation checker (PR #112784)

2024-10-17 Thread David Kilzer via cfe-commits
https://github.com/ddkilzer created https://github.com/llvm/llvm-project/pull/112784 Initial version of a bounds information checker to warn when the two-argument std::span constructor has a suspicious-looking size. >From 1da038a09f7979b4ad5b0843dc4e87b2b450fcfc Mon Sep 17 00:00:00 2001 From: