[clang][lex] NFCI: Use FileEntryRef in ModuleMap::diagnoseHeaderInclusion()

This patch removes uses of the deprecated `DirectoryEntry::getName()` from the `ModuleMap::diagnoseHeaderInclusion()` function by using `{File,Directory}EntryRef` instead.

Reviewed By: bnbarham

Differential Revision: https://reviews.llvm.org/D123856
This commit is contained in:
Jan Svoboda 2022-04-20 19:02:03 +02:00
parent 8a9b4fb4aa
commit 99cfccdcb3
3 changed files with 6 additions and 7 deletions

View File

@ -479,7 +479,7 @@ public:
void diagnoseHeaderInclusion(Module *RequestingModule,
bool RequestingModuleIsModuleInterface,
SourceLocation FilenameLoc, StringRef Filename,
const FileEntry *File);
FileEntryRef File);
/// Determine whether the given header is part of a module
/// marked 'unavailable'.

View File

@ -473,8 +473,7 @@ static Module *getTopLevelOrNull(Module *M) {
void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule,
bool RequestingModuleIsModuleInterface,
SourceLocation FilenameLoc,
StringRef Filename,
const FileEntry *File) {
StringRef Filename, FileEntryRef File) {
// No errors for indirect modules. This may be a bit of a problem for modules
// with no source files.
if (getTopLevelOrNull(RequestingModule) != getTopLevelOrNull(SourceModule))
@ -542,7 +541,7 @@ void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule,
diag::warn_non_modular_include_in_framework_module :
diag::warn_non_modular_include_in_module;
Diags.Report(FilenameLoc, DiagID) << RequestingModule->getFullModuleName()
<< File->getName();
<< File.getName();
}
}

View File

@ -905,7 +905,7 @@ Optional<FileEntryRef> Preprocessor::LookupFile(
if (SuggestedModule && !LangOpts.AsmPreprocessor)
HeaderInfo.getModuleMap().diagnoseHeaderInclusion(
RequestingModule, RequestingModuleIsModuleInterface, FilenameLoc,
Filename, &FE->getFileEntry());
Filename, *FE);
return FE;
}
@ -921,7 +921,7 @@ Optional<FileEntryRef> Preprocessor::LookupFile(
if (SuggestedModule && !LangOpts.AsmPreprocessor)
HeaderInfo.getModuleMap().diagnoseHeaderInclusion(
RequestingModule, RequestingModuleIsModuleInterface, FilenameLoc,
Filename, &FE->getFileEntry());
Filename, *FE);
return FE;
}
}
@ -936,7 +936,7 @@ Optional<FileEntryRef> Preprocessor::LookupFile(
if (SuggestedModule && !LangOpts.AsmPreprocessor)
HeaderInfo.getModuleMap().diagnoseHeaderInclusion(
RequestingModule, RequestingModuleIsModuleInterface,
FilenameLoc, Filename, &FE->getFileEntry());
FilenameLoc, Filename, *FE);
return FE;
}
}