Skip to content

Commit

Permalink
[clang] NFCI: Use FileEntryRef in checkMSVCHeaderSearch()
Browse files Browse the repository at this point in the history
  • Loading branch information
jansvoboda11 committed Sep 9, 2023
1 parent c6a101d commit 358d9db
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions clang/lib/Lex/HeaderSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,9 +756,10 @@ void HeaderSearch::setTarget(const TargetInfo &Target) {
/// fails to match the one that Clang would have found with MSVC header search
/// disabled.
static bool checkMSVCHeaderSearch(DiagnosticsEngine &Diags,
const FileEntry *MSFE, const FileEntry *FE,
OptionalFileEntryRef MSFE,
const FileEntry *FE,
SourceLocation IncludeLoc) {
if (MSFE && FE != MSFE) {
if (MSFE && FE != *MSFE) {
Diags.Report(IncludeLoc, diag::ext_pp_include_search_ms) << MSFE->getName();
return true;
}
Expand Down Expand Up @@ -1110,8 +1111,7 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
getUniqueFrameworkName(StringRef(Filename.begin(), SlashPos));
}

if (checkMSVCHeaderSearch(Diags, MSFE ? &MSFE->getFileEntry() : nullptr,
&File->getFileEntry(), IncludeLoc)) {
if (checkMSVCHeaderSearch(Diags, MSFE, &File->getFileEntry(), IncludeLoc)) {
if (SuggestedModule)
*SuggestedModule = MSSuggestedModule;
return MSFE;
Expand Down Expand Up @@ -1146,7 +1146,7 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
Includers.front(), SearchPath, RelativePath, RequestingModule,
SuggestedModule, IsMapped, /*IsFrameworkFound=*/nullptr);

if (checkMSVCHeaderSearch(Diags, MSFE ? &MSFE->getFileEntry() : nullptr,
if (checkMSVCHeaderSearch(Diags, MSFE,
File ? &File->getFileEntry() : nullptr,
IncludeLoc)) {
if (SuggestedModule)
Expand All @@ -1161,8 +1161,7 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
}
}

if (checkMSVCHeaderSearch(Diags, MSFE ? &MSFE->getFileEntry() : nullptr,
nullptr, IncludeLoc)) {
if (checkMSVCHeaderSearch(Diags, MSFE, nullptr, IncludeLoc)) {
if (SuggestedModule)
*SuggestedModule = MSSuggestedModule;
return MSFE;
Expand Down

0 comments on commit 358d9db

Please sign in to comment.