@@ -640,8 +640,9 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
640640 bool withoutUnitName = true ;
641641 if (FU->getKind () == FileUnitKind::ClangModule) {
642642 auto clangModUnit = cast<ClangModuleUnit>(LFU);
643- bool shouldIndexModule = indexClangModules &&
644- (!clangModUnit->isSystemModule () || indexSystemModules);
643+ bool shouldIndexModule =
644+ indexClangModules &&
645+ (!mod->isNonUserModule () || indexSystemModules);
645646 withoutUnitName = !shouldIndexModule;
646647 if (auto clangMod = clangModUnit->getUnderlyingClangModule ()) {
647648 moduleName = clangMod->getTopLevelModuleName ();
@@ -662,10 +663,7 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
662663 // We don't officially support binary swift modules, so normally
663664 // the index data for user modules would get generated while
664665 // building them.
665- bool isDistributedModule = mod->isSDKModule () ||
666- mod->getASTContext ().SearchPathOpts .getSDKPath ().empty ();
667- if (mod->isSystemModule () && indexSystemModules &&
668- (isDistributedModule || mod->isStdlibModule ()) &&
666+ if (mod->isNonUserModule () && indexSystemModules &&
669667 (!skipStdlib || !mod->isStdlibModule ())) {
670668 emitDataForSwiftSerializedModule (mod, indexStorePath,
671669 indexClangModules,
@@ -697,7 +695,7 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
697695 }
698696 clang::index::writer::OpaqueModule opaqMod =
699697 moduleNameScratch.createString (moduleName);
700- unitWriter.addASTFileDependency (*F, mod->isSystemModule (), opaqMod,
698+ unitWriter.addASTFileDependency (*F, mod->isNonUserModule (), opaqMod,
701699 withoutUnitName);
702700
703701 break ;
@@ -833,7 +831,7 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
833831 }
834832
835833 auto &fileMgr = clangCI.getFileManager ();
836- bool isSystem = module ->isSystemModule ();
834+ bool isSystem = module ->isNonUserModule ();
837835 // FIXME: Get real values for the following.
838836 StringRef swiftVersion;
839837 StringRef sysrootPath = clangCI.getHeaderSearchOpts ().Sysroot ;
@@ -848,14 +846,13 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
848846 targetTriple, sysrootPath, clangRemapper, getModuleInfoFromOpaqueModule);
849847
850848 auto FE = fileMgr.getFile (filename);
851- bool isSystemModule = module ->isSystemModule ();
852849 for (auto &pair : records) {
853850 std::string &recordFile = pair.first ;
854851 std::string &groupName = pair.second ;
855852 if (recordFile.empty ())
856853 continue ;
857854 clang::index::writer::OpaqueModule mod = &groupName;
858- unitWriter.addRecordFile (recordFile, *FE, isSystemModule , mod);
855+ unitWriter.addRecordFile (recordFile, *FE, isSystem , mod);
859856 }
860857
861858 SmallVector<ImportedModule, 8 > imports;
@@ -887,7 +884,7 @@ recordSourceFileUnit(SourceFile *primarySourceFile, StringRef indexUnitToken,
887884 DiagnosticEngine &diags) {
888885 auto &fileMgr = clangCI.getFileManager ();
889886 auto *module = primarySourceFile->getParentModule ();
890- bool isSystem = module ->isSystemModule ();
887+ bool isSystem = module ->isNonUserModule ();
891888 auto mainFile = fileMgr.getFile (primarySourceFile->getFilename ());
892889 auto clangRemapper = pathRemapper.asClangPathRemapper ();
893890 // FIXME: Get real values for the following.
@@ -920,7 +917,7 @@ recordSourceFileUnit(SourceFile *primarySourceFile, StringRef indexUnitToken,
920917 auto file = fileMgr.getFile (filename);
921918 unitWriter.addRecordFile (
922919 recordFile, file ? *file : nullptr ,
923- module ->isSystemModule (), /* Module=*/ nullptr );
920+ module ->isNonUserModule (), /* Module=*/ nullptr );
924921 });
925922
926923 std::string error;
0 commit comments