Author: Jan Svoboda Date: 2023-09-28T12:59:26-07:00 New Revision: 12866a2b87038abf2d69f2a6040a4ff4ce27b6cd
URL: https://github.com/llvm/llvm-project/commit/12866a2b87038abf2d69f2a6040a4ff4ce27b6cd DIFF: https://github.com/llvm/llvm-project/commit/12866a2b87038abf2d69f2a6040a4ff4ce27b6cd.diff LOG: [clang][modules] Use `FileEntryRef` in `ModuleMap` (2/2) Added: Modified: clang/include/clang/Lex/HeaderSearch.h clang/include/clang/Lex/ModuleMap.h clang/lib/Lex/HeaderSearch.cpp clang/lib/Lex/ModuleMap.cpp clang/lib/Lex/PPDirectives.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h index 533de59c5a06106..6dbca6eec07fef3 100644 --- a/clang/include/clang/Lex/HeaderSearch.h +++ b/clang/include/clang/Lex/HeaderSearch.h @@ -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); diff --git a/clang/include/clang/Lex/ModuleMap.h b/clang/include/clang/Lex/ModuleMap.h index 8b1ae6944f320a1..fc49742ad4af2c1 100644 --- a/clang/include/clang/Lex/ModuleMap.h +++ b/clang/include/clang/Lex/ModuleMap.h @@ -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) { diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index fc23bbf839334f6..e54a19ebfdbb8f5 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -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. diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 4d93a2d79be721b..e8437572ebf4bf6 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -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) { diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 7edcb0577c2b25a..c3a191b09cb2fa0 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits