[PATCH] D58418: [clang][DirectoryWatcher] Upstream DirectoryWatcher
Argyrios Kyrtzidis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 23 10:51:39 PST 2019
akyrtzi added inline comments.
================
Comment at: clang/lib/DirectoryWatcher/DirectoryWatcher-linux.inc.h:135
+ if (!statusOpt.hasValue())
+ K = DirectoryWatcher::EventKind::Removed;
+ }
----------------
mgorny wrote:
> jkorous wrote:
> > mgorny wrote:
> > > Why? I suppose this deserves a comment.
> > I'll add this comment:
> >
> > // The file might have been removed just after we received the event.
> Wouldn't that cause removals to be reported twice?
Not quite sure if it can happen in practice but I'd suggest to accept this as potential occurrence and add it to documentation ("a 'removed' event may be reported twice). I think it is better to handle a definite "fact" (the file doesn't exist) than ignore it and assume the 'removed' event will eventually show up, or try to eliminate the double reporting which would over-complicate the implementation.
After all, if inotify() is not 100% reliable then there's already the possibility that you'll get a 'removed' event for a file that was not reported as 'added' before.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58418/new/
https://reviews.llvm.org/D58418
More information about the cfe-commits
mailing list