Skip to content

Commit 36be4d2

Browse files
authored
Remove Clang CASFS (swiftlang#86973)
1 parent 68f615a commit 36be4d2

File tree

10 files changed

+12
-49
lines changed

10 files changed

+12
-49
lines changed

include/swift-c/DependencyScan/DependencyScan.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ swiftscan_clang_detail_get_command_line(swiftscan_module_details_t details);
339339
SWIFTSCAN_PUBLIC swiftscan_string_set_t *
340340
swiftscan_clang_detail_get_captured_pcm_args(swiftscan_module_details_t details);
341341

342+
// DEPRECATED
342343
SWIFTSCAN_PUBLIC swiftscan_string_ref_t
343344
swiftscan_clang_detail_get_cas_fs_root_id(swiftscan_module_details_t details);
344345

include/swift/AST/ModuleDependencies.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,6 @@ class ClangModuleDependencyStorage : public ModuleDependencyInfoStorageBase {
548548
/// The file dependencies
549549
const std::vector<std::string> fileDependencies;
550550

551-
/// CASID for the Root of CASFS. Empty if CAS is not used.
552-
std::string CASFileSystemRootID;
553-
554551
/// CASID for the Root of ClangIncludeTree. Empty if not used.
555552
std::string CASClangIncludeTreeRootID;
556553

@@ -562,7 +559,6 @@ class ClangModuleDependencyStorage : public ModuleDependencyInfoStorageBase {
562559
ArrayRef<std::string> buildCommandLine,
563560
ArrayRef<std::string> fileDependencies,
564561
ArrayRef<LinkLibrary> linkLibraries,
565-
StringRef CASFileSystemRootID,
566562
StringRef clangIncludeTreeRoot,
567563
StringRef moduleCacheKey, bool IsSystem)
568564
: ModuleDependencyInfoStorageBase(ModuleDependencyKind::Clang,
@@ -571,7 +567,6 @@ class ClangModuleDependencyStorage : public ModuleDependencyInfoStorageBase {
571567
pcmOutputPath(pcmOutputPath), mappedPCMPath(mappedPCMPath),
572568
moduleMapFile(moduleMapFile), contextHash(contextHash),
573569
buildCommandLine(buildCommandLine), fileDependencies(fileDependencies),
574-
CASFileSystemRootID(CASFileSystemRootID),
575570
CASClangIncludeTreeRootID(clangIncludeTreeRoot), IsSystem(IsSystem) {}
576571

577572
ModuleDependencyInfoStorageBase *clone() const override {
@@ -679,12 +674,12 @@ class ModuleDependencyInfo {
679674
StringRef pcmOutputPath, StringRef mappedPCMPath, StringRef moduleMapFile,
680675
StringRef contextHash, ArrayRef<std::string> nonPathCommandLine,
681676
ArrayRef<std::string> fileDependencies,
682-
ArrayRef<LinkLibrary> linkLibraries, StringRef CASFileSystemRootID,
683-
StringRef clangIncludeTreeRoot, StringRef moduleCacheKey, bool IsSystem) {
677+
ArrayRef<LinkLibrary> linkLibraries, StringRef clangIncludeTreeRoot,
678+
StringRef moduleCacheKey, bool IsSystem) {
684679
return ModuleDependencyInfo(std::make_unique<ClangModuleDependencyStorage>(
685680
pcmOutputPath, mappedPCMPath, moduleMapFile, contextHash,
686681
nonPathCommandLine, fileDependencies, linkLibraries,
687-
CASFileSystemRootID, clangIncludeTreeRoot, moduleCacheKey, IsSystem));
682+
clangIncludeTreeRoot, moduleCacheKey, IsSystem));
688683
}
689684

690685
/// Retrieve the module-level imports.
@@ -884,9 +879,6 @@ class ModuleDependencyInfo {
884879
else if (isSwiftSourceModule())
885880
cast<SwiftSourceModuleDependenciesStorage>(storage.get())
886881
->textualModuleDetails.CASFileSystemRootID = rootID;
887-
else if (isClangModule())
888-
cast<ClangModuleDependencyStorage>(storage.get())->CASFileSystemRootID =
889-
rootID;
890882
else
891883
llvm_unreachable("Unexpected module dependency kind");
892884
}

include/swift/DependencyScan/DependencyScanImpl.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,6 @@ typedef struct {
205205
/// Options to the compile command required to build this clang modulemap
206206
swiftscan_string_set_t *command_line;
207207

208-
/// The CASID for CASFileSystemRoot
209-
swiftscan_string_ref_t cas_fs_root_id;
210-
211208
/// The CASID for CASFileSystemRoot
212209
swiftscan_string_ref_t clang_include_tree;
213210

include/swift/DependencyScan/SerializedModuleDependencyCacheFormat.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ using llvm::BCVBR;
4141
const unsigned char MODULE_DEPENDENCY_CACHE_FORMAT_SIGNATURE[] = {'I', 'M', 'D','C'};
4242
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MAJOR = 10;
4343
/// Increment this on every change.
44-
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MINOR = 5;
44+
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MINOR = 6;
4545

4646
/// Various identifiers in this format will rely on having their strings mapped
4747
/// using this ID.
@@ -293,7 +293,6 @@ using ClangModuleDetailsLayout =
293293
ContextHashIDField, // contextHash
294294
FlagIDArrayIDField, // commandLine
295295
FileIDArrayIDField, // fileDependencies
296-
IdentifierIDField, // CASFileSystemRootID
297296
IdentifierIDField, // clangIncludeTreeRoot
298297
IdentifierIDField, // moduleCacheKey
299298
IsSystemField // isSystem

lib/AST/ModuleDependencies.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,6 @@ std::optional<std::string> ModuleDependencyInfo::getCASFSRootID() const {
321321
Root = swiftSourceStorage->textualModuleDetails.CASFileSystemRootID;
322322
break;
323323
}
324-
case swift::ModuleDependencyKind::Clang: {
325-
auto clangModuleStorage = cast<ClangModuleDependencyStorage>(storage.get());
326-
Root = clangModuleStorage->CASFileSystemRootID;
327-
break;
328-
}
329324
default:
330325
return std::nullopt;
331326
}
@@ -518,11 +513,10 @@ SwiftDependencyScanningService::SwiftDependencyScanningService()
518513
: Alloc(), Saver(Alloc) {
519514
ClangScanningService.emplace(
520515
clang::tooling::dependencies::ScanningMode::DependencyDirectivesScan,
521-
clang::tooling::dependencies::ScanningOutputFormat::FullTree,
516+
clang::tooling::dependencies::ScanningOutputFormat::Full,
522517
clang::CASOptions(),
523518
/* CAS (llvm::cas::ObjectStore) */ nullptr,
524519
/* Cache (llvm::cas::ActionCache) */ nullptr,
525-
/* SharedFS */ nullptr,
526520
// ScanningOptimizations::Default excludes the current working
527521
// directory optimization. Clang needs to communicate with
528522
// the build system to handle the optimization safely.
@@ -656,7 +650,6 @@ bool SwiftDependencyScanningService::setupCachingDependencyScanningService(
656650
clang::tooling::dependencies::ScanningOutputFormat::FullIncludeTree,
657651
Instance.getInvocation().getCASOptions().CASOpts,
658652
Instance.getSharedCASInstance(), Instance.getSharedCacheInstance(),
659-
/*CachingOnDiskFileSystem=*/nullptr,
660653
// The current working directory optimization (off by default)
661654
// should not impact CAS. We set the optization to all to be
662655
// consistent with the non-CAS case.

lib/DependencyScan/DependencyScanJSON.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -659,14 +659,9 @@ void writeJSON(llvm::raw_ostream &out,
659659

660660
// Command line.
661661
writeJSONSingleField(out, "commandLine", clangDeps->command_line, 5,
662-
clangDeps->cas_fs_root_id.length != 0 ||
663662
clangDeps->clang_include_tree.length != 0 ||
664663
clangDeps->module_cache_key.length != 0);
665664

666-
if (clangDeps->cas_fs_root_id.length != 0)
667-
writeJSONSingleField(out, "casFSRootID", clangDeps->cas_fs_root_id, 5,
668-
clangDeps->clang_include_tree.length != 0 ||
669-
clangDeps->module_cache_key.length != 0);
670665
if (clangDeps->clang_include_tree.length != 0)
671666
writeJSONSingleField(out, "clangIncludeTree",
672667
clangDeps->clang_include_tree, 5,

lib/DependencyScan/ModuleDependencyCacheSerialization.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -773,14 +773,12 @@ bool ModuleDependenciesCacheDeserializer::readGraph(
773773
if (!hasCurrentModule)
774774
llvm::report_fatal_error("Unexpected CLANG_MODULE_DETAILS_NODE record");
775775
unsigned pcmOutputPathID, mappedPCMPathID, moduleMapPathID, contextHashID,
776-
commandLineArrayID, fileDependenciesArrayID,
777-
CASFileSystemRootID, clangIncludeTreeRootID, moduleCacheKeyID,
778-
isSystem;
776+
commandLineArrayID, fileDependenciesArrayID, clangIncludeTreeRootID,
777+
moduleCacheKeyID, isSystem;
779778
ClangModuleDetailsLayout::readRecord(
780779
Scratch, pcmOutputPathID, mappedPCMPathID, moduleMapPathID,
781780
contextHashID, commandLineArrayID, fileDependenciesArrayID,
782-
CASFileSystemRootID, clangIncludeTreeRootID,
783-
moduleCacheKeyID, isSystem);
781+
clangIncludeTreeRootID, moduleCacheKeyID, isSystem);
784782
auto pcmOutputPath = getIdentifier(pcmOutputPathID);
785783
if (!pcmOutputPath)
786784
llvm::report_fatal_error("Bad pcm output path");
@@ -799,9 +797,6 @@ bool ModuleDependenciesCacheDeserializer::readGraph(
799797
auto fileDependencies = getStringArray(fileDependenciesArrayID);
800798
if (!fileDependencies)
801799
llvm::report_fatal_error("Bad file dependencies");
802-
auto rootFileSystemID = getIdentifier(CASFileSystemRootID);
803-
if (!rootFileSystemID)
804-
llvm::report_fatal_error("Bad CASFileSystem RootID");
805800
auto clangIncludeTreeRoot = getIdentifier(clangIncludeTreeRootID);
806801
if (!clangIncludeTreeRoot)
807802
llvm::report_fatal_error("Bad clang include tree ID");
@@ -813,7 +808,7 @@ bool ModuleDependenciesCacheDeserializer::readGraph(
813808
auto moduleDep = ModuleDependencyInfo::forClangModule(
814809
*pcmOutputPath, *mappedPCMPath, *moduleMapPath, *contextHash,
815810
*commandLineArgs, *fileDependencies, linkLibraries,
816-
*rootFileSystemID, *clangIncludeTreeRoot, *moduleCacheKey, isSystem);
811+
*clangIncludeTreeRoot, *moduleCacheKey, isSystem);
817812
addCommonDependencyInfo(moduleDep);
818813

819814
cache.recordDependency(currentModuleName, std::move(moduleDep));
@@ -1692,7 +1687,6 @@ void ModuleDependenciesCacheSerializer::writeModuleInfo(
16921687
ModuleIdentifierArrayKind::NonPathCommandLine),
16931688
getIdentifierArrayID(moduleID,
16941689
ModuleIdentifierArrayKind::FileDependencies),
1695-
getIdentifier(clangDeps->CASFileSystemRootID),
16961690
getIdentifier(clangDeps->CASClangIncludeTreeRootID),
16971691
getIdentifier(clangDeps->moduleCacheKey), clangDeps->IsSystem);
16981692

@@ -1982,7 +1976,6 @@ void ModuleDependenciesCacheSerializer::collectStringsAndArrays(
19821976
clangDeps->buildCommandLine);
19831977
addStringArray(moduleID, ModuleIdentifierArrayKind::FileDependencies,
19841978
clangDeps->fileDependencies);
1985-
addIdentifier(clangDeps->CASFileSystemRootID);
19861979
addIdentifier(clangDeps->CASClangIncludeTreeRootID);
19871980
addIdentifier(clangDeps->moduleCacheKey);
19881981
break;

lib/DependencyScan/ModuleDependencyScanner.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,11 +2170,6 @@ ModuleDependencyInfo ModuleDependencyScanner::bridgeClangModuleDependency(
21702170
auto clangArgs = invocation.getCC1CommandLine();
21712171
llvm::for_each(clangArgs, addClangArg);
21722172

2173-
// CASFileSystemRootID.
2174-
std::string RootID = clangModuleDep.CASFileSystemRootID
2175-
? clangModuleDep.CASFileSystemRootID.value()
2176-
: "";
2177-
21782173
std::string IncludeTree =
21792174
clangModuleDep.IncludeTreeID ? *clangModuleDep.IncludeTreeID : "";
21802175

@@ -2198,7 +2193,7 @@ ModuleDependencyInfo ModuleDependencyScanner::bridgeClangModuleDependency(
21982193
llvm::StringSet<> alreadyAddedModules;
21992194
auto bridgedDependencyInfo = ModuleDependencyInfo::forClangModule(
22002195
pcmPath, mappedPCMPath, clangModuleDep.ClangModuleMapFile,
2201-
clangModuleDep.ID.ContextHash, swiftArgs, fileDeps, LinkLibraries, RootID,
2196+
clangModuleDep.ID.ContextHash, swiftArgs, fileDeps, LinkLibraries,
22022197
IncludeTree, /*module-cache-key*/ "", clangModuleDep.IsSystem);
22032198

22042199
std::vector<ModuleDependencyID> directDependencyIDs;

lib/DependencyScan/ScanDependencies.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,6 @@ static swiftscan_dependency_graph_t generateFullDependencyGraph(
913913
create_clone(clangDeps->moduleMapFile.c_str()),
914914
create_clone(clangDeps->contextHash.c_str()),
915915
create_set(clangDeps->buildCommandLine),
916-
create_clone(clangDeps->CASFileSystemRootID.c_str()),
917916
create_clone(clangDeps->CASClangIncludeTreeRootID.c_str()),
918917
create_clone(clangDeps->moduleCacheKey.c_str())};
919918
}

lib/Tooling/libSwiftScan/libSwiftScan.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ void swiftscan_dependency_info_details_dispose(
9797
swiftscan_string_dispose(details_impl->clang_details.module_map_path);
9898
swiftscan_string_dispose(details_impl->clang_details.context_hash);
9999
swiftscan_string_set_dispose(details_impl->clang_details.command_line);
100-
swiftscan_string_dispose(details_impl->clang_details.cas_fs_root_id);
101100
swiftscan_string_dispose(details_impl->clang_details.module_cache_key);
102101
break;
103102
}
@@ -463,7 +462,7 @@ swiftscan_clang_detail_get_command_line(swiftscan_module_details_t details) {
463462

464463
swiftscan_string_ref_t
465464
swiftscan_clang_detail_get_cas_fs_root_id(swiftscan_module_details_t details) {
466-
return details->clang_details.cas_fs_root_id;
465+
return swift::c_string_utils::create_null();
467466
}
468467

469468
swiftscan_string_ref_t swiftscan_clang_detail_get_module_cache_key(

0 commit comments

Comments
 (0)