@@ -158,25 +158,25 @@ static void optimizeCWD(CowCompilerInvocation &BuildInvocation, StringRef CWD) {
158158}
159159
160160// / Check a subset of invocation options to determine whether the current
161- // / context can safely be considered as shareable .
162- static bool areOptionsInSharedDir (CowCompilerInvocation &BuildInvocation,
163- const ArrayRef<StringRef> SharedDirs ) {
161+ // / context can safely be considered as stable .
162+ static bool areOptionsInStableDir (CowCompilerInvocation &BuildInvocation,
163+ const ArrayRef<StringRef> StableDirs ) {
164164 const auto &HSOpts = BuildInvocation.getHeaderSearchOpts ();
165- assert (isPathInSharedDir (SharedDirs , HSOpts.Sysroot ) &&
165+ assert (isPathInStableDir (StableDirs , HSOpts.Sysroot ) &&
166166 " Sysroots differ between module dependencies and current TU" );
167167
168- assert (isPathInSharedDir (SharedDirs , HSOpts.ResourceDir ) &&
168+ assert (isPathInStableDir (StableDirs , HSOpts.ResourceDir ) &&
169169 " ResourceDirs differ between module dependencies and current TU" );
170170
171171 for (const auto &Entry : HSOpts.UserEntries ) {
172172 if (!Entry.IgnoreSysRoot )
173173 continue ;
174- if (!isPathInSharedDir (SharedDirs , Entry.Path ))
174+ if (!isPathInStableDir (StableDirs , Entry.Path ))
175175 return false ;
176176 }
177177
178178 for (const auto &SysPrefix : HSOpts.SystemHeaderPrefixes ) {
179- if (!isPathInSharedDir (SharedDirs , SysPrefix.Prefix ))
179+ if (!isPathInStableDir (StableDirs , SysPrefix.Prefix ))
180180 return false ;
181181 }
182182
@@ -238,7 +238,7 @@ void dependencies::resetBenignCodeGenOptions(frontend::ActionKind ProgramAction,
238238 }
239239}
240240
241- bool dependencies::isPathInSharedDir ( ArrayRef<StringRef> Directories,
241+ bool dependencies::isPathInStableDir ( const ArrayRef<StringRef> Directories,
242242 const StringRef Input) {
243243 auto PathStartsWith = [](StringRef Prefix, StringRef Path) {
244244 auto PrefixIt = llvm::sys::path::begin (Prefix),
@@ -747,12 +747,12 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) {
747747 // Start off with the assumption that this module is shareable when there
748748 // is a sysroot provided. As more dependencies are discovered, check if those
749749 // come from the provided shared directories.
750- const llvm::SmallVector<StringRef> SharedDirs = {
750+ const llvm::SmallVector<StringRef> StableDirs = {
751751 MDC.ScanInstance .getHeaderSearchOpts ().Sysroot ,
752752 MDC.ScanInstance .getHeaderSearchOpts ().ResourceDir };
753- MD.IsShareable =
754- !SharedDirs [0 ].empty () &&
755- (llvm::sys::path::root_directory (SharedDirs [0 ]) != SharedDirs [0 ]);
753+ MD.IsInStableDirectories =
754+ !StableDirs [0 ].empty () &&
755+ (llvm::sys::path::root_directory (StableDirs [0 ]) != StableDirs [0 ]);
756756
757757 // For modules which use export_as link name, the linked product that of the
758758 // corresponding export_as-named module.
@@ -795,10 +795,11 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) {
795795 MDC.ScanInstance .getASTReader ()->visitInputFileInfos (
796796 *MF, /* IncludeSystem=*/ true ,
797797 [&](const serialization::InputFileInfo &IFI, bool IsSystem) {
798- if (MD.IsShareable ) {
798+ if (MD.IsInStableDirectories ) {
799799 auto FullFilePath = ASTReader::ResolveImportedPath (
800800 PathBuf, IFI.UnresolvedImportedFilename , MF->BaseDirectory );
801- MD.IsShareable = isPathInSharedDir (SharedDirs, *FullFilePath);
801+ MD.IsInStableDirectories =
802+ isPathInStableDir (StableDirs, *FullFilePath);
802803 }
803804 if (!(IFI.TopLevel && IFI.ModuleMap ))
804805 return ;
@@ -841,9 +842,10 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) {
841842 }
842843 });
843844
844- // Check provided input paths from the invocation for determining IsShareable.
845- if (MD.IsShareable )
846- MD.IsShareable = areOptionsInSharedDir (CI, SharedDirs);
845+ // Check provided input paths from the invocation for determining
846+ // IsInStableDirectories.
847+ if (MD.IsInStableDirectories )
848+ MD.IsInStableDirectories = areOptionsInStableDir (CI, StableDirs);
847849
848850 MDC.associateWithContextHash (CI, IgnoreCWD, MD);
849851
@@ -888,10 +890,10 @@ void ModuleDepCollectorPP::addModulePrebuiltDeps(
888890 if (MDC.isPrebuiltModule (Import->getTopLevelModule ()))
889891 if (SeenSubmodules.insert (Import->getTopLevelModule ()).second ) {
890892 MD.PrebuiltModuleDeps .emplace_back (Import->getTopLevelModule ());
891- // Conservatively consider the module as not shareable,
892- // as transitive dependencies from the prebuilt module have not been
893- // determined.
894- MD.IsShareable = false ;
893+ // Conservatively consider the module as not coming from stable
894+ // directories, as transitive dependencies from the prebuilt module
895+ // have not been determined.
896+ MD.IsInStableDirectories = false ;
895897 }
896898}
897899
@@ -908,8 +910,8 @@ void ModuleDepCollectorPP::addAllSubmoduleDeps(
908910void ModuleDepCollectorPP::addOneModuleDep (const Module *M, const ModuleID ID,
909911 ModuleDeps &MD) {
910912 MD.ClangModuleDeps .push_back (ID);
911- if (MD.IsShareable )
912- MD.IsShareable = MDC.ModularDeps [M]->IsShareable ;
913+ if (MD.IsInStableDirectories )
914+ MD.IsInStableDirectories = MDC.ModularDeps [M]->IsInStableDirectories ;
913915}
914916
915917void ModuleDepCollectorPP::addModuleDep (
0 commit comments