Skip to content

Commit b0abc9d

Browse files
committed
[clang] NFCI: Use FileEntryRef in ASTReader::GetHeaderFileInfo()
This is the `ASTReader` counterpart to PR #67383.
1 parent c718336 commit b0abc9d

File tree

23 files changed

+91
-96
lines changed

23 files changed

+91
-96
lines changed

Diff for: clang-tools-extra/clangd/IncludeCleaner.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool mayConsiderUnused(const Inclusion &Inc, ParsedAST &AST,
102102
// Headers without include guards have side effects and are not
103103
// self-contained, skip them.
104104
if (!AST.getPreprocessor().getHeaderSearchInfo().isFileMultipleIncludeGuarded(
105-
&FE->getFileEntry())) {
105+
*FE)) {
106106
dlog("{0} doesn't have header guard and will not be considered unused",
107107
FE->getName());
108108
return false;

Diff for: clang-tools-extra/clangd/ParsedAST.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
499499
// (The rest of HeaderFileInfo is not relevant for our purposes).
500500
if (Preamble && Preamble->MainIsIncludeGuarded) {
501501
const SourceManager &SM = Clang->getSourceManager();
502-
const FileEntry *MainFE = SM.getFileEntryForID(SM.getMainFileID());
503-
Clang->getPreprocessor().getHeaderSearchInfo().MarkFileIncludeOnce(MainFE);
502+
OptionalFileEntryRef MainFE = SM.getFileEntryRefForID(SM.getMainFileID());
503+
Clang->getPreprocessor().getHeaderSearchInfo().MarkFileIncludeOnce(*MainFE);
504504
}
505505

506506
// Set up ClangTidy. Must happen after BeginSourceFile() so ASTContext exists.

Diff for: clang-tools-extra/clangd/Preamble.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ class CppFilePreambleCallbacks : public PreambleCallbacks {
122122
CapturedCtx.emplace(CI);
123123

124124
const SourceManager &SM = CI.getSourceManager();
125-
const FileEntry *MainFE = SM.getFileEntryForID(SM.getMainFileID());
125+
OptionalFileEntryRef MainFE = SM.getFileEntryRefForID(SM.getMainFileID());
126126
IsMainFileIncludeGuarded =
127127
CI.getPreprocessor().getHeaderSearchInfo().isFileMultipleIncludeGuarded(
128-
MainFE);
128+
*MainFE);
129129

130130
if (Stats) {
131131
const ASTContext &AST = CI.getASTContext();

Diff for: clang-tools-extra/clangd/unittests/ParsedASTTests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,10 @@ std::string once(llvm::StringRef Code) {
465465

466466
bool mainIsGuarded(const ParsedAST &AST) {
467467
const auto &SM = AST.getSourceManager();
468-
const FileEntry *MainFE = SM.getFileEntryForID(SM.getMainFileID());
468+
OptionalFileEntryRef MainFE = SM.getFileEntryRefForID(SM.getMainFileID());
469469
return AST.getPreprocessor()
470470
.getHeaderSearchInfo()
471-
.isFileMultipleIncludeGuarded(MainFE);
471+
.isFileMultipleIncludeGuarded(*MainFE);
472472
}
473473

474474
MATCHER_P(diag, Desc, "") {

Diff for: clang-tools-extra/include-cleaner/lib/Record.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ class PragmaIncludes::RecordPragma : public PPCallbacks, public CommentHandler {
188188
if (Reason == PPCallbacks::ExitFile) {
189189
// At file exit time HeaderSearchInfo is valid and can be used to
190190
// determine whether the file was a self-contained header or not.
191-
if (const FileEntry *FE = SM.getFileEntryForID(PrevFID)) {
192-
if (tooling::isSelfContainedHeader(FE, SM, HeaderInfo))
191+
if (OptionalFileEntryRef FE = SM.getFileEntryRefForID(PrevFID)) {
192+
if (tooling::isSelfContainedHeader(*FE, SM, HeaderInfo))
193193
Out->NonSelfContainedFiles.erase(FE->getUniqueID());
194194
else
195195
Out->NonSelfContainedFiles.insert(FE->getUniqueID());

Diff for: clang/include/clang/Lex/HeaderSearch.h

+11-12
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class ExternalHeaderFileInfoSource {
139139
/// \returns Header file information for the given file entry, with the
140140
/// \c External bit set. If the file entry is not known, return a
141141
/// default-constructed \c HeaderFileInfo.
142-
virtual HeaderFileInfo GetHeaderFileInfo(const FileEntry *FE) = 0;
142+
virtual HeaderFileInfo GetHeaderFileInfo(FileEntryRef FE) = 0;
143143
};
144144

145145
/// This structure is used to record entries in our framework cache.
@@ -487,7 +487,7 @@ class HeaderSearch {
487487
OptionalFileEntryRef LookupFile(
488488
StringRef Filename, SourceLocation IncludeLoc, bool isAngled,
489489
ConstSearchDirIterator FromDir, ConstSearchDirIterator *CurDir,
490-
ArrayRef<std::pair<const FileEntry *, DirectoryEntryRef>> Includers,
490+
ArrayRef<std::pair<OptionalFileEntryRef, DirectoryEntryRef>> Includers,
491491
SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath,
492492
Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule,
493493
bool *IsMapped, bool *IsFrameworkFound, bool SkipCache = false,
@@ -522,33 +522,32 @@ class HeaderSearch {
522522

523523
/// Return whether the specified file is a normal header,
524524
/// a system header, or a C++ friendly system header.
525-
SrcMgr::CharacteristicKind getFileDirFlavor(const FileEntry *File) {
525+
SrcMgr::CharacteristicKind getFileDirFlavor(FileEntryRef File) {
526526
return (SrcMgr::CharacteristicKind)getFileInfo(File).DirInfo;
527527
}
528528

529529
/// Mark the specified file as a "once only" file due to
530530
/// \#pragma once.
531-
void MarkFileIncludeOnce(const FileEntry *File) {
531+
void MarkFileIncludeOnce(FileEntryRef File) {
532532
HeaderFileInfo &FI = getFileInfo(File);
533533
FI.isPragmaOnce = true;
534534
}
535535

536536
/// Mark the specified file as a system header, e.g. due to
537537
/// \#pragma GCC system_header.
538-
void MarkFileSystemHeader(const FileEntry *File) {
538+
void MarkFileSystemHeader(FileEntryRef File) {
539539
getFileInfo(File).DirInfo = SrcMgr::C_System;
540540
}
541541

542542
/// Mark the specified file as part of a module.
543-
void MarkFileModuleHeader(const FileEntry *FE,
544-
ModuleMap::ModuleHeaderRole Role,
543+
void MarkFileModuleHeader(FileEntryRef FE, ModuleMap::ModuleHeaderRole Role,
545544
bool isCompilingModuleHeader);
546545

547546
/// Mark the specified file as having a controlling macro.
548547
///
549548
/// This is used by the multiple-include optimization to eliminate
550549
/// no-op \#includes.
551-
void SetFileControllingMacro(const FileEntry *File,
550+
void SetFileControllingMacro(FileEntryRef File,
552551
const IdentifierInfo *ControllingMacro) {
553552
getFileInfo(File).ControllingMacro = ControllingMacro;
554553
}
@@ -558,10 +557,10 @@ class HeaderSearch {
558557
/// macro.
559558
///
560559
/// This routine does not consider the effect of \#import
561-
bool isFileMultipleIncludeGuarded(const FileEntry *File) const;
560+
bool isFileMultipleIncludeGuarded(FileEntryRef File) const;
562561

563562
/// Determine whether the given file is known to have ever been \#imported.
564-
bool hasFileBeenImported(const FileEntry *File) const {
563+
bool hasFileBeenImported(FileEntryRef File) const {
565564
const HeaderFileInfo *FI = getExistingFileInfo(File);
566565
return FI && FI->isImport;
567566
}
@@ -806,13 +805,13 @@ class HeaderSearch {
806805

807806
/// Return the HeaderFileInfo structure for the specified FileEntry,
808807
/// in preparation for updating it in some way.
809-
HeaderFileInfo &getFileInfo(const FileEntry *FE);
808+
HeaderFileInfo &getFileInfo(FileEntryRef FE);
810809

811810
/// Return the HeaderFileInfo structure for the specified FileEntry,
812811
/// if it has ever been filled in.
813812
/// \param WantExternal Whether the caller wants purely-external header file
814813
/// info (where \p External is true).
815-
const HeaderFileInfo *getExistingFileInfo(const FileEntry *FE,
814+
const HeaderFileInfo *getExistingFileInfo(FileEntryRef FE,
816815
bool WantExternal = true) const;
817816

818817
SearchDirIterator search_dir_begin() { return {*this, 0}; }

Diff for: clang/include/clang/Lex/Preprocessor.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1483,13 +1483,13 @@ class Preprocessor {
14831483

14841484
/// Mark the file as included.
14851485
/// Returns true if this is the first time the file was included.
1486-
bool markIncluded(const FileEntry *File) {
1486+
bool markIncluded(FileEntryRef File) {
14871487
HeaderInfo.getFileInfo(File);
14881488
return IncludedFiles.insert(File).second;
14891489
}
14901490

14911491
/// Return true if this header has already been included.
1492-
bool alreadyIncluded(const FileEntry *File) const {
1492+
bool alreadyIncluded(FileEntryRef File) const {
14931493
HeaderInfo.getFileInfo(File);
14941494
return IncludedFiles.count(File);
14951495
}

Diff for: clang/include/clang/Serialization/ASTReader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@ class ASTReader
18211821
SourceRange ReadSkippedRange(unsigned Index) override;
18221822

18231823
/// Read the header file information for the given file entry.
1824-
HeaderFileInfo GetHeaderFileInfo(const FileEntry *FE) override;
1824+
HeaderFileInfo GetHeaderFileInfo(FileEntryRef FE) override;
18251825

18261826
void ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag);
18271827

Diff for: clang/include/clang/Tooling/Inclusions/HeaderAnalysis.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#ifndef LLVM_CLANG_TOOLING_INCLUSIONS_HEADER_ANALYSIS_H
1010
#define LLVM_CLANG_TOOLING_INCLUSIONS_HEADER_ANALYSIS_H
1111

12+
#include "clang/Basic/FileEntry.h"
1213
#include "llvm/ADT/StringRef.h"
1314
#include <optional>
1415

1516
namespace clang {
16-
class FileEntry;
1717
class SourceManager;
1818
class HeaderSearch;
1919

@@ -27,7 +27,7 @@ namespace tooling {
2727
///
2828
/// This function can be expensive as it may scan the source code to find out
2929
/// dont-include-me pattern heuristically.
30-
bool isSelfContainedHeader(const FileEntry *FE, const SourceManager &SM,
30+
bool isSelfContainedHeader(FileEntryRef FE, const SourceManager &SM,
3131
const HeaderSearch &HeaderInfo);
3232

3333
/// This scans the given source code to see if it contains #import(s).

Diff for: clang/lib/Frontend/FrontendAction.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
830830
HeaderSearch &HS = CI.getPreprocessor().getHeaderSearchInfo();
831831
// Relative searches begin from CWD.
832832
auto Dir = CI.getFileManager().getOptionalDirectoryRef(".");
833-
SmallVector<std::pair<const FileEntry *, DirectoryEntryRef>, 1> CWD;
834-
CWD.push_back({nullptr, *Dir});
833+
SmallVector<std::pair<OptionalFileEntryRef, DirectoryEntryRef>, 1> CWD;
834+
CWD.push_back({std::nullopt, *Dir});
835835
OptionalFileEntryRef FE =
836836
HS.LookupFile(FileName, SourceLocation(),
837837
/*Angled*/ Input.getKind().getHeaderUnitKind() ==

Diff for: clang/lib/Lex/HeaderSearch.cpp

+21-23
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ diagnoseFrameworkInclude(DiagnosticsEngine &Diags, SourceLocation IncludeLoc,
862862
OptionalFileEntryRef HeaderSearch::LookupFile(
863863
StringRef Filename, SourceLocation IncludeLoc, bool isAngled,
864864
ConstSearchDirIterator FromDir, ConstSearchDirIterator *CurDirArg,
865-
ArrayRef<std::pair<const FileEntry *, DirectoryEntryRef>> Includers,
865+
ArrayRef<std::pair<OptionalFileEntryRef, DirectoryEntryRef>> Includers,
866866
SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath,
867867
Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule,
868868
bool *IsMapped, bool *IsFrameworkFound, bool SkipCache,
@@ -913,7 +913,7 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
913913
SmallString<1024> TmpDir;
914914
bool First = true;
915915
for (const auto &IncluderAndDir : Includers) {
916-
const FileEntry *Includer = IncluderAndDir.first;
916+
OptionalFileEntryRef Includer = IncluderAndDir.first;
917917

918918
// Concatenate the requested file onto the directory.
919919
TmpDir = IncluderAndDir.second.getName();
@@ -927,7 +927,7 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
927927
// from a module build. We should treat this as a system header if we're
928928
// building a [system] module.
929929
bool IncluderIsSystemHeader =
930-
Includer ? getFileInfo(Includer).DirInfo != SrcMgr::C_User :
930+
Includer ? getFileInfo(*Includer).DirInfo != SrcMgr::C_User :
931931
BuildSystemModule;
932932
if (OptionalFileEntryRef FE = getFileAndSuggestModule(
933933
TmpDir, IncludeLoc, IncluderAndDir.second, IncluderIsSystemHeader,
@@ -943,12 +943,12 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
943943
// Note that we only use one of FromHFI/ToHFI at once, due to potential
944944
// reallocation of the underlying vector potentially making the first
945945
// reference binding dangling.
946-
HeaderFileInfo &FromHFI = getFileInfo(Includer);
946+
HeaderFileInfo &FromHFI = getFileInfo(*Includer);
947947
unsigned DirInfo = FromHFI.DirInfo;
948948
bool IndexHeaderMapHeader = FromHFI.IndexHeaderMapHeader;
949949
StringRef Framework = FromHFI.Framework;
950950

951-
HeaderFileInfo &ToHFI = getFileInfo(&FE->getFileEntry());
951+
HeaderFileInfo &ToHFI = getFileInfo(*FE);
952952
ToHFI.DirInfo = DirInfo;
953953
ToHFI.IndexHeaderMapHeader = IndexHeaderMapHeader;
954954
ToHFI.Framework = Framework;
@@ -1071,11 +1071,10 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
10711071

10721072
CurDir = It;
10731073

1074-
const auto FE = &File->getFileEntry();
1075-
IncludeNames[FE] = Filename;
1074+
IncludeNames[*File] = Filename;
10761075

10771076
// This file is a system header or C++ unfriendly if the dir is.
1078-
HeaderFileInfo &HFI = getFileInfo(FE);
1077+
HeaderFileInfo &HFI = getFileInfo(*File);
10791078
HFI.DirInfo = CurDir->getDirCharacteristic();
10801079

10811080
// If the directory characteristic is User but this framework was
@@ -1134,7 +1133,7 @@ OptionalFileEntryRef HeaderSearch::LookupFile(
11341133
// "Foo" is the name of the framework in which the including header was found.
11351134
if (!Includers.empty() && Includers.front().first && !isAngled &&
11361135
!Filename.contains('/')) {
1137-
HeaderFileInfo &IncludingHFI = getFileInfo(Includers.front().first);
1136+
HeaderFileInfo &IncludingHFI = getFileInfo(*Includers.front().first);
11381137
if (IncludingHFI.IndexHeaderMapHeader) {
11391138
SmallString<128> ScratchFilename;
11401139
ScratchFilename += IncludingHFI.Framework;
@@ -1272,7 +1271,7 @@ OptionalFileEntryRef HeaderSearch::LookupSubframeworkHeader(
12721271
// getFileInfo could resize the vector and we don't want to rely on order
12731272
// of evaluation.
12741273
unsigned DirInfo = getFileInfo(ContextFileEnt).DirInfo;
1275-
getFileInfo(&File->getFileEntry()).DirInfo = DirInfo;
1274+
getFileInfo(*File).DirInfo = DirInfo;
12761275

12771276
FrameworkName.pop_back(); // remove the trailing '/'
12781277
if (!findUsableModuleForFrameworkHeader(*File, FrameworkName,
@@ -1313,11 +1312,11 @@ static void mergeHeaderFileInfo(HeaderFileInfo &HFI,
13131312

13141313
/// getFileInfo - Return the HeaderFileInfo structure for the specified
13151314
/// FileEntry.
1316-
HeaderFileInfo &HeaderSearch::getFileInfo(const FileEntry *FE) {
1317-
if (FE->getUID() >= FileInfo.size())
1318-
FileInfo.resize(FE->getUID() + 1);
1315+
HeaderFileInfo &HeaderSearch::getFileInfo(FileEntryRef FE) {
1316+
if (FE.getUID() >= FileInfo.size())
1317+
FileInfo.resize(FE.getUID() + 1);
13191318

1320-
HeaderFileInfo *HFI = &FileInfo[FE->getUID()];
1319+
HeaderFileInfo *HFI = &FileInfo[FE.getUID()];
13211320
// FIXME: Use a generation count to check whether this is really up to date.
13221321
if (ExternalSource && !HFI->Resolved) {
13231322
auto ExternalHFI = ExternalSource->GetHeaderFileInfo(FE);
@@ -1336,19 +1335,18 @@ HeaderFileInfo &HeaderSearch::getFileInfo(const FileEntry *FE) {
13361335
}
13371336

13381337
const HeaderFileInfo *
1339-
HeaderSearch::getExistingFileInfo(const FileEntry *FE,
1340-
bool WantExternal) const {
1338+
HeaderSearch::getExistingFileInfo(FileEntryRef FE, bool WantExternal) const {
13411339
// If we have an external source, ensure we have the latest information.
13421340
// FIXME: Use a generation count to check whether this is really up to date.
13431341
HeaderFileInfo *HFI;
13441342
if (ExternalSource) {
1345-
if (FE->getUID() >= FileInfo.size()) {
1343+
if (FE.getUID() >= FileInfo.size()) {
13461344
if (!WantExternal)
13471345
return nullptr;
1348-
FileInfo.resize(FE->getUID() + 1);
1346+
FileInfo.resize(FE.getUID() + 1);
13491347
}
13501348

1351-
HFI = &FileInfo[FE->getUID()];
1349+
HFI = &FileInfo[FE.getUID()];
13521350
if (!WantExternal && (!HFI->IsValid || HFI->External))
13531351
return nullptr;
13541352
if (!HFI->Resolved) {
@@ -1359,10 +1357,10 @@ HeaderSearch::getExistingFileInfo(const FileEntry *FE,
13591357
mergeHeaderFileInfo(*HFI, ExternalHFI);
13601358
}
13611359
}
1362-
} else if (FE->getUID() >= FileInfo.size()) {
1360+
} else if (FE.getUID() >= FileInfo.size()) {
13631361
return nullptr;
13641362
} else {
1365-
HFI = &FileInfo[FE->getUID()];
1363+
HFI = &FileInfo[FE.getUID()];
13661364
}
13671365

13681366
if (!HFI->IsValid || (HFI->External && !WantExternal))
@@ -1371,7 +1369,7 @@ HeaderSearch::getExistingFileInfo(const FileEntry *FE,
13711369
return HFI;
13721370
}
13731371

1374-
bool HeaderSearch::isFileMultipleIncludeGuarded(const FileEntry *File) const {
1372+
bool HeaderSearch::isFileMultipleIncludeGuarded(FileEntryRef File) const {
13751373
// Check if we've entered this file and found an include guard or #pragma
13761374
// once. Note that we dor't check for #import, because that's not a property
13771375
// of the file itself.
@@ -1381,7 +1379,7 @@ bool HeaderSearch::isFileMultipleIncludeGuarded(const FileEntry *File) const {
13811379
return false;
13821380
}
13831381

1384-
void HeaderSearch::MarkFileModuleHeader(const FileEntry *FE,
1382+
void HeaderSearch::MarkFileModuleHeader(FileEntryRef FE,
13851383
ModuleMap::ModuleHeaderRole Role,
13861384
bool isCompilingModuleHeader) {
13871385
bool isModularHeader = ModuleMap::isModular(Role);

Diff for: clang/lib/Lex/PPDirectives.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ OptionalFileEntryRef Preprocessor::LookupFile(
961961

962962
// If the header lookup mechanism may be relative to the current inclusion
963963
// stack, record the parent #includes.
964-
SmallVector<std::pair<const FileEntry *, DirectoryEntryRef>, 16> Includers;
964+
SmallVector<std::pair<OptionalFileEntryRef, DirectoryEntryRef>, 16> Includers;
965965
bool BuildSystemModule = false;
966966
if (!FromDir && !FromFile) {
967967
FileID FID = getCurrentFileLexer()->getFileID();
@@ -981,7 +981,7 @@ OptionalFileEntryRef Preprocessor::LookupFile(
981981
// map file.
982982
if (!FileEnt) {
983983
if (FID == SourceMgr.getMainFileID() && MainFileDir) {
984-
Includers.push_back(std::make_pair(nullptr, *MainFileDir));
984+
Includers.push_back(std::make_pair(std::nullopt, *MainFileDir));
985985
BuildSystemModule = getCurrentModule()->IsSystem;
986986
} else if ((FileEnt = SourceMgr.getFileEntryRefForID(
987987
SourceMgr.getMainFileID()))) {
@@ -2325,8 +2325,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport(
23252325
SrcMgr::CharacteristicKind FileCharacter =
23262326
SourceMgr.getFileCharacteristic(FilenameTok.getLocation());
23272327
if (File)
2328-
FileCharacter = std::max(HeaderInfo.getFileDirFlavor(&File->getFileEntry()),
2329-
FileCharacter);
2328+
FileCharacter = std::max(HeaderInfo.getFileDirFlavor(*File), FileCharacter);
23302329

23312330
// If this is a '#import' or an import-declaration, don't re-enter the file.
23322331
//

Diff for: clang/lib/Lex/PPLexerChange.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) {
366366
if (const IdentifierInfo *ControllingMacro =
367367
CurPPLexer->MIOpt.GetControllingMacroAtEndOfFile()) {
368368
// Okay, this has a controlling macro, remember in HeaderFileInfo.
369-
if (const FileEntry *FE = CurPPLexer->getFileEntry()) {
370-
HeaderInfo.SetFileControllingMacro(FE, ControllingMacro);
369+
if (OptionalFileEntryRef FE = CurPPLexer->getFileEntry()) {
370+
HeaderInfo.SetFileControllingMacro(*FE, ControllingMacro);
371371
if (MacroInfo *MI =
372372
getMacroInfo(const_cast<IdentifierInfo*>(ControllingMacro)))
373373
MI->setUsedForHeaderGuard(true);

Diff for: clang/lib/Lex/PPMacroExpansion.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1256,8 +1256,7 @@ static bool EvaluateHasIncludeCommon(Token &Tok, IdentifierInfo *II,
12561256
if (PPCallbacks *Callbacks = PP.getPPCallbacks()) {
12571257
SrcMgr::CharacteristicKind FileType = SrcMgr::C_User;
12581258
if (File)
1259-
FileType =
1260-
PP.getHeaderSearchInfo().getFileDirFlavor(&File->getFileEntry());
1259+
FileType = PP.getHeaderSearchInfo().getFileDirFlavor(*File);
12611260
Callbacks->HasInclude(FilenameLoc, Filename, isAngled, File, FileType);
12621261
}
12631262

0 commit comments

Comments
 (0)