summaryrefslogtreecommitdiff
path: root/clang/include
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2023-05-15 14:24:08 -0700
committerJan Svoboda <jan_svoboda@apple.com>2023-05-15 17:43:53 -0700
commit09c5d69592f7df4db62063e4dd231a7e154bdac6 (patch)
treef2a081ea1b5b3cbf3492801a401bf52dab2719c0 /clang/include
parent692ae97ae71d62ce51d784681a0481fb54343fc1 (diff)
downloadllvm-09c5d69592f7df4db62063e4dd231a7e154bdac6.tar.gz
Revert "[clang][deps] Only cache files with specific extension"
This reverts commit d1e00b6f136ec71a4c95a7eb4fd81ec0ab547962. Internally, there were issues with caching stat failures for .framework directories. We need some time for investigation to pinpoint what exactly was going wrong.
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h41
1 files changed, 7 insertions, 34 deletions
diff --git a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
index 357a5b942300..4b4e3c7eb2ec 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
@@ -269,32 +269,6 @@ public:
}
};
-enum class ScanFile { Yes, No };
-enum class CacheStatFailure { Yes, No };
-
-struct PathPolicy {
- /// Implies caching of all open and stat results.
- unsigned Enable : 1;
- /// Controls whether a file will be scanned for dependency directives.
- unsigned ScanFile : 1;
- /// Explicitly disables stat failure caching when false.
- unsigned CacheStatFailure : 1;
-
- static PathPolicy fallThrough() { return {false, false, false}; }
-
- static PathPolicy cache(enum ScanFile SF,
- enum CacheStatFailure CSF = CacheStatFailure::Yes) {
- return {true, SF == ScanFile::Yes, CSF == CacheStatFailure::Yes};
- }
-
-private:
- PathPolicy(bool E, bool SF, bool CSF)
- : Enable(E), ScanFile(SF), CacheStatFailure(CSF) {}
-};
-
-/// Determine caching and scanning behavior based on file extension.
-PathPolicy getPolicy(StringRef Filename);
-
/// A virtual file system optimized for the dependency discovery.
///
/// It is primarily designed to work with source files whose contents was
@@ -319,25 +293,24 @@ public:
///
/// Attempts to use the local and shared caches first, then falls back to
/// using the underlying filesystem.
- llvm::ErrorOr<EntryRef> getOrCreateFileSystemEntry(StringRef Filename) {
- return getOrCreateFileSystemEntry(Filename, getPolicy(Filename));
- }
+ llvm::ErrorOr<EntryRef>
+ getOrCreateFileSystemEntry(StringRef Filename,
+ bool DisableDirectivesScanning = false);
private:
- /// Same as the public version, but with explicit PathPolicy parameter.
- llvm::ErrorOr<EntryRef> getOrCreateFileSystemEntry(StringRef Filename,
- PathPolicy Policy);
+ /// Check whether the file should be scanned for preprocessor directives.
+ bool shouldScanForDirectives(StringRef Filename);
/// For a filename that's not yet associated with any entry in the caches,
/// uses the underlying filesystem to either look up the entry based in the
/// shared cache indexed by unique ID, or creates new entry from scratch.
llvm::ErrorOr<const CachedFileSystemEntry &>
- computeAndStoreResult(StringRef Filename, PathPolicy Policy);
+ computeAndStoreResult(StringRef Filename);
/// Scan for preprocessor directives for the given entry if necessary and
/// returns a wrapper object with reference semantics.
EntryRef scanForDirectivesIfNecessary(const CachedFileSystemEntry &Entry,
- StringRef Filename, PathPolicy Policy);
+ StringRef Filename, bool Disable);
/// Represents a filesystem entry that has been stat-ed (and potentially read)
/// and that's about to be inserted into the cache as `CachedFileSystemEntry`.