================
@@ -248,3 +248,25 @@ void check_fflush_all(void) {
     if (errno) {}                    // no-warning
   }
 }
+
+void check_opendir(const char *Path) {
+  DIR *Dir = opendir(Path);
+  if (Dir == NULL) {
+    clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}}
+    if (errno) {}                    // no-warning
+  } else {
+    if (errno) {}                    // expected-warning{{An undefined value 
may be read from 'errno'}}
+    closedir(Dir);
+  }
+}
+
+void check_fdopendir(int Fd) {
+  DIR *Dir = fdopendir(Fd);
+  if (Dir == NULL) {
+    clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}}
+    if (errno) {}                    // no-warning
+  } else {
+    if (errno) {}                    // expected-warning{{An undefined value 
may be read from 'errno'}}
+    closedir(Dir);
+  }
+}
----------------
benshi001 wrote:

I have removed those tests. Do you mean all type `DIR` related functions are 
controversial now, so they need tests? Or there are some more functions are so?

https://github.com/llvm/llvm-project/pull/78079
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to