Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / taint-tester.cpp
blob23a92cc56d248f4f651e079a18853cd6f5b6b548
1 // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.security.taint,debug.TaintTest %s -verify
2 // expected-no-diagnostics
4 typedef struct _FILE FILE;
5 typedef __typeof(sizeof(int)) size_t;
6 extern FILE *stdin;
7 typedef long ssize_t;
8 ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
9 int printf(const char * __restrict, ...);
10 int snprintf(char *, size_t, const char *, ...);
11 void free(void *ptr);
13 struct GetLineTestStruct {
14 ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
17 void getlineTest(void) {
18 FILE *fp;
19 char *line = 0;
20 size_t len = 0;
21 ssize_t read;
22 struct GetLineTestStruct T;
24 while ((read = T.getline(&line, &len, stdin)) != -1) {
25 printf("%s", line); // no warning
27 free(line);
30 class opaque;
31 void testOpaqueClass(opaque *obj) {
32 char buf[20];
33 snprintf(buf, 20, "%p", obj); // don't crash trying to load *obj