diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2023-09-09 10:14:57 -0700 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2023-09-09 21:50:38 -0700 |
commit | e483a6e174f5e06ae46d870c5263b489db4b9e65 (patch) | |
tree | 712609cad105d959c0b7363864ad1ad488a8aecb | |
parent | 33f19a6f1c279f5f77a577fae41f13133522497b (diff) | |
download | llvm-e483a6e174f5e06ae46d870c5263b489db4b9e65.zip llvm-e483a6e174f5e06ae46d870c5263b489db4b9e65.tar.gz llvm-e483a6e174f5e06ae46d870c5263b489db4b9e65.tar.bz2 |
[clang] NFCI: Use `FileEntryRef` in `LookupSubframeworkHeader()`
-rw-r--r-- | clang/include/clang/Lex/HeaderSearch.h | 2 | ||||
-rw-r--r-- | clang/lib/Lex/HeaderSearch.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 6 |
3 files changed, 6 insertions, 8 deletions
diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h index cec3a31..347c4ec 100644 --- a/clang/include/clang/Lex/HeaderSearch.h +++ b/clang/include/clang/Lex/HeaderSearch.h @@ -501,7 +501,7 @@ public: /// HIToolbox is a subframework within Carbon.framework. If so, return /// the FileEntry for the designated file, otherwise return null. OptionalFileEntryRef LookupSubframeworkHeader( - StringRef Filename, const FileEntry *ContextFileEnt, + StringRef Filename, FileEntryRef ContextFileEnt, SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule); diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 83ed2a9..e7195cb 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -1178,11 +1178,9 @@ OptionalFileEntryRef HeaderSearch::LookupFile( /// is a subframework within Carbon.framework. If so, return the FileEntry /// for the designated file, otherwise return null. OptionalFileEntryRef HeaderSearch::LookupSubframeworkHeader( - StringRef Filename, const FileEntry *ContextFileEnt, + StringRef Filename, FileEntryRef ContextFileEnt, SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule) { - assert(ContextFileEnt && "No context file?"); - // Framework names must have a '/' in the filename. Find it. // FIXME: Should we permit '\' on Windows? size_t SlashPos = Filename.find('/'); @@ -1190,7 +1188,7 @@ OptionalFileEntryRef HeaderSearch::LookupSubframeworkHeader( return std::nullopt; // Look up the base framework name of the ContextFileEnt. - StringRef ContextName = ContextFileEnt->getName(); + StringRef ContextName = ContextFileEnt.getName(); // If the context info wasn't a framework, couldn't be a subframework. const unsigned DotFrameworkLen = 10; diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 7bb4dd3..7edcb05 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1041,14 +1041,14 @@ OptionalFileEntryRef Preprocessor::LookupFile( return FE; } - const FileEntry *CurFileEnt; + OptionalFileEntryRef CurFileEnt; // Otherwise, see if this is a subframework header. If so, this is relative // to one of the headers on the #include stack. Walk the list of the current // headers on the #include stack and pass them to HeaderInfo. if (IsFileLexer()) { if ((CurFileEnt = CurPPLexer->getFileEntry())) { if (OptionalFileEntryRef FE = HeaderInfo.LookupSubframeworkHeader( - Filename, CurFileEnt, SearchPath, RelativePath, RequestingModule, + Filename, *CurFileEnt, SearchPath, RelativePath, RequestingModule, SuggestedModule)) { if (SuggestedModule && !LangOpts.AsmPreprocessor) HeaderInfo.getModuleMap().diagnoseHeaderInclusion( @@ -1063,7 +1063,7 @@ OptionalFileEntryRef Preprocessor::LookupFile( if (IsFileLexer(ISEntry)) { if ((CurFileEnt = ISEntry.ThePPLexer->getFileEntry())) { if (OptionalFileEntryRef FE = HeaderInfo.LookupSubframeworkHeader( - Filename, CurFileEnt, SearchPath, RelativePath, + Filename, *CurFileEnt, SearchPath, RelativePath, RequestingModule, SuggestedModule)) { if (SuggestedModule && !LangOpts.AsmPreprocessor) HeaderInfo.getModuleMap().diagnoseHeaderInclusion( |