[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread Artem Dergachev via cfe-commits
@@ -406,6 +406,39 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) { } return false; } + +AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { + // FIXME: Proper solution: + // - refactor Sema::CheckArrayAccess + //- split safe/OOB/unknown decision

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
https://github.com/jkorous-apple closed https://github.com/llvm/llvm-project/pull/80504 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80504 >From e075dc3ac10c0cd2e12b223988ec4821b40b55d2 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Fri, 2 Feb 2024 14:46:59 -0800 Subject: [PATCH 1/7] [-Wunsafe-buffer-usage] Ignore safe array subscripts

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/80504 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread Artem Dergachev via cfe-commits
@@ -598,16 +623,16 @@ class ArraySubscriptGadget : public WarningGadget { } static Matcher matcher() { -// FIXME: What if the index is integer literal 0? Should this be -// a safe gadget in this case? - // clang-format off +// clang-format off

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
@@ -598,16 +623,16 @@ class ArraySubscriptGadget : public WarningGadget { } static Matcher matcher() { -// FIXME: What if the index is integer literal 0? Should this be -// a safe gadget in this case? - // clang-format off +// clang-format off

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80504 >From e075dc3ac10c0cd2e12b223988ec4821b40b55d2 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Fri, 2 Feb 2024 14:46:59 -0800 Subject: [PATCH 1/6] [-Wunsafe-buffer-usage] Ignore safe array subscripts

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80504 >From e075dc3ac10c0cd2e12b223988ec4821b40b55d2 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Fri, 2 Feb 2024 14:46:59 -0800 Subject: [PATCH 1/4] [-Wunsafe-buffer-usage] Ignore safe array subscripts

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
@@ -406,6 +406,31 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) { } return false; } + +AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { + const DeclRefExpr * BaseDRE = dyn_cast_or_null(Node.getBase()->IgnoreParenImpCasts()); + if (!BaseDRE) +

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
@@ -406,6 +406,31 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) { } return false; } + +AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { + const DeclRefExpr * BaseDRE = dyn_cast_or_null(Node.getBase()->IgnoreParenImpCasts()); + if (!BaseDRE) +

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
@@ -598,16 +623,16 @@ class ArraySubscriptGadget : public WarningGadget { } static Matcher matcher() { -// FIXME: What if the index is integer literal 0? Should this be -// a safe gadget in this case? - // clang-format off +// clang-format off

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80504 >From dfc9d95c185f5228f5c9680a19aa396d20e33d19 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Thu, 25 Jan 2024 13:52:12 -0800 Subject: [PATCH 1/7] [-Wunsafe-buffer-usage] Emit fixits for arguments of

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-analysis @llvm/pr-subscribers-clang Author: None (jkorous-apple) Changes depends on https://github.com/llvm/llvm-project/pull/80358 --- Full diff: https://github.com/llvm/llvm-project/pull/80504.diff 5 Files Affected: - (modified)

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80504 >From dfc9d95c185f5228f5c9680a19aa396d20e33d19 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Thu, 25 Jan 2024 13:52:12 -0800 Subject: [PATCH 1/6] [-Wunsafe-buffer-usage] Emit fixits for arguments of

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-06 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80504 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/20] [-Wunsafe-buffer-usage] Move Strategy class to the

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-02 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 86cd2fbdfe67d70a7fe061ed5d3a644f50f070f5 b510cf7ca8c47c64e0b9f5fcd5634759dfe95751 --

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-02 Thread via cfe-commits
https://github.com/jkorous-apple created https://github.com/llvm/llvm-project/pull/80504 depends on https://github.com/llvm/llvm-project/pull/80358 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH