[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / taint-checker-callback-order-without-definition.c
blob6de87f736926d36b01129ce39bb2f46a37c47464
1 // RUN: %clang_analyze_cc1 %s \
2 // RUN: -analyzer-checker=core,alpha.security.taint \
3 // RUN: -mllvm -debug-only=taint-checker \
4 // RUN: 2>&1 | FileCheck %s
6 // REQUIRES: asserts
8 struct _IO_FILE;
9 typedef struct _IO_FILE FILE;
10 FILE *fopen(const char *fname, const char *mode);
12 char *fgets(char *s, int n, FILE *fp); // no-definition
14 void top(const char *fname, char *buf) {
15 FILE *fp = fopen(fname, "r"); // Introduce taint.
16 // CHECK: PreCall<fopen(fname, "r")> prepares tainting arg index: -1
17 // CHECK-NEXT: PostCall<fopen(fname, "r")> actually wants to taint arg index: -1
19 if (!fp)
20 return;
22 (void)fgets(buf, 42, fp); // Trigger taint propagation.
24 // CHECK-NEXT: PreCall<fgets(buf, 42, fp)> prepares tainting arg index: -1
25 // CHECK-NEXT: PreCall<fgets(buf, 42, fp)> prepares tainting arg index: 0
26 // CHECK-NEXT: PreCall<fgets(buf, 42, fp)> prepares tainting arg index: 2
28 // CHECK-NEXT: PostCall<fgets(buf, 42, fp)> actually wants to taint arg index: -1
29 // CHECK-NEXT: PostCall<fgets(buf, 42, fp)> actually wants to taint arg index: 0
30 // CHECK-NEXT: PostCall<fgets(buf, 42, fp)> actually wants to taint arg index: 2