[PATCH] D30768: [PATCH][VFS] Ignore broken symlinks in the directory iterator.

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 10 13:12:07 PST 2017


bruno accepted this revision.
bruno added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Basic/VirtualFileSystem.cpp:1873
     vfs::directory_iterator I = FS->dir_begin(State->top()->getName(), EC);
-    if (EC)
+    if (EC && EC != std::errc::no_such_file_or_directory)
       return *this;
----------------
ributzka wrote:
> bruno wrote:
> > Can you add a comment explaining why you are doing it? I would prefer if we reset the `EC` state here than having the callers ignoring `EC` results.
> If we reset the EC here, then the caller won't know that there was an issue. The idea is that we still want the caller to check EC. It should be up to the caller to decide how to act on this particular error.
> 
> I guess since the caller has to check for the error anyway I could even remove this check completely and not check EC at all here.
Right, this should be fine with the latest changes and per discussions offline. LGTM


https://reviews.llvm.org/D30768





More information about the cfe-commits mailing list