[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / cstring-plist.c
blob3851a5469376cae9a349a52f0cf3957c9a6ff469
1 // RUN: rm -f %t
2 // RUN: %clang_analyze_cc1 -fblocks \
3 // RUN: -analyzer-checker=core \
4 // RUN: -analyzer-checker=unix.Malloc \
5 // RUN: -analyzer-checker=unix.cstring.NullArg \
6 // RUN: -analyzer-disable-checker=alpha.unix.cstring.OutOfBounds \
7 // RUN: -analyzer-output=plist -o %t %s
8 // RUN: FileCheck -input-file %t %s
10 typedef __typeof(sizeof(int)) size_t;
11 void *malloc(size_t);
12 void free(void *);
13 char *strncpy(char *restrict s1, const char *restrict s2, size_t n);
17 void cstringchecker_bounds_nocrash(void) {
18 char *p = malloc(2);
19 strncpy(p, "AAA", sizeof("AAA")); // we don't expect warning as the checker is disabled
20 free(p);
23 // CHECK: <key>diagnostics</key>
24 // CHECK-NEXT: <array>
25 // CHECK-NEXT: </array>
26 // CHECK-NEXT: <key>files</key>
27 // CHECK-NEXT: <array>
28 // CHECK-NEXT: </array>
29 // CHECK-NEXT: </dict>
30 // CHECK-NEXT: </plist>