@@ -311,9 +311,9 @@ StringRef StdlibGroupsIndexRecordingConsumer::findGroupForSymbol(const IndexSymb
311311}
312312
313313static bool writeRecord (SymbolTracker &record, std::string Filename,
314- std::string indexStorePath, DiagnosticEngine *diags,
314+ std::string indexStorePath, bool compress, DiagnosticEngine *diags,
315315 std::string &outRecordFile) {
316- IndexRecordWriter recordWriter (indexStorePath);
316+ IndexRecordWriter recordWriter (indexStorePath, compress );
317317 std::string error;
318318 auto result = recordWriter.beginRecord (
319319 Filename, record.hashRecord (), error, &outRecordFile);
@@ -360,25 +360,25 @@ static bool writeRecord(SymbolTracker &record, std::string Filename,
360360
361361static std::unique_ptr<IndexRecordingConsumer>
362362makeRecordingConsumer (std::string Filename, std::string indexStorePath,
363- bool includeLocals, DiagnosticEngine *diags,
363+ bool includeLocals, bool compress, DiagnosticEngine *diags,
364364 std::string *outRecordFile,
365365 bool *outFailed) {
366366 return std::make_unique<IndexRecordingConsumer>(includeLocals,
367367 [=](SymbolTracker &record) {
368- *outFailed = writeRecord (record, Filename, indexStorePath, diags,
368+ *outFailed = writeRecord (record, Filename, indexStorePath, compress, diags,
369369 *outRecordFile);
370370 });
371371}
372372
373373static bool
374374recordSourceFile (SourceFile *SF, StringRef indexStorePath,
375- bool includeLocals, DiagnosticEngine &diags,
375+ bool includeLocals, bool compress, DiagnosticEngine &diags,
376376 llvm::function_ref<void (StringRef, StringRef)> callback) {
377377 std::string recordFile;
378378 bool failed = false ;
379379 auto consumer =
380380 makeRecordingConsumer (SF->getFilename ().str (), indexStorePath.str (),
381- includeLocals, &diags, &recordFile, &failed);
381+ includeLocals, compress, &diags, &recordFile, &failed);
382382 indexSourceFile (SF, *consumer);
383383
384384 if (!failed && !recordFile.empty ())
@@ -418,6 +418,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
418418 bool indexSystemModules,
419419 bool skipStdlib,
420420 bool includeLocals,
421+ bool compress,
421422 bool explicitModulebuild,
422423 StringRef targetTriple,
423424 const clang::CompilerInstance &clangCI,
@@ -432,6 +433,7 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
432433 bool indexSystemModules,
433434 bool skipStdlib,
434435 bool includeLocals,
436+ bool compress,
435437 bool explicitModuleBuild,
436438 StringRef targetTriple,
437439 const clang::CompilerInstance &clangCI,
@@ -508,6 +510,7 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
508510 indexClangModules,
509511 indexSystemModules, skipStdlib,
510512 includeLocals,
513+ compress,
511514 explicitModuleBuild,
512515 targetTriple,
513516 clangCI, diags,
@@ -551,6 +554,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
551554 bool indexSystemModules,
552555 bool skipStdlib,
553556 bool includeLocals,
557+ bool compress,
554558 bool explicitModuleBuild,
555559 StringRef targetTriple,
556560 const clang::CompilerInstance &clangCI,
@@ -632,7 +636,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
632636 std::string recordFile;
633637 bool failed = false ;
634638 auto consumer = makeRecordingConsumer (filename.str (), indexStorePath.str (),
635- includeLocals, &diags, &recordFile, &failed);
639+ includeLocals, compress, &diags, &recordFile, &failed);
636640 indexModule (module , *consumer);
637641
638642 if (failed)
@@ -676,7 +680,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
676680 std::string outRecordFile;
677681 failed =
678682 failed || writeRecord (tracker, std::string (fileNameWithGroup.str ()),
679- indexStorePath.str (), &diags, outRecordFile);
683+ indexStorePath.str (), compress, &diags, outRecordFile);
680684 if (failed)
681685 return false ;
682686 records.emplace_back (outRecordFile, moduleName.str ().str ());
@@ -698,7 +702,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
698702 auto clangRemapper = pathRemapper.asClangPathRemapper ();
699703
700704 IndexUnitWriter unitWriter (
701- fileMgr, indexStorePath, " swift" , swiftVersion, filename, moduleName,
705+ fileMgr, indexStorePath, " swift" , swiftVersion, compress, filename, moduleName,
702706 /* MainFile=*/ {}, isSystem, /* IsModuleUnit=*/ true , isDebugCompilation,
703707 targetTriple, sysrootPath, clangRemapper, getModuleInfoFromOpaqueModule);
704708
@@ -718,7 +722,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
718722 ModuleDecl::ImportFilterKind::Default});
719723 StringScratchSpace moduleNameScratch;
720724 addModuleDependencies (imports, indexStorePath, indexClangModules,
721- indexSystemModules, skipStdlib, includeLocals,
725+ indexSystemModules, skipStdlib, includeLocals, compress,
722726 explicitModuleBuild,
723727 targetTriple, clangCI, diags, unitWriter,
724728 moduleNameScratch, pathRemapper, initialFile);
@@ -735,7 +739,7 @@ static bool
735739recordSourceFileUnit (SourceFile *primarySourceFile, StringRef indexUnitToken,
736740 StringRef indexStorePath, bool indexClangModules,
737741 bool indexSystemModules, bool skipStdlib,
738- bool includeLocals, bool isDebugCompilation,
742+ bool includeLocals, bool compress, bool isDebugCompilation,
739743 bool isExplicitModuleBuild, StringRef targetTriple,
740744 ArrayRef<clang::FileEntryRef> fileDependencies,
741745 const clang::CompilerInstance &clangCI,
@@ -754,7 +758,7 @@ recordSourceFileUnit(SourceFile *primarySourceFile, StringRef indexUnitToken,
754758 StringRef swiftVersion;
755759 StringRef sysrootPath = clangCI.getHeaderSearchOpts ().Sysroot ;
756760 IndexUnitWriter unitWriter (
757- fileMgr, indexStorePath, " swift" , swiftVersion, indexUnitToken,
761+ fileMgr, indexStorePath, " swift" , swiftVersion, compress, indexUnitToken,
758762 module ->getNameStr (), *mainFile, isSystem,
759763 /* isModuleUnit=*/ false , isDebugCompilation, targetTriple, sysrootPath,
760764 clangRemapper, getModuleInfoFromOpaqueModule);
@@ -765,7 +769,7 @@ recordSourceFileUnit(SourceFile *primarySourceFile, StringRef indexUnitToken,
765769 ModuleDecl::getImportFilterLocal ());
766770 StringScratchSpace moduleNameScratch;
767771 addModuleDependencies (imports, indexStorePath, indexClangModules,
768- indexSystemModules, skipStdlib, includeLocals,
772+ indexSystemModules, skipStdlib, includeLocals, compress,
769773 isExplicitModuleBuild, targetTriple, clangCI, diags,
770774 unitWriter, moduleNameScratch, pathRemapper,
771775 primarySourceFile);
@@ -774,7 +778,7 @@ recordSourceFileUnit(SourceFile *primarySourceFile, StringRef indexUnitToken,
774778 for (auto F : fileDependencies)
775779 unitWriter.addFileDependency (F, /* FIXME:isSystem=*/ false , /* Module=*/ nullptr );
776780
777- recordSourceFile (primarySourceFile, indexStorePath, includeLocals, diags,
781+ recordSourceFile (primarySourceFile, indexStorePath, includeLocals, compress, diags,
778782 [&](StringRef recordFile, StringRef filename) {
779783 if (auto file = fileMgr.getFileRef (filename)) {
780784 unitWriter.addRecordFile (
@@ -823,6 +827,7 @@ bool index::indexAndRecord(SourceFile *primarySourceFile,
823827 bool indexSystemModules,
824828 bool skipStdlib,
825829 bool includeLocals,
830+ bool compress,
826831 bool isDebugCompilation,
827832 bool isExplicitModuleBuild,
828833 StringRef targetTriple,
@@ -840,7 +845,7 @@ bool index::indexAndRecord(SourceFile *primarySourceFile,
840845
841846 return recordSourceFileUnit (primarySourceFile, indexUnitToken,
842847 indexStorePath, indexClangModules,
843- indexSystemModules, skipStdlib, includeLocals,
848+ indexSystemModules, skipStdlib, includeLocals, compress,
844849 isDebugCompilation, isExplicitModuleBuild,
845850 targetTriple, {},
846851 clangCI, pathRemapper, diags);
@@ -854,6 +859,7 @@ bool index::indexAndRecord(ModuleDecl *module,
854859 bool indexSystemModules,
855860 bool skipStdlib,
856861 bool includeLocals,
862+ bool compress,
857863 bool isDebugCompilation,
858864 bool isExplicitModuleBuild,
859865 StringRef targetTriple,
@@ -879,7 +885,7 @@ bool index::indexAndRecord(ModuleDecl *module,
879885 }
880886 if (recordSourceFileUnit (SF, indexUnitTokens[unitIndex],
881887 indexStorePath, indexClangModules,
882- indexSystemModules, skipStdlib, includeLocals,
888+ indexSystemModules, skipStdlib, includeLocals, compress,
883889 isDebugCompilation, isExplicitModuleBuild,
884890 targetTriple, {},
885891 clangCI, pathRemapper, diags))
0 commit comments