| 1 |
// RUN: %clang_cc1 -std=c++20 -Wno-all -Wunsafe-buffer-usage -fcxx-exceptions -fsafe-buffer-usage-suggestions -verify %s |
| 2 |
// RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage -fcxx-exceptions -fdiagnostics-parseable-fixits -fsafe-buffer-usage-suggestions %s 2>&1 | FileCheck %s |
| 3 |
|
| 4 |
// We do not fix parameters of the `main` function |
| 5 |
|
| 6 |
// CHECK-NOT: fix-it: |
| 7 |
|
| 8 |
// main function |
| 9 |
int main(int argc, char *argv[]) { // expected-warning{{'argv' is an unsafe pointer used for buffer access}} |
| 10 |
char tmp; |
| 11 |
tmp = argv[5][5]; // expected-note{{used in buffer access here}} \ |
| 12 |
expected-warning{{unsafe buffer access}} |
| 13 |
} |