Lines Matching defs:File

1 //===- HeaderSearch.cpp - Resolve Header File Locations -------------------===//
425 // File lookup within a DirectoryLookup scope
446 auto File = getFileMgr().getFileRef(FileName, OpenFile, CacheFailures);
447 if (!File) {
450 std::error_code EC = llvm::errorToErrorCode(File.takeError());
462 *File, Dir ? Dir : File->getFileEntry().getDir(), RequestingModule,
466 return *File;
517 [&](FileEntryRef File) -> OptionalFileEntryRef {
527 if (!HS.findUsableModuleForHeader(File, File.getFileEntry().getDir(),
532 return File;
698 auto File =
700 if (!File) {
709 File = FileMgr.getOptionalFileRef(FrameworkName,
714 if (File && needModuleLookup(RequestingModule, SuggestedModule)) {
716 StringRef FrameworkPath = File->getDir().getName();
739 if (!HS.findUsableModuleForFrameworkHeader(*File, FrameworkPath,
744 if (!HS.findUsableModuleForHeader(*File, getDir(), RequestingModule,
749 if (File)
750 return *File;
775 // Header File Location.
1078 OptionalFileEntryRef File = It->LookupFile(
1091 *IsMapped |= (!MappedName.empty() || (IsInHeaderMap && File));
1097 if (!File)
1102 IncludeNames[*File] = Filename;
1105 HeaderFileInfo &HFI = getFileInfo(*File);
1141 if (checkMSVCHeaderSearch(Diags, MSFE, &File->getFileEntry(), IncludeLoc)) {
1151 *File, isAngled, FoundByHeaderMap);
1155 return File;
1173 OptionalFileEntryRef File = LookupFile(
1179 File ? &File->getFileEntry() : nullptr,
1189 return File;
1280 auto File = FileMgr.getOptionalFileRef(HeadersFilename, /*OpenFile=*/true);
1281 if (!File) {
1292 File = FileMgr.getOptionalFileRef(HeadersFilename, /*OpenFile=*/true);
1294 if (!File)
1304 getFileInfo(*File).DirInfo = DirInfo;
1307 if (!findUsableModuleForFrameworkHeader(*File, FrameworkName,
1312 return *File;
1316 // File Info Management.
1425 bool HeaderSearch::isFileMultipleIncludeGuarded(FileEntryRef File) const {
1429 if (auto *HFI = getExistingFileInfo(File))
1452 FileEntryRef File, bool isImport,
1471 HeaderFileInfo &FileInfo = getFileInfo(File);
1495 ModMap.resolveHeaderDirectives(File);
1526 if (ModMap.isBuiltinHeader(File))
1556 if (PP.alreadyIncluded(File) && !MaybeReenterImportedFile())
1585 IsFirstIncludeOfFile = PP.markIncluded(File);
1605 StringRef HeaderSearch::getIncludeNameForHeader(const FileEntry *File) const {
1606 auto It = IncludeNames.find(File);
1660 HeaderSearch::findModuleForHeader(FileEntryRef File, bool AllowTextual,
1665 (void)getExistingFileInfo(File);
1667 return ModMap.findModuleForHeader(File, AllowTextual, AllowExcluded);
1671 HeaderSearch::findAllModulesForHeader(FileEntryRef File) const {
1675 (void)getExistingFileInfo(File);
1677 return ModMap.findAllModulesForHeader(File);
1681 HeaderSearch::findResolvedModulesForHeader(FileEntryRef File) const {
1685 (void)getExistingFileInfo(File);
1687 return ModMap.findResolvedModulesForHeader(File);
1690 static bool suggestModule(HeaderSearch &HS, FileEntryRef File,
1694 HS.findModuleForHeader(File, /*AllowTextual*/true);
1706 if (HS.getModuleMap().isBuiltinHeader(File)) {
1726 FileEntryRef File, const DirectoryEntry *Root, Module *RequestingModule,
1730 hasModuleMap(File.getNameAsRequested(), Root, IsSystemHeaderDir);
1731 return suggestModule(*this, File, RequestingModule, SuggestedModule);
1737 FileEntryRef File, StringRef FrameworkName, Module *RequestingModule,
1758 return suggestModule(*this, File, RequestingModule, SuggestedModule);
1763 static OptionalFileEntryRef getPrivateModuleMap(FileEntryRef File,
1766 StringRef Filename = llvm::sys::path::filename(File.getName());
1767 SmallString<128> PrivateFilename(File.getDir().getName());
1779 << File.getDir().getName().ends_with(".framework");
1784 bool HeaderSearch::loadModuleMapFile(FileEntryRef File, bool IsSystem,
1803 Dir = File.getDir();
1820 switch (loadModuleMapFileImpl(File, IsSystem, *Dir, ID, Offset)) {
1832 HeaderSearch::loadModuleMapFileImpl(FileEntryRef File, bool IsSystem,
1837 auto AddResult = LoadedModuleMaps.insert(std::make_pair(File, true));
1841 if (ModMap.parseModuleMapFile(File, IsSystem, Dir, ID, Offset)) {
1842 LoadedModuleMaps[File] = false;
1848 getPrivateModuleMap(File, FileMgr, Diags)) {
1850 LoadedModuleMaps[File] = false;
2038 FileEntryRef File, llvm::StringRef MainFile, bool *IsAngled) const {
2039 return suggestPathToFileForDiagnostics(File.getName(), /*WorkingDir=*/"",
2044 llvm::StringRef File, llvm::StringRef WorkingDir, llvm::StringRef MainFile,
2048 llvm::SmallString<32> FilePath = File;
2056 File = FilePath;
2059 // Checks whether `Dir` is a strict path prefix of `File`. If so and that's
2066 for (auto NI = path::begin(File), NE = path::end(File),
2070 // Dir is a prefix of File, up to choice of path separators.
2071 unsigned PrefixLength = NI - path::begin(File);
2130 StringRef Filename = File.drop_front(BestPrefixLength);