240 friend ConstSearchDirIterator;
241 friend SearchDirIterator;
247 llvm::DenseMap<unsigned, unsigned> SearchDirToHSEntry;
256 std::vector<DirectoryLookup> SearchDirs;
259 std::vector<bool> SearchDirsUsage;
260 unsigned AngledDirIdx = 0;
261 unsigned SystemDirIdx = 0;
266 llvm::StringMap<unsigned, llvm::BumpPtrAllocator> SearchDirHeaderMapIndex;
269 unsigned FirstNonHeaderMapSearchDirIdx = 0;
277 std::vector<std::pair<std::string, bool>> SystemHeaderPrefixes;
280 std::string ContextHash;
283 std::string SpecificModuleCachePath;
287 mutable std::vector<HeaderFileInfo> FileInfo;
290 struct LookupFileCacheInfo {
292 const Module *RequestingModule =
nullptr;
297 ConstSearchDirIterator StartIt =
nullptr;
300 ConstSearchDirIterator HitIt =
nullptr;
304 const char *MappedName =
nullptr;
307 LookupFileCacheInfo() =
default;
309 void reset(
const Module *NewRequestingModule,
310 ConstSearchDirIterator NewStartIt) {
311 RequestingModule = NewRequestingModule;
312 StartIt = NewStartIt;
313 MappedName =
nullptr;
316 llvm::StringMap<LookupFileCacheInfo, llvm::BumpPtrAllocator> LookupFileCache;
320 llvm::StringMap<FrameworkCacheEntry, llvm::BumpPtrAllocator> FrameworkMap;
325 using IncludeAliasMap =
326 llvm::StringMap<std::string, llvm::BumpPtrAllocator>;
327 std::unique_ptr<IncludeAliasMap> IncludeAliases;
330 std::vector<std::pair<FileEntryRef, std::unique_ptr<HeaderMap>>> HeaderMaps;
333 mutable ModuleMap ModMap;
335 struct ModuleMapDirectoryState {
345 llvm::DenseMap<const DirectoryEntry *, ModuleMapDirectoryState>
350 llvm::DenseMap<const FileEntry *, bool> LoadedModuleMaps;
354 llvm::DenseMap<const FileEntry *, bool> ParsedModuleMaps;
357 llvm::DenseMap<const FileEntry *, llvm::SmallString<64>> IncludeNames;
361 llvm::StringSet<llvm::BumpPtrAllocator> FrameworkNames;
366 ExternalPreprocessorSource *ExternalLookup =
nullptr;
369 ExternalHeaderFileInfoSource *ExternalSource =
nullptr;
373 void indexInitialHeaderMaps();
376 HeaderSearch(
const HeaderSearchOptions &HSOpts, SourceManager &SourceMgr,
377 DiagnosticsEngine &Diags,
const LangOptions &LangOpts,
378 const TargetInfo *
Target);
391 void SetSearchPaths(std::vector<DirectoryLookup> dirs,
unsigned angledDirIdx,
392 unsigned systemDirIdx,
393 llvm::DenseMap<unsigned, unsigned> searchDirToHSEntry);
400 SearchDirs.push_back(dir);
401 SearchDirsUsage.push_back(
false);
406 SystemHeaderPrefixes.assign(P.begin(), P.end());
418 IncludeAliases.reset(
new IncludeAliasMap);
419 (*IncludeAliases)[Source] = std::string(Dest);
427 assert(IncludeAliases &&
"Trying to map headers when there's no map");
430 IncludeAliasMap::const_iterator Iter = IncludeAliases->find(Source);
431 if (Iter != IncludeAliases->end())
441 SpecificModuleCachePath = std::string(Path);
449 return SpecificModuleCachePath;
458 ExternalLookup = EPS;
462 return ExternalLookup;
473 ArrayRef<std::pair<OptionalFileEntryRef, DirectoryEntryRef>> Includers,
518 ArrayRef<std::pair<OptionalFileEntryRef, DirectoryEntryRef>> Includers,
521 bool *IsMapped,
bool *IsFrameworkFound,
bool SkipCache =
false,
522 bool BuildSystemModule =
false,
bool OpenFile =
true,
523 bool CacheFailures =
true);
539 return FrameworkMap[FWName];
551 bool isImport,
bool ModulesEnabled,
Module *M,
552 bool &IsFirstIncludeOfFile);
576 bool isCompilingModuleHeader);
639 bool FileMapOnly =
false);
661 StringRef ModuleMapPath);
679 bool AllowSearch =
true,
680 bool AllowExtraModuleMapSearch =
false);
706 bool AllowTextual =
false,
707 bool AllowExcluded =
false)
const;
735 unsigned *Offset =
nullptr,
736 StringRef OriginalModuleMapFile = StringRef());
764 bool AllowExtraModuleMapSearch =
false);
778 std::string getCachedModuleFileNameImpl(StringRef ModuleName,
779 StringRef ModuleMapPath,
780 StringRef CachePath);
807 bool IsSystemHeaderDir);
814 bool findUsableModuleForFrameworkHeader(
825 bool OpenFile =
true,
bool CacheFailures =
true);
829 void cacheLookupSuccess(LookupFileCacheInfo &CacheLookup,
866 assert(n < SearchDirs.size());
880 return {*
this, AngledDirIdx};
885 return {*
this, SystemDirIdx};
888 return {*
this, SearchDirs.size()};
914 llvm::StringRef MainFile,
915 bool *IsAngled =
nullptr)
const;
927 llvm::StringRef WorkingDir,
928 llvm::StringRef MainFile,
929 bool *IsAngled =
nullptr)
const;
937 enum ModuleMapResult {
939 MMR_AlreadyProcessed,
952 ModuleMapResult parseAndLoadModuleMapFileImpl(FileEntryRef
File,
954 DirectoryEntryRef Dir,
955 FileID ID = FileID(),
956 unsigned *Offset =
nullptr);
958 ModuleMapResult parseModuleMapFileImpl(FileEntryRef
File,
bool IsSystem,
959 DirectoryEntryRef Dir,
960 FileID ID = FileID());
983 bool IsSystem,
bool IsFramework);
985 ModuleMapResult parseModuleMapFile(StringRef DirName,
bool IsSystem,
987 ModuleMapResult parseModuleMapFile(DirectoryEntryRef Dir,
bool IsSystem,
A reference to a DirectoryEntry that includes the name of the directory as it was accessed by the Fil...
Cached information about one directory (either on disk or in the virtual file system).
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
Cached information about one file (either on disk or in the virtual file system).
This structure is used to record entries in our framework cache.
bool IsUserSpecifiedSystemFramework
Whether this framework has been "user-specified" to be treated as if it were a system framework (even...
OptionalDirectoryEntryRef Directory
The directory entry which should be used for the cached framework.