[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / Analysis / stream.cpp
blob8c65d9c287fdaf86fe4ba3df07f22efcc9441565
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Stream -verify %s
3 typedef struct _IO_FILE FILE;
4 extern FILE *fopen(const char *path, const char *mode);
6 struct X {
7 int A;
8 int B;
9 };
11 void *fopen(X x, const char *mode) {
12 return new char[4];
15 void f1() {
16 X X1;
17 void *p = fopen(X1, "oo");
18 } // no-warning
20 void f2() {
21 FILE *f = fopen("file", "r");
22 } // expected-warning {{Opened stream never closed. Potential resource leak}}