[PATCH] D65704: DirectoryWatcher::create: Adding better error handling.

Puyan Lotfi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 07:59:14 PDT 2019


plotfi marked an inline comment as done.
plotfi added inline comments.


================
Comment at: clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp:283
       /*waitForInitialSync=*/true);
+  if (!DW) return;
 
----------------
gribozavr wrote:
> plotfi wrote:
> > jkorous wrote:
> > > jkorous wrote:
> > > > IIUC this is silently dropping errors. We should print the error here.
> > > Ah, my bad - I just took a better look at `Expected<>` and you're right.
> > Nah, the way llvm::Expected works is that if the error isn't consumed then it will blow up in the destructor. So if it is an error, returning will cause the destructor to crash the program and print the error implicitly. Very nice error handling mechanism you ask me :-) 
> And crashing would be much better in a test. The test should test the DirectoryWatcher, not just be graceful about error handling.
Test was in a deadlock, see commit message. This fixes that.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65704/new/

https://reviews.llvm.org/D65704





More information about the cfe-commits mailing list