Skip to content

Commit

Permalink
[clang][modules] Use FileEntryRef in ModuleMap (2/2)
Browse files Browse the repository at this point in the history
  • Loading branch information
jansvoboda11 committed Sep 28, 2023
1 parent 12cb98f commit 12866a2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Lex/HeaderSearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ class HeaderSearch {
///
/// \return false if \#including the file will have no effect or true
/// if we should include it.
bool ShouldEnterIncludeFile(Preprocessor &PP, const FileEntry *File,
bool ShouldEnterIncludeFile(Preprocessor &PP, FileEntryRef File,
bool isImport, bool ModulesEnabled, Module *M,
bool &IsFirstIncludeOfFile);

Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Lex/ModuleMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ class ModuleMap {
}

/// Is this a compiler builtin header?
bool isBuiltinHeader(const FileEntry *File);
bool isBuiltinHeader(FileEntryRef File);

/// Add a module map callback.
void addModuleMapCallbacks(std::unique_ptr<ModuleMapCallbacks> Callback) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Lex/HeaderSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ void HeaderSearch::MarkFileModuleHeader(const FileEntry *FE,
}

bool HeaderSearch::ShouldEnterIncludeFile(Preprocessor &PP,
const FileEntry *File, bool isImport,
FileEntryRef File, bool isImport,
bool ModulesEnabled, Module *M,
bool &IsFirstIncludeOfFile) {
++NumIncluded; // Count # of attempted #includes.
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/Lex/ModuleMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ static StringRef sanitizeFilenameAsIdentifier(StringRef Name,
return Name;
}

bool ModuleMap::isBuiltinHeader(const FileEntry *File) {
return File->getDir() == BuiltinIncludeDir && LangOpts.BuiltinHeadersInSystemModules &&
isBuiltinHeaderName(llvm::sys::path::filename(File->getName()));
bool ModuleMap::isBuiltinHeader(FileEntryRef File) {
return File.getDir() == BuiltinIncludeDir && LangOpts.BuiltinHeadersInSystemModules &&
isBuiltinHeaderName(llvm::sys::path::filename(File.getName()));
}

ModuleMap::HeadersMap::iterator ModuleMap::findKnownHeader(FileEntryRef File) {
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Lex/PPDirectives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2342,8 +2342,8 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport(
// Ask HeaderInfo if we should enter this #include file. If not, #including
// this file will have no effect.
if (Action == Enter && File &&
!HeaderInfo.ShouldEnterIncludeFile(*this, &File->getFileEntry(),
EnterOnce, getLangOpts().Modules, SM,
!HeaderInfo.ShouldEnterIncludeFile(*this, *File, EnterOnce,
getLangOpts().Modules, SM,
IsFirstIncludeOfFile)) {
// C++ standard modules:
// If we are not in the GMF, then we textually include only
Expand Down

0 comments on commit 12866a2

Please sign in to comment.