[clang] [clang][analyzer] Support `fflush` in the StreamChecker (PR #74296)

Balázs Kéri via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 06:53:42 PST 2023


================
@@ -299,6 +299,15 @@ void error_fseek_0(void) {
   fclose(F);
 }
 
+void error_fflush(void) {
+  FILE *F = tmpfile();
+  if (!F)
+    return;
+  fclose(F);
+  fflush(F);    // expected-warning {{Stream might be already closed}}
+  fflush(NULL); // no-warning
+}
+
----------------
balazske wrote:

A new test is needed when the passed stream is NULL but not a null constant.

https://github.com/llvm/llvm-project/pull/74296


More information about the cfe-commits mailing list