================
@@ -51,8 +51,14 @@ llvm::Expected<PathSeq> enumerateFiles(FileManager &FM, 
StringRef Directory) {
     if (EC)
       return errorCodeToError(EC);
 
+    // Ensure the iterator is valid before dereferencing.
+    if (i == ie)
+      break;
+
     // Skip files that do not exist. This usually happens for broken symlinks.
-    if (FS.status(i->path()) == std::errc::no_such_file_or_directory)
+    auto StatusOrErr = FS.status(i->path());
+    if (!StatusOrErr ||
----------------
smanna12 wrote:

Doing more investigation, it looks like a false positive hit by static analyzer 
tool. closing this PR. 

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

Reply via email to