[clang] cfb4f8c - [DirectoryWatcher] Do not use FSEvents on non-macOS platforms
Vedant Kumar via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 23 10:23:58 PDT 2020
Author: Vedant Kumar
Date: 2020-04-23T10:22:28-07:00
New Revision: cfb4f8c5fbc6fd8ad06bcfc6f91926b6d55d3766
URL: https://github.com/llvm/llvm-project/commit/cfb4f8c5fbc6fd8ad06bcfc6f91926b6d55d3766
DIFF: https://github.com/llvm/llvm-project/commit/cfb4f8c5fbc6fd8ad06bcfc6f91926b6d55d3766.diff
LOG: [DirectoryWatcher] Do not use FSEvents on non-macOS platforms
The FSEvents APIs are available on iOS6+: however, the DirectoryWatcher
code isn't wired up to really use FSEvents on embedded platforms.
I've duplicated code from DirectoryWatcher-not-implemented.cpp here and
used TargetConditionals instead of adding cmakery to check try_compile;
I couldn't get that to work properly.
Added:
Modified:
clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
Removed:
################################################################################
diff --git a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
index 7864fb76d160..bdc389516289 100644
--- a/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
+++ b/clang/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
@@ -14,10 +14,13 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/Path.h"
#include <CoreServices/CoreServices.h>
+#include <TargetConditionals.h>
using namespace llvm;
using namespace clang;
+#if TARGET_OS_OSX
+
static void stopFSEventStream(FSEventStreamRef);
namespace {
@@ -249,3 +252,17 @@ llvm::Expected<std::unique_ptr<DirectoryWatcher>> clang::DirectoryWatcher::creat
return Result;
}
+
+#else // TARGET_OS_OSX
+
+llvm::Expected<std::unique_ptr<DirectoryWatcher>>
+clang::DirectoryWatcher::create(
+ StringRef Path,
+ std::function<void(llvm::ArrayRef<DirectoryWatcher::Event>, bool)> Receiver,
+ bool WaitForInitialSync) {
+ return llvm::make_error<llvm::StringError>(
+ "DirectoryWatcher is not implemented for this platform!",
+ llvm::inconvertibleErrorCode());
+}
+
+#endif // TARGET_OS_OSX
More information about the cfe-commits
mailing list