Skip to content

Commit 7d702e4

Browse files
committed
Use default CacheNegativeStats setting except where required.
1 parent 3b00dc8 commit 7d702e4

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ TEST(DependencyScanner, ScanDepsWithFS) {
239239
ScanningMode::DependencyDirectivesScan, ScanningOutputFormat::Make,
240240
CASOptions(), nullptr, nullptr, nullptr, ScanningOptimizations::Default,
241241
/*EagerLoadModules=*/false,
242-
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
243-
true);
242+
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()));
244243
DependencyScanningTool ScanTool(Service, VFS);
245244

246245
std::string DepFile;
@@ -266,8 +265,7 @@ TEST(DependencyScanner, DepScanFSWithCASProvider) {
266265
ScanningMode::DependencyDirectivesScan, ScanningOutputFormat::Make,
267266
CASOptions(), nullptr, nullptr, nullptr, ScanningOptimizations::Default,
268267
/*EagerLoadModules=*/false,
269-
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
270-
true);
268+
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()));
271269
{
272270
DependencyScanningWorkerFilesystem DepFS(Service, std::move(CASFS));
273271
llvm::ErrorOr<std::unique_ptr<llvm::vfs::File>> File =
@@ -357,8 +355,7 @@ TEST(DependencyScanner, ScanDepsWithModuleLookup) {
357355
ScanningMode::DependencyDirectivesScan, ScanningOutputFormat::Make,
358356
CASOptions(), nullptr, nullptr, nullptr, ScanningOptimizations::Default,
359357
/*EagerLoadModules=*/false,
360-
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
361-
true);
358+
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()));
362359
DependencyScanningTool ScanTool(Service, InterceptFS);
363360

364361
// This will fail with "fatal error: module 'Foo' not found" but it doesn't
@@ -393,8 +390,7 @@ TEST(DependencyScanner, ScanDepsWithDiagConsumer) {
393390
ScanningMode::DependencyDirectivesScan, ScanningOutputFormat::Make,
394391
CASOptions(), nullptr, nullptr, nullptr, ScanningOptimizations::Default,
395392
/*EagerLoadModules=*/false,
396-
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
397-
true);
393+
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()));
398394
DependencyScanningWorker Worker(Service, VFS);
399395

400396
llvm::DenseSet<ModuleID> AlreadySeen;
@@ -480,8 +476,9 @@ TEST(DependencyScanner, NoNegativeCache) {
480476
DependencyScanningService Service(
481477
ScanningMode::DependencyDirectivesScan, ScanningOutputFormat::Make,
482478
CASOptions(), nullptr, nullptr, nullptr, ScanningOptimizations::All,
483-
false, false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
484-
false);
479+
/*EagerLoadModules=*/false,
480+
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
481+
/*CacheNegativeStats=*/false);
485482
DependencyScanningTool ScanTool(Service, VFS);
486483

487484
std::vector<std::string> CommandLine0 = {"clang",

clang/unittests/Tooling/DependencyScanning/DependencyScanningFilesystemTest.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ TEST(DependencyScanningWorkerFilesystem, CacheStatusFailures) {
2828
clang::CASOptions(), nullptr, nullptr, nullptr,
2929
ScanningOptimizations::Default, /*EagerLoadModules=*/false,
3030
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
31-
true);
31+
/*CacheNegativeStats=*/true);
3232
DependencyScanningWorkerFilesystem DepFS(Service, InstrumentingFS);
3333
DependencyScanningWorkerFilesystem DepFS2(Service, InstrumentingFS);
3434

@@ -59,7 +59,7 @@ TEST(DependencyScanningFilesystem, CacheGetRealPath) {
5959
clang::CASOptions(), nullptr, nullptr, nullptr,
6060
ScanningOptimizations::Default, /*EagerLoadModules=*/false,
6161
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
62-
true);
62+
/*CacheNegativeStats=*/true);
6363
DependencyScanningWorkerFilesystem DepFS(Service, InstrumentingFS);
6464
DependencyScanningWorkerFilesystem DepFS2(Service, InstrumentingFS);
6565

