#include "DirectoryScanner.h"
#include "clang/DirectoryWatcher/DirectoryWatcher.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Path.h"
#include <atomic>
#include <condition_variable>
#include <mutex>
#include <queue>
#include <string>
#include <thread>
#include <vector>
#include <fcntl.h>
#include <limits.h>
#include <optional>
#include <sys/epoll.h>
#include <sys/inotify.h>
#include <unistd.h>
namespace {
usingnamespacellvm;
usingnamespaceclang;
struct SemaphorePipe { … };
class EventQueue { … };
class DirectoryWatcherLinux : public clang::DirectoryWatcher { … };
void DirectoryWatcherLinux::InotifyPollingLoop() { … }
void DirectoryWatcherLinux::InitialScan() { … }
void DirectoryWatcherLinux::EventReceivingLoop() { … }
DirectoryWatcherLinux::DirectoryWatcherLinux(
StringRef WatchedDirPath,
std::function<void(llvm::ArrayRef<Event>, bool)> Receiver,
bool WaitForInitialSync, int InotifyFD, int InotifyWD,
SemaphorePipe &&InotifyPollingStopSignal)
: … { … }
}
llvm::Expected<std::unique_ptr<DirectoryWatcher>> clang::DirectoryWatcher::create(
StringRef Path,
std::function<void(llvm::ArrayRef<DirectoryWatcher::Event>, bool)> Receiver,
bool WaitForInitialSync) { … }