Clang Project

clang_source_code/test/Analysis/cstring-ranges.c
1// RUN: %clang_analyze_cc1 -analyzer-checker=unix.cstring -analyzer-output=text %s 2>&1 | FileCheck %s
2
3// This test verifies argument source range highlighting.
4// Otherwise we've no idea which of the arguments is null.
5
6char *strcpy(char *, const char *);
7
8void foo() {
9  char *a = 0, *b = 0;
10  strcpy(a, b);
11}
12
13// CHECK: warning: Null pointer argument in call to string copy function
14// CHECK-NEXT: strcpy(a, b);
15// CHECK-NEXT: ^      ~
16