[clang] 979c4e9 - [-Wunsafe-buffer-usage][NFC] Reintroduce lost test cases (#82060)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 16 14:50:59 PST 2024
Author: jkorous-apple
Date: 2024-02-16T14:50:56-08:00
New Revision: 979c4e9a411a8c5116c859788a738cc1cd9f23f1
URL: https://github.com/llvm/llvm-project/commit/979c4e9a411a8c5116c859788a738cc1cd9f23f1
DIFF: https://github.com/llvm/llvm-project/commit/979c4e9a411a8c5116c859788a738cc1cd9f23f1.diff
LOG: [-Wunsafe-buffer-usage][NFC] Reintroduce lost test cases (#82060)
We likely accidentally removed these as part of conflict resolution.
Added:
Modified:
clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp
Removed:
################################################################################
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;
More information about the cfe-commits
mailing list