summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/clang/lib/Basic/FileSystemStatCache.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-01-27 16:42:12 +0000
committerpatrick <patrick@openbsd.org>2019-01-27 16:42:12 +0000
commitb773203fb58f3ef282fb69c832d8710cab5bc82d (patch)
treee75913f147570fbd75169647b144df85b88a038c /gnu/llvm/tools/clang/lib/Basic/FileSystemStatCache.cpp
parenttweak errno in previous (diff)
downloadwireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz
wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Basic/FileSystemStatCache.cpp')
-rw-r--r--gnu/llvm/tools/clang/lib/Basic/FileSystemStatCache.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/gnu/llvm/tools/clang/lib/Basic/FileSystemStatCache.cpp b/gnu/llvm/tools/clang/lib/Basic/FileSystemStatCache.cpp
index 799df1d3c3a..f5856cb6542 100644
--- a/gnu/llvm/tools/clang/lib/Basic/FileSystemStatCache.cpp
+++ b/gnu/llvm/tools/clang/lib/Basic/FileSystemStatCache.cpp
@@ -1,4 +1,4 @@
-//===--- FileSystemStatCache.cpp - Caching for 'stat' calls ---------------===//
+//===- FileSystemStatCache.cpp - Caching for 'stat' calls -----------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,11 +13,14 @@
#include "clang/Basic/FileSystemStatCache.h"
#include "clang/Basic/VirtualFileSystem.h"
+#include "llvm/Support/Chrono.h"
+#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/Path.h"
+#include <utility>
using namespace clang;
-void FileSystemStatCache::anchor() { }
+void FileSystemStatCache::anchor() {}
static void copyStatusToFileData(const vfs::Status &Status,
FileData &Data) {
@@ -92,17 +95,17 @@ bool FileSystemStatCache::get(StringRef Path, FileData &Data, bool isFile,
// If the path doesn't exist, return failure.
if (R == CacheMissing) return true;
-
+
// If the path exists, make sure that its "directoryness" matches the clients
// demands.
if (Data.IsDirectory != isForDir) {
// If not, close the file if opened.
if (F)
*F = nullptr;
-
+
return true;
}
-
+
return false;
}
@@ -117,7 +120,7 @@ MemorizeStatCalls::getStat(StringRef Path, FileData &Data, bool isFile,
// entries).
if (Result == CacheMissing)
return Result;
-
+
// Cache file 'stat' results and directories with absolutely paths.
if (!Data.IsDirectory || llvm::sys::path::is_absolute(Path))
StatCalls[Path] = Data;