[clang] [clang][analyzer] Support 'tello' and 'fseeko' in the StreamChecker (PR #77580)

Balázs Kéri via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 10 09:04:52 PST 2024


================
@@ -324,6 +355,57 @@ void error_fseek_0(void) {
   fclose(F);
 }
 
+void error_fseeko_0(void) {
+  FILE *F = fopen("file", "r");
+  if (!F)
+    return;
+  int rc = fseeko(F, 0, SEEK_SET);
+  if (rc) {
+    int IsFEof = feof(F), IsFError = ferror(F);
+    // Get ferror or no error, but not feof.
+    clang_analyzer_eval(IsFError);
+    // expected-warning at -1 {{FALSE}}
+    // expected-warning at -2 {{TRUE}}
+    clang_analyzer_eval(IsFEof);
+    // expected-warning at -1 {{FALSE}}
+    // Error flags should not change.
----------------
balazske wrote:

Part after "error flags should not change" is not needed here, it is enough to have this at one place.


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


More information about the cfe-commits mailing list