https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 01/11] Place holder message for sizeof operator in loops.
https://github.com/malavikasamak closed
https://github.com/llvm/llvm-project/pull/143205
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -353,6 +372,22 @@ void SizeofExpressionCheck::check(const
MatchFinder::MatchResult &Result) {
diag(E->getBeginLoc(),
"suspicious usage of 'sizeof(char*)'; do you mean 'strlen'?")
<< E->getSourceRange();
+ } else if (const auto *E = Result.Nodes.getNode
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 01/11] Place holder message for sizeof operator in loops.
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 1/9] Place holder message for sizeof operator in loops.
--
@@ -219,6 +219,11 @@ Changes in existing checks
tolerating fix-it breaking compilation when functions is used as pointers
to avoid matching usage of functions within the current compilation unit.
+- Improved :doc: `bugprone-sizeof-expression
malavikasamak
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 1/8] Place holder message for sizeof operator in loops.
--
@@ -353,6 +367,19 @@ void SizeofExpressionCheck::check(const
MatchFinder::MatchResult &Result) {
diag(E->getBeginLoc(),
"suspicious usage of 'sizeof(char*)'; do you mean 'strlen'?")
<< E->getSourceRange();
+ } else if (const auto *E = Result.Nodes.getNode
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/143205
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 1/7] Place holder message for sizeof operator in loops.
--
@@ -164,6 +164,53 @@ int Test2(MyConstChar* A) {
return sum;
}
+struct A {
+ int array[10];
+};
+
+struct B {
+ struct A a;
+};
+
+void loop_access_elements(int num, struct B b) {
+struct A arr[10];
+char buf[20];
+
+// CHECK-MESSAGES: :[[@LINE+1]]:5: warning:
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 1/7] Place holder message for sizeof operator in loops.
--
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 1/6] Place holder message for sizeof operator in loops.
--
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/143205
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/143205
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -561,6 +561,20 @@ Improvements to Clang's diagnostics
Improvements to Clang's time-trace
--
+Improvements to clang-tidy
+--
+
+New checks
+^^
+
+Changes in existing checks
+^^
+-Improved
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/143205
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/143205
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/143205
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 1/5] Place holder message for sizeof operator in loops.
--
@@ -316,3 +316,11 @@ Options
When `true`, the check will warn on pointer arithmetic where the
element count is obtained from a division with ``sizeof(...)``,
e.g., ``Ptr + Bytes / sizeof(*T)``. Default is `true`.
+
+.. option:: WarnOnSizeOfInLoopTermination
+
+ When
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 1/4] Place holder message for sizeof operator in loops.
--
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 1/3] Place holder message for sizeof operator in loops.
--
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/143205
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH 1/2] Place holder message for sizeof operator in loops.
--
https://github.com/malavikasamak created
https://github.com/llvm/llvm-project/pull/143205
None
>From 52e4413ea1e701dfe0b24cf957a26bb72732f066 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 21 May 2025 16:06:44 -0700
Subject: [PATCH] Place holder message for sizeof operator in loops.
https://github.com/malavikasamak closed
https://github.com/llvm/llvm-project/pull/140113
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
malavikasamak wrote:
CC @dtarditi
https://github.com/llvm/llvm-project/pull/140113
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/140113
>From c6d8a58a8468fb3e6bcbe7d5935e2aa033745d99 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Thu, 15 May 2025 10:46:01 -0700
Subject: [PATCH 1/2] [-Wunsafe-buffer-usage] Fix false warnings when const
https://github.com/malavikasamak created
https://github.com/llvm/llvm-project/pull/140113
The -Wunsafe-buffer-usage analysis currently warns when a const sized array is
safely accessed, with an index that is bound by the remainder operator. The
false alarm is now suppressed.
Example:
int cir
malavikasamak wrote:
Identifying safe operations on String literals has already landed as part of:
https://github.com/llvm/llvm-project/pull/115552. However, identifying safe
pointer arithmetic is not yet available. So, maybe we should revisit this PR
once again.
https://github.com/llvm/llvm
https://github.com/malavikasamak approved this pull request.
https://github.com/llvm/llvm-project/pull/137248
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak closed
https://github.com/llvm/llvm-project/pull/135087
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/135087
>From edbdfa66b45be76014f003f8e2d6f2d2871ea253 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Wed, 9 Apr 2025 14:31:06 -0700
Subject: [PATCH] Update the documentation for the unsafe_buffer_usage
attri
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/135087
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak created
https://github.com/llvm/llvm-project/pull/135087
Update the documentation for the unsafe_buffer_usage attribute to capture the
new behavior introduced by https://github.com/llvm/llvm-project/pull/125671
>From c3fbfd791d0c2f6d9ed0825fd2a043d3319da058 Mon
malavikasamak wrote:
I think we can close this PR, since we already merged this as part of
https://github.com/llvm/llvm-project/pull/115552
https://github.com/llvm/llvm-project/pull/115554
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https:
@@ -891,7 +891,9 @@ AST_MATCHER(CallExpr, hasUnsafeSnprintfBuffer) {
// Pattern 1:
static StringRef SizedObjs[] = {"span", "array", "vector",
- "basic_string_view", "basic_string"};
+ "basic_string_view", "b
https://github.com/malavikasamak closed
https://github.com/llvm/llvm-project/pull/125671
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak closed
https://github.com/llvm/llvm-project/pull/112284
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -245,3 +243,40 @@ struct AggregateViaDefaultInit {
void testAggregateViaDefaultInit() {
AggregateViaDefaultInit A;
};
+
+struct A {
+ int arr[2];
+
+ [[clang::unsafe_buffer_usage]]
+ int *ptr;
+};
+
+namespace std{
+ template class span {
+
+ T *elements;
+
+ pu
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/125671
>From 821a4b46705375bb34e207d406d8d7e9a2818f85 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 31 Jan 2025 13:19:46 +0530
Subject: [PATCH 1/3] [Wunsafe-buffer-usage] Turn off unsafe-buffer warning
@@ -245,3 +243,56 @@ struct AggregateViaDefaultInit {
void testAggregateViaDefaultInit() {
AggregateViaDefaultInit A;
};
+
+struct A {
+ int arr[2];
+
+ [[clang::unsafe_buffer_usage]]
+ int *ptr;
+};
+
+namespace std{
+ template class span {
+
+ T *elements;
+
+ pu
@@ -462,8 +462,25 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
// bug
if (ArrIdx.isNonNegative() && ArrIdx.getLimitedValue() < limit)
return true;
- }
- return false;
+ } else if (const auto *BE = dyn_cast(IndexExpr)) {
malavikasa
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/112284
>From bf1f0b88c26cef3fd7eab40341558e1742c62321 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 11 Oct 2024 12:24:58 -0700
Subject: [PATCH 1/2] [Wunsafe-buffer-usage] False positives for & expressio
https://github.com/malavikasamak deleted
https://github.com/llvm/llvm-project/pull/125671
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -462,8 +462,25 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
// bug
if (ArrIdx.isNonNegative() && ArrIdx.getLimitedValue() < limit)
return true;
- }
- return false;
+ } else if (const auto *BE = dyn_cast(IndexExpr)) {
+if (BE->getOpcode() !=
@@ -462,8 +462,25 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
// bug
if (ArrIdx.isNonNegative() && ArrIdx.getLimitedValue() < limit)
return true;
- }
- return false;
+ } else if (const auto *BE = dyn_cast(IndexExpr)) {
+if (BE->getOpcode() !=
@@ -245,3 +243,40 @@ struct AggregateViaDefaultInit {
void testAggregateViaDefaultInit() {
AggregateViaDefaultInit A;
};
+
+struct A {
+ int arr[2];
+
+ [[clang::unsafe_buffer_usage]]
+ int *ptr;
+};
+
+namespace std{
+ template class span {
+
+ T *elements;
+
+ pu
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/125671
>From 821a4b46705375bb34e207d406d8d7e9a2818f85 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 31 Jan 2025 13:19:46 +0530
Subject: [PATCH 1/2] [Wunsafe-buffer-usage] Turn off unsafe-buffer warning
malavikasamak wrote:
@dtarditi FYI.
https://github.com/llvm/llvm-project/pull/112284
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/112284
>From bf1f0b88c26cef3fd7eab40341558e1742c62321 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 11 Oct 2024 12:24:58 -0700
Subject: [PATCH] [Wunsafe-buffer-usage] False positives for & expression
i
malavikasamak wrote:
@dtarditi FYI.
https://github.com/llvm/llvm-project/pull/125671
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak closed
https://github.com/llvm/llvm-project/pull/125483
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/125483
>From efd4f3200c4fc2b132157c56e0eaf6c2db844878 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 31 Jan 2025 13:40:55 +0530
Subject: [PATCH] [Wunsafe-buffer-usage] Add additional tests to esnure safe
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/112284
>From f5b583585b96557377e6e2cb524c8e87fab81dd7 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 11 Oct 2024 12:24:58 -0700
Subject: [PATCH] [Wunsafe-buffer-usage] False positives for & expression
i
https://github.com/malavikasamak created
https://github.com/llvm/llvm-project/pull/125671
Unsafe operation in methods that are already annotated with
clang::unsafe_buffer_usage attribute, should not trigger a warning. This is
because, the developer has already identified the method as unsafe a
https://github.com/malavikasamak created
https://github.com/llvm/llvm-project/pull/125483
Add more tests, where the index of the const array access evaluates to a
constant and depends on a template argument.
rdar://143759014
>From 12dc35b91a805c75017d58d400082d2a8959ee31 Mon Sep 17 00:00:00 2
malavikasamak wrote:
@nico Thanks for the reproducer. I have relanded this change with the fix for
the failing assert.
https://github.com/llvm/llvm-project/commit/2a8c12b29f8dc777a62868512bed1a2dae1ef8b2
https://github.com/llvm/llvm-project/pull/119340
___
https://github.com/malavikasamak closed
https://github.com/llvm/llvm-project/pull/123713
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak created
https://github.com/llvm/llvm-project/pull/123713
This reverts commit 7dd34baf5505d689161c3a8678322a394d7a2929.
Fixed the assertion violation reported by
7dd34baf5505d689161c3a8678322a394d7a2929
>From b3b7a079e861432554eb3c85a2cc235980f53f65 Mon Sep 17
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/119340
>From ca068b2383b784d783a33f3678f6bb90a6544861 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Tue, 10 Dec 2024 11:05:21 +0530
Subject: [PATCH] [Wunsafe-buffer-usage] Fix false positive when const sized
malavikasamak wrote:
Can you please rebase this PR? The isSafeSpanTwoParamConstruct matcher has
changes on the main branch that are not present here. For instance, case 6 is
now used by :`std::span{std::addressof(...), 1}` on the main branch.
https://github.c
malavikasamak wrote:
Very interesting. Potentially an API that could be exposed to other analyses
too!
https://github.com/llvm/llvm-project/pull/114894
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/112284
>From ea92377ca9b449e62dcb9385184c9edda8e14fdb Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 11 Oct 2024 12:24:58 -0700
Subject: [PATCH] [Wunsafe-buffer-usage] False positives for & expression
i
https://github.com/malavikasamak closed
https://github.com/llvm/llvm-project/pull/118249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
malavikasamak wrote:
@jkorous-apple: If there are no objections, I will go ahead and merge this PR.
https://github.com/llvm/llvm-project/pull/118249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo
malavikasamak wrote:
> LGTM! Thanks.
Thanks @ziqingluo-90
https://github.com/llvm/llvm-project/pull/118249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -433,37 +433,36 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
//already duplicated
// - call both from Sema and from here
- const auto *BaseDRE =
- dyn_cast(Node.getBase()->IgnoreParenImpCasts());
- const auto *SLiteral =
- dyn_cast(Node.ge
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/118249
>From c1f7c2b37948271ccc8de7910d2bab91dfb2f87e Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 29 Nov 2024 14:53:37 +0530
Subject: [PATCH] [-Wunsafe-buffer-usage] Suppress warning for
multi-dimens
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/118249
>From e1eadf464509ab74ff4f097f92e7140f43c61262 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 29 Nov 2024 14:53:37 +0530
Subject: [PATCH] [-Wunsafe-buffer-usage] Suppress warning for
multi-dimens
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/118249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -433,37 +433,36 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
//already duplicated
// - call both from Sema and from here
- const auto *BaseDRE =
- dyn_cast(Node.getBase()->IgnoreParenImpCasts());
- const auto *SLiteral =
- dyn_cast(Node.ge
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/118249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -52,3 +52,37 @@ void constant_id_string(unsigned idx) {
unsafe_char = ""[1]; //expected-warning{{unsafe buffer access}}
unsafe_char = ""[idx]; //expected-warning{{unsafe buffer access}}
}
+
+typedef float Float4x4[4][4];
+
+// expected-warning@+1 {{'matrix' is an unsafe
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/118249
>From 6281b990096f058cfb6ed862631b8d6436db23f7 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 29 Nov 2024 14:53:37 +0530
Subject: [PATCH] [-Wunsafe-buffer-usage] Suppress warning for
multi-dimens
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/118249
>From 3a73ee44036b4162115061751241f105147f5947 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 29 Nov 2024 14:53:37 +0530
Subject: [PATCH] [-Wunsafe-buffer-usage] Suppress warning for
multi-dimens
@@ -8,6 +8,5 @@
// main function
int main(int argc, char *argv[]) { // expected-warning{{'argv' is an unsafe
pointer used for buffer access}}
char tmp;
- tmp = argv[5][5];// expected-note{{used in buffer access
here}} \
-
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/118249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -8,6 +8,5 @@
// main function
int main(int argc, char *argv[]) { // expected-warning{{'argv' is an unsafe
pointer used for buffer access}}
char tmp;
- tmp = argv[5][5];// expected-note{{used in buffer access
here}} \
-
@@ -52,3 +52,37 @@ void constant_id_string(unsigned idx) {
unsafe_char = ""[1]; //expected-warning{{unsafe buffer access}}
unsafe_char = ""[idx]; //expected-warning{{unsafe buffer access}}
}
+
+typedef float Float4x4[4][4];
+
+// expected-warning@+1 {{'matrix' is an unsafe
@@ -433,37 +433,36 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
//already duplicated
// - call both from Sema and from here
- const auto *BaseDRE =
- dyn_cast(Node.getBase()->IgnoreParenImpCasts());
- const auto *SLiteral =
- dyn_cast(Node.ge
@@ -8,6 +8,5 @@
// main function
int main(int argc, char *argv[]) { // expected-warning{{'argv' is an unsafe
pointer used for buffer access}}
char tmp;
- tmp = argv[5][5];// expected-note{{used in buffer access
here}} \
-
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/118249
>From 2d923a6c6a21ab68a968d49becfe5d22fc20096f Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 29 Nov 2024 14:53:37 +0530
Subject: [PATCH] [-Wunsafe-buffer-usage] Suppress warning for
multi-dimens
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/118249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/118249
>From a3bc09e9ad3e12a2041eb41671872781638b7aa9 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 29 Nov 2024 14:53:37 +0530
Subject: [PATCH] [-Wunsafe-buffer-usage] Suppress warning for
multi-dimens
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/118249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/118249
>From 8ca3b6312bc9ab53d7f89d02e0de180fadb20679 Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 29 Nov 2024 14:53:37 +0530
Subject: [PATCH] [-Wunsafe-buffer-usage] Suppress warning for
multi-dimens
https://github.com/malavikasamak created
https://github.com/llvm/llvm-project/pull/118249
Do not warn about unsafe buffer access, when 2-D constant arrays are accessed
and the indices are within the bounds of the buffer. Warning in such cases is a
false postive. Such a suppression aleady exist
https://github.com/malavikasamak closed
https://github.com/llvm/llvm-project/pull/115797
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/115797
>From d0a95e158f6d39fdb284c067f945299e27029dbc Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Mon, 11 Nov 2024 17:18:40 -0800
Subject: [PATCH] [-Wunsafe-buffer-usage] Fix false positive in warnging aga
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/115797
>From a60c18973c0ea5b59c7c5f38813083e862f70e6e Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Mon, 11 Nov 2024 17:18:40 -0800
Subject: [PATCH 1/2] [-Wunsafe-buffer-usage] Fix false positive in warnging
https://github.com/malavikasamak created
https://github.com/llvm/llvm-project/pull/115797
Do not warn when two parameter constructor receives pointer address from a
std::addressof method and the span size is set to 1.
(rdar://139298119)
>From a60c18973c0ea5b59c7c5f38813083e862f70e6e Mon Sep 1
https://github.com/malavikasamak closed
https://github.com/llvm/llvm-project/pull/115552
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/115552
>From 94ba7d8b845f18b089e03c0fa41d9d1d20e79f0b Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 8 Nov 2024 13:40:20 -0800
Subject: [PATCH] [Wunsafe-buffer-usage] Fix false positives in handling stri
https://github.com/malavikasamak edited
https://github.com/llvm/llvm-project/pull/115552
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -38,3 +38,17 @@ void constant_idx_unsafe(unsigned idx) {
// expected-note@-1{{change type of 'buffer' to
'std::array' to label it for hardening}}
buffer[10] = 0; // expected-note{{used in buffer access here}}
}
+
+void constant_id_string(unsi
@@ -38,3 +38,17 @@ void constant_idx_unsafe(unsigned idx) {
// expected-note@-1{{change type of 'buffer' to
'std::array' to label it for hardening}}
buffer[10] = 0; // expected-note{{used in buffer access here}}
}
+
+void constant_id_string(unsi
https://github.com/malavikasamak updated
https://github.com/llvm/llvm-project/pull/115552
>From a3f41d4b947739f97adccbcb3dcef0a37f2a508a Mon Sep 17 00:00:00 2001
From: MalavikaSamak
Date: Fri, 8 Nov 2024 13:40:20 -0800
Subject: [PATCH] [Wunsafe-buffer-usage] Fix false positives in handling stri
https://github.com/malavikasamak created
https://github.com/llvm/llvm-project/pull/115552
Do not warn when a string literal is indexed and the idex value is within the
bounds of the length of the string.
(rdar://139106996)
>From 3be112ec1f0b2e6e2948db082a7141d91b873a17 Mon Sep 17 00:00:00 200
@@ -420,6 +420,118 @@ AST_MATCHER(CXXConstructExpr,
isSafeSpanTwoParamConstruct) {
return false;
}
+class MaxValueEval : public RecursiveASTVisitor {
+
+ std::vector val;
+ ASTContext &Context;
+ llvm::APInt Max;
+ unsigned bit_width;
+
+public:
+ typedef RecursiveASTV
1 - 100 of 149 matches
Mail list logo