Skip to content

Commit 89bacc0

Browse files
committed
[clang] NFCI: Use FileEntryRef in CreateHeaderMap()
1 parent e644f59 commit 89bacc0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

clang/include/clang/Lex/HeaderSearch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class HeaderSearch {
316316
std::unique_ptr<IncludeAliasMap> IncludeAliases;
317317

318318
/// This is a mapping from FileEntry -> HeaderMap, uniquing headermaps.
319-
std::vector<std::pair<const FileEntry *, std::unique_ptr<HeaderMap>>> HeaderMaps;
319+
std::vector<std::pair<FileEntryRef, std::unique_ptr<HeaderMap>>> HeaderMaps;
320320

321321
/// The mapping between modules and headers.
322322
mutable ModuleMap ModMap;
@@ -573,7 +573,7 @@ class HeaderSearch {
573573

574574
/// This method returns a HeaderMap for the specified
575575
/// FileEntry, uniquing them through the 'HeaderMaps' datastructure.
576-
const HeaderMap *CreateHeaderMap(const FileEntry *FE);
576+
const HeaderMap *CreateHeaderMap(FileEntryRef FE);
577577

578578
/// Get filenames for all registered header maps.
579579
void getHeaderMapFileNames(SmallVectorImpl<std::string> &Names) const;

clang/lib/Lex/HeaderSearch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ std::vector<bool> HeaderSearch::computeUserEntryUsage() const {
144144

145145
/// CreateHeaderMap - This method returns a HeaderMap for the specified
146146
/// FileEntry, uniquing them through the 'HeaderMaps' datastructure.
147-
const HeaderMap *HeaderSearch::CreateHeaderMap(const FileEntry *FE) {
147+
const HeaderMap *HeaderSearch::CreateHeaderMap(FileEntryRef FE) {
148148
// We expect the number of headermaps to be small, and almost always empty.
149149
// If it ever grows, use of a linear search should be re-evaluated.
150150
if (!HeaderMaps.empty()) {
@@ -167,7 +167,7 @@ const HeaderMap *HeaderSearch::CreateHeaderMap(const FileEntry *FE) {
167167
void HeaderSearch::getHeaderMapFileNames(
168168
SmallVectorImpl<std::string> &Names) const {
169169
for (auto &HM : HeaderMaps)
170-
Names.push_back(std::string(HM.first->getName()));
170+
Names.push_back(std::string(HM.first.getName()));
171171
}
172172

173173
std::string HeaderSearch::getCachedModuleFileName(Module *Module) {

clang/lib/Lex/InitHeaderSearch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ bool InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
167167
// Check to see if this is an apple-style headermap (which are not allowed to
168168
// be frameworks).
169169
if (!isFramework) {
170-
if (auto FE = FM.getFile(MappedPathStr)) {
170+
if (auto FE = FM.getOptionalFileRef(MappedPathStr)) {
171171
if (const HeaderMap *HM = Headers.CreateHeaderMap(*FE)) {
172172
// It is a headermap, add it to the search path.
173173
IncludePath.emplace_back(

0 commit comments

Comments
 (0)