[X86] Move getGFNICtrlMask before CTLZ/CTTZ lowering. NFC.
[llvm-project.git] / clang / test / SemaCXX / warn-unsafe-buffer-usage-fixits-pointer-arg-to-func-ptr-call.cpp
blobd9838cde9a4023713a261b49267a088af002a5a2
1 // RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage \
2 // RUN: -fsafe-buffer-usage-suggestions \
3 // RUN: -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
5 void unsafe_array_func_ptr_call(void (*fn_ptr)(int *param)) {
6 int p[32];
7 // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:12}:"std::array<int, 32> p"
9 int idx;
10 p[idx] = 10;
11 fn_ptr(p);
12 // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:11}:".data()"
15 void unsafe_ptr_func_ptr_call(void (*fn_ptr)(int *param)) {
16 int *p;
17 // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:8}:"std::span<int> "
19 p[5] = 10;
20 fn_ptr(p);
21 // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:11}:".data()"
24 void addr_of_unsafe_ptr_func_ptr_call(void (*fn_ptr)(int *param)) {
25 int *p;
26 // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:8}:"std::span<int> "
28 p[5] = 10;
29 fn_ptr(&p[0]);
30 // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:15}:"p.data()"
33 void addr_of_unsafe_ptr_w_offset_func_ptr_call(void (*fn_ptr)(int *param)) {
34 int *p;
35 // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:8}:"std::span<int> "
37 p[5] = 10;
38 fn_ptr(&p[3]);
39 // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:15}:"&p.data()[3]"
42 void preincrement_unsafe_ptr_func_ptr_call(void (*fn_ptr)(int *param)) {
43 int *p;
44 // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:8}:"std::span<int> "
46 p[5] = 10;
47 fn_ptr(++p);
48 // CHECK-DAG: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:13}:"(p = p.subspan(1)).data()"