2018-07-31 07:44:37 +08:00
|
|
|
// RUN: %clang_analyze_cc1 -analyzer-checker=unix.cstring -analyzer-output=text %s 2>&1 | FileCheck %s
|
|
|
|
|
|
|
|
// This test verifies argument source range highlighting.
|
|
|
|
// Otherwise we've no idea which of the arguments is null.
|
2019-12-11 08:48:17 +08:00
|
|
|
// These days we actually also have it in the message,
|
|
|
|
// but the range is still great to have.
|
2018-07-31 07:44:37 +08:00
|
|
|
|
|
|
|
char *strcpy(char *, const char *);
|
|
|
|
|
2022-02-12 20:23:43 +08:00
|
|
|
void foo(void) {
|
2018-07-31 07:44:37 +08:00
|
|
|
char *a = 0, *b = 0;
|
|
|
|
strcpy(a, b);
|
|
|
|
}
|
|
|
|
|
2019-12-11 08:48:17 +08:00
|
|
|
// CHECK: warning: Null pointer passed as 1st argument to string copy function
|
2018-07-31 07:44:37 +08:00
|
|
|
// CHECK-NEXT: strcpy(a, b);
|
|
|
|
// CHECK-NEXT: ^ ~
|