Skip to content

Commit 0f54a18

Browse files
authored
Merge pull request #8662 from apple/artemcm/Swift6-NoNegativeFrameworkStatCachingWorkaround
Temporarily disable negative `stat` caching for `.framework` directories
2 parents a8b8b0e + 6712a1b commit 0f54a18

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

clang/lib/Tooling/DependencyScanning/DependencyScanningCASFilesystem.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,19 @@ static bool shouldCacheStatFailures(StringRef Filename) {
204204
StringRef Ext = llvm::sys::path::extension(Filename);
205205
if (Ext.empty())
206206
return false; // This may be the module cache directory.
207+
208+
// rdar://127079541
209+
// With Swift, misconfigured Xcode projects currently may fail with
210+
// negative 'stat' caching of `.framework` directories enabled,
211+
// because they do not always explicitly specify their target
212+
// dependencies and may be either getting lucky wih build timing, or
213+
// compiling against wrong dependenceis a lot of the time: e.g. an
214+
// SDK variant of a dependency module, instead of one in the
215+
// project's own build directory. Temporarily disable negative
216+
// 'stat' caching here until all such projects are fixed.
217+
if (Ext == ".framework")
218+
return false;
219+
207220
return true;
208221
}
209222

clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,19 @@ static bool shouldCacheStatFailures(StringRef Filename) {
211211
StringRef Ext = llvm::sys::path::extension(Filename);
212212
if (Ext.empty())
213213
return false; // This may be the module cache directory.
214+
215+
// rdar://127079541
216+
// With Swift, misconfigured Xcode projects currently may fail with
217+
// negative 'stat' caching of `.framework` directories enabled,
218+
// because they do not always explicitly specify their target
219+
// dependencies and may be either getting lucky wih build timing, or
220+
// compiling against wrong dependenceis a lot of the time: e.g. an
221+
// SDK variant of a dependency module, instead of one in the
222+
// project's own build directory. Temporarily disable negative
223+
// 'stat' caching here until all such projects are fixed.
224+
if (Ext == ".framework")
225+
return false;
226+
214227
return true;
215228
}
216229

0 commit comments

Comments
 (0)