@@ -311,9 +311,9 @@ StringRef StdlibGroupsIndexRecordingConsumer::findGroupForSymbol(const IndexSymb
311
311
}
312
312
313
313
static bool writeRecord (SymbolTracker &record, std::string Filename,
314
- std::string indexStorePath, DiagnosticEngine *diags,
314
+ std::string indexStorePath, bool compress, DiagnosticEngine *diags,
315
315
std::string &outRecordFile) {
316
- IndexRecordWriter recordWriter (indexStorePath);
316
+ IndexRecordWriter recordWriter (indexStorePath, compress );
317
317
std::string error;
318
318
auto result = recordWriter.beginRecord (
319
319
Filename, record.hashRecord (), error, &outRecordFile);
@@ -360,25 +360,25 @@ static bool writeRecord(SymbolTracker &record, std::string Filename,
360
360
361
361
static std::unique_ptr<IndexRecordingConsumer>
362
362
makeRecordingConsumer (std::string Filename, std::string indexStorePath,
363
- bool includeLocals, DiagnosticEngine *diags,
363
+ bool includeLocals, bool compress, DiagnosticEngine *diags,
364
364
std::string *outRecordFile,
365
365
bool *outFailed) {
366
366
return std::make_unique<IndexRecordingConsumer>(includeLocals,
367
367
[=](SymbolTracker &record) {
368
- *outFailed = writeRecord (record, Filename, indexStorePath, diags,
368
+ *outFailed = writeRecord (record, Filename, indexStorePath, compress, diags,
369
369
*outRecordFile);
370
370
});
371
371
}
372
372
373
373
static bool
374
374
recordSourceFile (SourceFile *SF, StringRef indexStorePath,
375
- bool includeLocals, DiagnosticEngine &diags,
375
+ bool includeLocals, bool compress, DiagnosticEngine &diags,
376
376
llvm::function_ref<void (StringRef, StringRef)> callback) {
377
377
std::string recordFile;
378
378
bool failed = false ;
379
379
auto consumer =
380
380
makeRecordingConsumer (SF->getFilename ().str (), indexStorePath.str (),
381
- includeLocals, &diags, &recordFile, &failed);
381
+ includeLocals, compress, &diags, &recordFile, &failed);
382
382
indexSourceFile (SF, *consumer);
383
383
384
384
if (!failed && !recordFile.empty ())
@@ -418,6 +418,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
418
418
bool indexSystemModules,
419
419
bool skipStdlib,
420
420
bool includeLocals,
421
+ bool compress,
421
422
bool explicitModulebuild,
422
423
StringRef targetTriple,
423
424
const clang::CompilerInstance &clangCI,
@@ -432,6 +433,7 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
432
433
bool indexSystemModules,
433
434
bool skipStdlib,
434
435
bool includeLocals,
436
+ bool compress,
435
437
bool explicitModuleBuild,
436
438
StringRef targetTriple,
437
439
const clang::CompilerInstance &clangCI,
@@ -508,6 +510,7 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
508
510
indexClangModules,
509
511
indexSystemModules, skipStdlib,
510
512
includeLocals,
513
+ compress,
511
514
explicitModuleBuild,
512
515
targetTriple,
513
516
clangCI, diags,
@@ -551,6 +554,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
551
554
bool indexSystemModules,
552
555
bool skipStdlib,
553
556
bool includeLocals,
557
+ bool compress,
554
558
bool explicitModuleBuild,
555
559
StringRef targetTriple,
556
560
const clang::CompilerInstance &clangCI,
@@ -632,7 +636,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
632
636
std::string recordFile;
633
637
bool failed = false ;
634
638
auto consumer = makeRecordingConsumer (filename.str (), indexStorePath.str (),
635
- includeLocals, &diags, &recordFile, &failed);
639
+ includeLocals, compress, &diags, &recordFile, &failed);
636
640
indexModule (module , *consumer);
637
641
638
642
if (failed)
@@ -676,7 +680,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
676
680
std::string outRecordFile;
677
681
failed =
678
682
failed || writeRecord (tracker, std::string (fileNameWithGroup.str ()),
679
- indexStorePath.str (), &diags, outRecordFile);
683
+ indexStorePath.str (), compress, &diags, outRecordFile);
680
684
if (failed)
681
685
return false ;
682
686
records.emplace_back (outRecordFile, moduleName.str ().str ());
@@ -698,7 +702,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
698
702
auto clangRemapper = pathRemapper.asClangPathRemapper ();
699
703
700
704
IndexUnitWriter unitWriter (
701
- fileMgr, indexStorePath, " swift" , swiftVersion, filename, moduleName,
705
+ fileMgr, indexStorePath, " swift" , swiftVersion, compress, filename, moduleName,
702
706
/* MainFile=*/ {}, isSystem, /* IsModuleUnit=*/ true , isDebugCompilation,
703
707
targetTriple, sysrootPath, clangRemapper, getModuleInfoFromOpaqueModule);
704
708
@@ -718,7 +722,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
718
722
ModuleDecl::ImportFilterKind::Default});
719
723
StringScratchSpace moduleNameScratch;
720
724
addModuleDependencies (imports, indexStorePath, indexClangModules,
721
- indexSystemModules, skipStdlib, includeLocals,
725
+ indexSystemModules, skipStdlib, includeLocals, compress,
722
726
explicitModuleBuild,
723
727
targetTriple, clangCI, diags, unitWriter,
724
728
moduleNameScratch, pathRemapper, initialFile);
@@ -735,7 +739,7 @@ static bool
735
739
recordSourceFileUnit (SourceFile *primarySourceFile, StringRef indexUnitToken,
736
740
StringRef indexStorePath, bool indexClangModules,
737
741
bool indexSystemModules, bool skipStdlib,
738
- bool includeLocals, bool isDebugCompilation,
742
+ bool includeLocals, bool compress, bool isDebugCompilation,
739
743
bool isExplicitModuleBuild, StringRef targetTriple,
740
744
ArrayRef<clang::FileEntryRef> fileDependencies,
741
745
const clang::CompilerInstance &clangCI,
@@ -754,7 +758,7 @@ recordSourceFileUnit(SourceFile *primarySourceFile, StringRef indexUnitToken,
754
758
StringRef swiftVersion;
755
759
StringRef sysrootPath = clangCI.getHeaderSearchOpts ().Sysroot ;
756
760
IndexUnitWriter unitWriter (
757
- fileMgr, indexStorePath, " swift" , swiftVersion, indexUnitToken,
761
+ fileMgr, indexStorePath, " swift" , swiftVersion, compress, indexUnitToken,
758
762
module ->getNameStr (), *mainFile, isSystem,
759
763
/* isModuleUnit=*/ false , isDebugCompilation, targetTriple, sysrootPath,
760
764
clangRemapper, getModuleInfoFromOpaqueModule);
@@ -765,7 +769,7 @@ recordSourceFileUnit(SourceFile *primarySourceFile, StringRef indexUnitToken,
765
769
ModuleDecl::getImportFilterLocal ());
766
770
StringScratchSpace moduleNameScratch;
767
771
addModuleDependencies (imports, indexStorePath, indexClangModules,
768
- indexSystemModules, skipStdlib, includeLocals,
772
+ indexSystemModules, skipStdlib, includeLocals, compress,
769
773
isExplicitModuleBuild, targetTriple, clangCI, diags,
770
774
unitWriter, moduleNameScratch, pathRemapper,
771
775
primarySourceFile);
@@ -774,7 +778,7 @@ recordSourceFileUnit(SourceFile *primarySourceFile, StringRef indexUnitToken,
774
778
for (auto F : fileDependencies)
775
779
unitWriter.addFileDependency (F, /* FIXME:isSystem=*/ false , /* Module=*/ nullptr );
776
780
777
- recordSourceFile (primarySourceFile, indexStorePath, includeLocals, diags,
781
+ recordSourceFile (primarySourceFile, indexStorePath, includeLocals, compress, diags,
778
782
[&](StringRef recordFile, StringRef filename) {
779
783
if (auto file = fileMgr.getFileRef (filename)) {
780
784
unitWriter.addRecordFile (
@@ -823,6 +827,7 @@ bool index::indexAndRecord(SourceFile *primarySourceFile,
823
827
bool indexSystemModules,
824
828
bool skipStdlib,
825
829
bool includeLocals,
830
+ bool compress,
826
831
bool isDebugCompilation,
827
832
bool isExplicitModuleBuild,
828
833
StringRef targetTriple,
@@ -840,7 +845,7 @@ bool index::indexAndRecord(SourceFile *primarySourceFile,
840
845
841
846
return recordSourceFileUnit (primarySourceFile, indexUnitToken,
842
847
indexStorePath, indexClangModules,
843
- indexSystemModules, skipStdlib, includeLocals,
848
+ indexSystemModules, skipStdlib, includeLocals, compress,
844
849
isDebugCompilation, isExplicitModuleBuild,
845
850
targetTriple, {},
846
851
clangCI, pathRemapper, diags);
@@ -854,6 +859,7 @@ bool index::indexAndRecord(ModuleDecl *module,
854
859
bool indexSystemModules,
855
860
bool skipStdlib,
856
861
bool includeLocals,
862
+ bool compress,
857
863
bool isDebugCompilation,
858
864
bool isExplicitModuleBuild,
859
865
StringRef targetTriple,
@@ -879,7 +885,7 @@ bool index::indexAndRecord(ModuleDecl *module,
879
885
}
880
886
if (recordSourceFileUnit (SF, indexUnitTokens[unitIndex],
881
887
indexStorePath, indexClangModules,
882
- indexSystemModules, skipStdlib, includeLocals,
888
+ indexSystemModules, skipStdlib, includeLocals, compress,
883
889
isDebugCompilation, isExplicitModuleBuild,
884
890
targetTriple, {},
885
891
clangCI, pathRemapper, diags))
0 commit comments