Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / warn-unsafe-buffer-usage-fixits-assign-to-array-subscr-on-ptr.cpp
blob82e746703d3324af26d3f9b79aabf67758a4ab69
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 // TODO cases where we don't want fixits
7 // The Fix-It for unsafe operation is trivially empty.
8 // In order to test that our machinery recognizes that we can test if the variable declaration gets a Fix-It.
9 // If the operation wasn't handled propertly the declaration won't get Fix-It.
10 // By testing presence of the declaration Fix-It we indirectly test presence of the trivial Fix-It for its operations.
11 void test() {
12 int *p = new int[10];
13 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:11}:"std::span<int> p"
14 // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:12-[[@LINE-2]]:12}:"{"
15 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:23-[[@LINE-3]]:23}:", 10}"
16 p[5] = 1;
17 // CHECK-NOT: fix-it: