clang 23.0.0git
DependencyScanningService.cpp
Go to the documentation of this file.
1//===- DependencyScanningService.cpp - Scanning Service -------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
11#include "llvm/Support/Chrono.h"
12#include "llvm/Support/Process.h"
13
14using namespace clang;
15using namespace dependencies;
16
18 if (std::optional<std::string> MaybeNegStats =
19 llvm::sys::Process::GetEnv("CLANG_SCAN_CACHE_NEGATIVE_STATS")) {
20 if (MaybeNegStats->empty())
21 return true;
22 return llvm::StringSwitch<bool>(*MaybeNegStats)
23 .Case("1", true)
24 .Case("0", false)
25 .Default(false);
26 }
27 return false;
28}
29
30// Negative caching directories can cause build failures due to incorrectly
31// configured projects.
33 StringRef Ext = llvm::sys::path::extension(Path);
34 if (Ext.empty())
35 return false;
36 if (Ext == ".framework")
37 return false;
38 return true;
39}
40
42 : MakeVFS([] { return llvm::vfs::createPhysicalFileSystem(); }),
43 BuildSessionTimestamp(
44 llvm::sys::toTimeT(std::chrono::system_clock::now())) {}
bool shouldCacheNegativeStatsForPath(StringRef Path)
The JSON file list parser is used to communicate input to InstallAPI.
std::function< IntrusiveRefCntPtr< llvm::vfs::FileSystem >()> MakeVFS
The function invoked to create each worker's VFS.