================
@@ -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)
----------------
smanna12 wrote:

> Why does this make a difference? 

Thanks @cyndyishida for reviews!

>>the same check happens at each iteration of the loop on line 50. There's no 
>>mutations on `i` or `ie` between there and this check.

Agreed. I misunderstood the codes! 

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