1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.unix.Stream -verify %s 2 3 typedef struct _IO_FILE FILE; 4 extern FILE *fopen(const char *path, const char *mode); 5 6 struct X { 7 int A; 8 int B; 9 }; 10 fopen(X x,const char * mode)11void *fopen(X x, const char *mode) { 12 return new char[4]; 13 } 14 f1()15void f1() { 16 X X1; 17 void *p = fopen(X1, "oo"); 18 } // no-warning 19 f2()20void f2() { 21 FILE *f = fopen("file", "r"); 22 } // expected-warning {{Opened stream never closed. Potential resource leak}} 23