================
@@ -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);
+  }
+}
----------------
balazske wrote:

I think for now it is not necessary to add tests for these functions. These 
functions are the same type as all other functions in 
`StdLibraryFunctionsChecker` that have currently no test. And it is 
questionable if these functions belong to stream handling functions or to 
`StreamChecker`.

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