From 1dcf216f9fa662a3a02c3fc938157fbc0bcdf19f Mon Sep 17 00:00:00 2001 From: Puyan Lotfi Date: Tue, 6 Aug 2019 23:25:34 +0000 Subject: [clang][DirectoryWatcher][NFC] Swapping asserts for llvm fatal_error in create I also have replaced all the instances of "auto DW = DirectoryWatcher::create" with llvm::Expected> DW = DirectoryWatcher::create to make it more clear that DirectoryWatcher::create is returning an Expected. I've also allowed for logAllUnhandledErrors to consume errors in the case were DirectoryWatcher::create produces them. Differential Revision: https://reviews.llvm.org/D65829 llvm-svn: 368108 --- clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp') diff --git a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp index 8a5e76c521b..865c2b33bf9 100644 --- a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp +++ b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp @@ -325,7 +325,9 @@ llvm::Expected> clang::DirectoryWatcher::creat StringRef Path, std::function, bool)> Receiver, bool WaitForInitialSync) { - assert(!Path.empty() && "Path.empty()"); + if (Path.empty()) + llvm::report_fatal_error( + "DirectoryWatcher::create can not accept an empty Path."); const int InotifyFD = inotify_init1(IN_CLOEXEC); if (InotifyFD == -1) -- cgit v1.2.3