Skip to content

Commit

Permalink
[clang] NFCI: Use FileEntryRef in CreateHeaderMap()
Browse files Browse the repository at this point in the history
  • Loading branch information
jansvoboda11 committed Sep 10, 2023
1 parent e644f59 commit 89bacc0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions clang/include/clang/Lex/HeaderSearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class HeaderSearch {
std::unique_ptr<IncludeAliasMap> IncludeAliases;

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

/// The mapping between modules and headers.
mutable ModuleMap ModMap;
Expand Down Expand Up @@ -573,7 +573,7 @@ class HeaderSearch {

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

/// Get filenames for all registered header maps.
void getHeaderMapFileNames(SmallVectorImpl<std::string> &Names) const;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Lex/HeaderSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ std::vector<bool> HeaderSearch::computeUserEntryUsage() const {

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

std::string HeaderSearch::getCachedModuleFileName(Module *Module) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Lex/InitHeaderSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ bool InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
// Check to see if this is an apple-style headermap (which are not allowed to
// be frameworks).
if (!isFramework) {
if (auto FE = FM.getFile(MappedPathStr)) {
if (auto FE = FM.getOptionalFileRef(MappedPathStr)) {
if (const HeaderMap *HM = Headers.CreateHeaderMap(*FE)) {
// It is a headermap, add it to the search path.
IncludePath.emplace_back(
Expand Down

0 comments on commit 89bacc0

Please sign in to comment.