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 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
@@ -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
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 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/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
@@ -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() !=
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
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
@@ -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
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,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
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
@@ -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 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
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:
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
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 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.
--
@@ -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
@@ -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.
--
@@ -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.
--
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.
--
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.
@@ -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 1/6] 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.
--
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 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
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
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 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 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/5] 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
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
@@ -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
101 - 149 of 149 matches
Mail list logo