mirror of
https://github.com/apple/swift.git
synced 2026-02-27 18:26:24 +01:00
Revert "[DependencyScan] Correct setup clang VFS for dependency scanning"
This reverts commit e0e69f7ac0. This
causes flaky tests ScanDependencies/scanner_api_working_dir.swift.
rdar://167742034
This commit is contained in:
@@ -195,16 +195,15 @@ static std::vector<std::string> inputSpecificClangScannerCommand(
|
||||
|
||||
static llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
|
||||
getClangScanningFS(std::shared_ptr<llvm::cas::ObjectStore> cas,
|
||||
ASTContext &ctx, llvm::StringSaver &saver) {
|
||||
auto *importer = static_cast<ClangImporter *>(ctx.getClangModuleLoader());
|
||||
// Dependency scanner needs to create its own file system per worker.
|
||||
auto fs = ClangImporter::computeClangImporterFileSystem(
|
||||
ctx, importer->getClangFileMapping(),
|
||||
llvm::vfs::createPhysicalFileSystem(), true, &saver);
|
||||
ASTContext &ctx) {
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> baseFileSystem =
|
||||
llvm::vfs::createPhysicalFileSystem();
|
||||
ClangInvocationFileMapping fileMapping =
|
||||
applyClangInvocationMapping(ctx, nullptr, baseFileSystem, false);
|
||||
|
||||
if (cas)
|
||||
return llvm::cas::createCASProvidingFileSystem(cas, fs);
|
||||
return fs;
|
||||
return llvm::cas::createCASProvidingFileSystem(cas, baseFileSystem);
|
||||
return baseFileSystem;
|
||||
}
|
||||
|
||||
ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
|
||||
@@ -218,10 +217,8 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
|
||||
llvm::PrefixMapper *Mapper)
|
||||
: workerCompilerInvocation(
|
||||
std::make_unique<CompilerInvocation>(ScanCompilerInvocation)),
|
||||
clangScanningTool(
|
||||
*globalScanningService.ClangScanningService,
|
||||
getClangScanningFS(CAS, ScanASTContext,
|
||||
globalScanningService.getStringSaver())),
|
||||
clangScanningTool(*globalScanningService.ClangScanningService,
|
||||
getClangScanningFS(CAS, ScanASTContext)),
|
||||
CAS(CAS), ActionCache(ActionCache),
|
||||
diagnosticReporter(DiagnosticReporter) {
|
||||
// Instantiate a worker-specific diagnostic engine and copy over
|
||||
@@ -2100,16 +2097,10 @@ ModuleDependencyInfo ModuleDependencyScanner::bridgeClangModuleDependency(
|
||||
invocation.getMutCASOpts() = clang::CASOptions();
|
||||
invocation.getMutFrontendOpts().CASIncludeTreeID.clear();
|
||||
|
||||
// FIXME: workaround for rdar://105684525: find the -ivfsoverlay option
|
||||
// from clang scanner and pass to swift.
|
||||
if (!ScanASTContext.CASOpts.EnableCaching) {
|
||||
auto &overlayFiles = invocation.getMutHeaderSearchOpts().VFSOverlayFiles;
|
||||
|
||||
// clang system overlay file is a virtual file that is not an actual file.
|
||||
auto clangSystemOverlayFile =
|
||||
ClangImporter::getClangSystemOverlayFile(ScanASTContext.SearchPathOpts);
|
||||
llvm::erase(overlayFiles, clangSystemOverlayFile);
|
||||
|
||||
// FIXME: workaround for rdar://105684525: find the -ivfsoverlay option
|
||||
// from clang scanner and pass to swift.
|
||||
for (auto overlay : overlayFiles) {
|
||||
swiftArgs.push_back("-vfsoverlay");
|
||||
swiftArgs.push_back(overlay);
|
||||
|
||||
Reference in New Issue
Block a user