summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp4
-rw-r--r--clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp8
2 files changed, 9 insertions, 3 deletions
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<std::unique_ptr<DirectoryWatcher>> clang::DirectoryWatcher::creat
StringRef Path,
std::function<void(llvm::ArrayRef<DirectoryWatcher::Event>, 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)
diff --git a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
index 473bda7cd93..0a7a0eaef0b 100644
--- a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
+++ b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
@@ -150,7 +150,8 @@ FSEventStreamRef createFSEventStream(
StringRef Path,
std::function<void(llvm::ArrayRef<DirectoryWatcher::Event>, bool)> Receiver,
dispatch_queue_t Queue) {
- assert(!Path.empty() && "Path.empty()");
+ if (Path.empty())
+ return nullptr;
CFMutableArrayRef PathsToWatch = [&]() {
CFMutableArrayRef PathsToWatch =
@@ -208,7 +209,10 @@ llvm::Expected<std::unique_ptr<DirectoryWatcher>> clang::DirectoryWatcher::creat
dispatch_queue_t Queue =
dispatch_queue_create("DirectoryWatcher", DISPATCH_QUEUE_SERIAL);
- assert(!Path.empty() && "Path.empty()");
+ if (Path.empty())
+ llvm::report_fatal_error(
+ "DirectoryWatcher::create can not accept an empty Path.");
+
auto EventStream = createFSEventStream(Path, Receiver, Queue);
assert(EventStream && "EventStream expected to be non-null");
OpenPOWER on IntegriCloud