@@ -332,27 +332,13 @@ class HeaderSearch {
332332 // / The mapping between modules and headers.
333333 mutable ModuleMap ModMap;
334334
335- struct ModuleMapDirectoryState {
336- OptionalFileEntryRef ModuleMapFile;
337- enum {
338- Parsed,
339- Loaded,
340- Invalid,
341- } Status;
342- };
343-
344335 // / Describes whether a given directory has a module map in it.
345- llvm::DenseMap<const DirectoryEntry *, ModuleMapDirectoryState>
346- DirectoryModuleMap;
336+ llvm::DenseMap<const DirectoryEntry *, bool > DirectoryHasModuleMap;
347337
348338 // / Set of module map files we've already loaded, and a flag indicating
349339 // / whether they were valid or not.
350340 llvm::DenseMap<const FileEntry *, bool > LoadedModuleMaps;
351341
352- // / Set of module map files we've already parsed, and a flag indicating
353- // / whether they were valid or not.
354- llvm::DenseMap<const FileEntry *, bool > ParsedModuleMaps;
355-
356342 // A map of discovered headers with their associated include file name.
357343 llvm::DenseMap<const FileEntry *, llvm::SmallString<64 >> IncludeNames;
358344
@@ -447,6 +433,11 @@ class HeaderSearch {
447433 // / Retrieve the path to the module cache.
448434 StringRef getModuleCachePath () const { return ModuleCachePath; }
449435
436+ // / Consider modules when including files from this directory.
437+ void setDirectoryHasModuleMap (const DirectoryEntry* Dir) {
438+ DirectoryHasModuleMap[Dir] = true ;
439+ }
440+
450441 // / Forget everything we know about headers so far.
451442 void ClearFileInfo () {
452443 FileInfo.clear ();
@@ -722,10 +713,9 @@ class HeaderSearch {
722713 // / used to resolve paths within the module (this is required when
723714 // / building the module from preprocessed source).
724715 // / \returns true if an error occurred, false otherwise.
725- bool parseAndLoadModuleMapFile (FileEntryRef File, bool IsSystem,
726- FileID ID = FileID(),
727- unsigned *Offset = nullptr,
728- StringRef OriginalModuleMapFile = StringRef());
716+ bool loadModuleMapFile (FileEntryRef File, bool IsSystem, FileID ID = FileID(),
717+ unsigned *Offset = nullptr,
718+ StringRef OriginalModuleMapFile = StringRef());
729719
730720 // / Collect the set of all known, top-level modules.
731721 // /
@@ -925,31 +915,26 @@ class HeaderSearch {
925915 size_t getTotalMemory () const ;
926916
927917private:
928- // / Describes what happened when we tried to load or parse a module map file.
929- enum ModuleMapResult {
930- // / The module map file had already been processed .
931- MMR_AlreadyProcessed ,
918+ // / Describes what happened when we tried to load a module map file.
919+ enum LoadModuleMapResult {
920+ // / The module map file had already been loaded .
921+ LMM_AlreadyLoaded ,
932922
933- // / The module map file was processed by this invocation.
934- MMR_NewlyProcessed ,
923+ // / The module map file was loaded by this invocation.
924+ LMM_NewlyLoaded ,
935925
936926 // / There is was directory with the given name.
937- MMR_NoDirectory ,
927+ LMM_NoDirectory ,
938928
939929 // / There was either no module map file or the module map file was
940930 // / invalid.
941- MMR_InvalidModuleMap
931+ LMM_InvalidModuleMap
942932 };
943933
944- ModuleMapResult parseAndLoadModuleMapFileImpl (FileEntryRef File,
945- bool IsSystem,
946- DirectoryEntryRef Dir,
947- FileID ID = FileID(),
948- unsigned *Offset = nullptr);
949-
950- ModuleMapResult parseModuleMapFileImpl (FileEntryRef File, bool IsSystem,
951- DirectoryEntryRef Dir,
952- FileID ID = FileID());
934+ LoadModuleMapResult loadModuleMapFileImpl (FileEntryRef File, bool IsSystem,
935+ DirectoryEntryRef Dir,
936+ FileID ID = FileID(),
937+ unsigned *Offset = nullptr);
953938
954939 // / Try to load the module map file in the given directory.
955940 // /
@@ -960,8 +945,8 @@ class HeaderSearch {
960945 // /
961946 // / \returns The result of attempting to load the module map file from the
962947 // / named directory.
963- ModuleMapResult parseAndLoadModuleMapFile (StringRef DirName, bool IsSystem,
964- bool IsFramework);
948+ LoadModuleMapResult loadModuleMapFile (StringRef DirName, bool IsSystem,
949+ bool IsFramework);
965950
966951 // / Try to load the module map file in the given directory.
967952 // /
@@ -971,13 +956,8 @@ class HeaderSearch {
971956 // /
972957 // / \returns The result of attempting to load the module map file from the
973958 // / named directory.
974- ModuleMapResult parseAndLoadModuleMapFile (DirectoryEntryRef Dir,
975- bool IsSystem, bool IsFramework);
976-
977- ModuleMapResult parseModuleMapFile (StringRef DirName, bool IsSystem,
978- bool IsFramework);
979- ModuleMapResult parseModuleMapFile (DirectoryEntryRef Dir, bool IsSystem,
980- bool IsFramework);
959+ LoadModuleMapResult loadModuleMapFile (DirectoryEntryRef Dir, bool IsSystem,
960+ bool IsFramework);
981961};
982962
983963// / Apply the header search options to get given HeaderSearch object.
0 commit comments