@@ -98,8 +98,7 @@ TEST(DependencyScanningFilesystem, RealPathAndStatusInvariants) {
9898
ScanningMode::DependencyDirectivesScan, ScanningOutputFormat::Make,
9999
clang::CASOptions(), nullptr, nullptr, nullptr,
100100
ScanningOptimizations::Default, /*EagerLoadModules=*/false,
101-
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
102-
true);
101+
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()));
103102
DependencyScanningWorkerFilesystem DepFS(Service, InMemoryFS);
104103

105104
// Success.
@@ -157,7 +156,7 @@ TEST(DependencyScanningFilesystem, CacheStatOnExists) {
157156
clang::CASOptions(), nullptr, nullptr, nullptr,
158157
ScanningOptimizations::Default, /*EagerLoadModules=*/false,
159158
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
160-
true);
159+
/*CacheNegativeStats=*/true);
161160
DependencyScanningWorkerFilesystem DepFS(Service, InstrumentingFS);
162161

163162
DepFS.status("/foo");
@@ -185,7 +184,7 @@ TEST(DependencyScanningFilesystem, CacheStatFailures) {
185184
clang::CASOptions(), nullptr, nullptr, nullptr,
186185
ScanningOptimizations::Default, /*EagerLoadModules=*/false,
187186
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
188-
true);
187+
/*CacheNegativeStats=*/true);
189188
DependencyScanningWorkerFilesystem DepFS(Service, InstrumentingFS);
190189

191190
DepFS.status("/dir");
@@ -217,7 +216,7 @@ TEST(DependencyScanningFilesystem, DiagnoseStaleStatFailures) {
217216
clang::CASOptions(), nullptr, nullptr, nullptr,
218217
ScanningOptimizations::Default, /*EagerLoadModules=*/false,
219218
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
220-
true);
219+
/*CacheNegativeStats=*/true);
221220
DependencyScanningWorkerFilesystem DepFS(Service, InMemoryFS);
222221

223222
bool Path1Exists = DepFS.exists("/path1.suffix");
@@ -248,7 +247,7 @@ TEST(DependencyScanningFilesystem, DiagnoseCachedFileSizeChange) {
248247
clang::CASOptions(), nullptr, nullptr, nullptr,
249248
ScanningOptimizations::Default, /*EagerLoadModules=*/false,
250249
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()),
251-
true);
250+
/*CacheNegativeStats=*/true);
252251
DependencyScanningWorkerFilesystem DepFS(Service, InMemoryFS1);
253252

254253
InMemoryFS1->addFile("/path1.suffix", 0,
@@ -282,8 +281,12 @@ TEST(DependencyScanningFilesystem, DoNotDiagnoseDirSizeChange) {
282281
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS =
283282
llvm::vfs::createPhysicalFileSystem();
284283

285-
DependencyScanningFilesystemSharedCache SharedCache;
286-
DependencyScanningWorkerFilesystem DepFS(SharedCache, FS);
284+
DependencyScanningService Service(
285+
ScanningMode::DependencyDirectivesScan, ScanningOutputFormat::Make,
286+
clang::CASOptions(), nullptr, nullptr, nullptr,
287+
ScanningOptimizations::Default, /*EagerLoadModules=*/false,
288+
/*TraceVFS=*/false, llvm::sys::toTimeT(std::chrono::system_clock::now()));
289+
DependencyScanningWorkerFilesystem DepFS(Service, FS);
287290

288291
// Trigger the file system cache.
289292
ASSERT_EQ(DepFS.exists(Dir), true);
@@ -302,6 +305,6 @@ TEST(DependencyScanningFilesystem, DoNotDiagnoseDirSizeChange) {
302305
}
303306

304307
// We do not report directory size changes.
305-
auto InvalidEntries = SharedCache.getOutOfDateEntries(*FS);
308+
auto InvalidEntries = Service.getSharedCache().getOutOfDateEntries(*FS);
306309
EXPECT_EQ(InvalidEntries.size(), 0u);
307310
}

0 commit comments

Comments
 (0)