Skip to content

Commit 358d9db

Browse files
committed
[clang] NFCI: Use FileEntryRef in checkMSVCHeaderSearch()
1 parent c6a101d commit 358d9db

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

clang/lib/Lex/HeaderSearch.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -756,9 +756,10 @@ void HeaderSearch::setTarget(const TargetInfo &Target) {
756756
/// fails to match the one that Clang would have found with MSVC header search
757757
/// disabled.
758758
static bool checkMSVCHeaderSearch(DiagnosticsEngine &Diags,
759-
const FileEntry *MSFE, const FileEntry *FE,
759+
OptionalFileEntryRef MSFE,
760+
const FileEntry *FE,
760761
SourceLocation IncludeLoc) {
761-
if (MSFE && FE != MSFE) {
762+
if (MSFE && FE != *MSFE) {
762763
Diags.Report(IncludeLoc, diag::ext_pp_include_search_ms) << MSFE->getName();
763764
return true;
764765
}
@@ -1110,8 +1111,7 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
11101111
getUniqueFrameworkName(StringRef(Filename.begin(), SlashPos));
11111112
}
11121113

1113-
if (checkMSVCHeaderSearch(Diags, MSFE ? &MSFE->getFileEntry() : nullptr,
1114-
&File->getFileEntry(), IncludeLoc)) {
1114+
if (checkMSVCHeaderSearch(Diags, MSFE, &File->getFileEntry(), IncludeLoc)) {
11151115
if (SuggestedModule)
11161116
*SuggestedModule = MSSuggestedModule;
11171117
return MSFE;
@@ -1146,7 +1146,7 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
11461146
Includers.front(), SearchPath, RelativePath, RequestingModule,
11471147
SuggestedModule, IsMapped, /*IsFrameworkFound=*/nullptr);
11481148

1149-
if (checkMSVCHeaderSearch(Diags, MSFE ? &MSFE->getFileEntry() : nullptr,
1149+
if (checkMSVCHeaderSearch(Diags, MSFE,
11501150
File ? &File->getFileEntry() : nullptr,
11511151
IncludeLoc)) {
11521152
if (SuggestedModule)
@@ -1161,8 +1161,7 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
11611161
}
11621162
}
11631163

1164-
if (checkMSVCHeaderSearch(Diags, MSFE ? &MSFE->getFileEntry() : nullptr,
1165-
nullptr, IncludeLoc)) {
1164+
if (checkMSVCHeaderSearch(Diags, MSFE, nullptr, IncludeLoc)) {
11661165
if (SuggestedModule)
11671166
*SuggestedModule = MSSuggestedModule;
11681167
return MSFE;

0 commit comments

Comments
 (0)