[clang] [-Wunsafe-buffer-usage][NFC] Reintroduce lost test cases (PR #82060)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 16 14:51:05 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (jkorous-apple)
<details>
<summary>Changes</summary>
We likely accidentally removed these as part of conflict resolution.
---
Full diff: https://github.com/llvm/llvm-project/pull/82060.diff
1 Files Affected:
- (modified) clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp (+28)
``````````diff
diff --git a/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp b/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp
index 68b2cef1919379..292e89cb00c9e4 100644
--- a/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp
+++ b/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp
@@ -57,8 +57,36 @@ void local_variable_qualifiers_specifiers() {
int tmp;
tmp = p[5];
tmp = q[5];
+
+ [[deprecated]] const int * x = a;
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:18-[[@LINE-1]]:29}:"std::span<int const>"
+ const int * y [[deprecated]];
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:14}:"std::span<int const>"
+ tmp = x[5];
+ tmp = y[5];
}
+void local_variable_unsupported_specifiers() {
+ int a[10];
+ const int * p [[deprecated]] = a; // not supported because the attribute overlaps the source range of the declaration
+ // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:
+
+ static const int * q = a; // storage specifier not supported yet
+ // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:
+
+ extern int * x; // storage specifier not supported yet
+ // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:
+
+ constexpr int * y = 0; // `constexpr` specifier not supported yet
+ // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:
+
+ int tmp;
+
+ tmp = p[5];
+ tmp = q[5];
+ tmp = x[5];
+ tmp = y[5];
+}
void local_array_subscript_variable_extent() {
int n = 10;
``````````
</details>
https://github.com/llvm/llvm-project/pull/82060
More information about the cfe-commits
mailing list