Skip to content

Commit

Permalink
[clang][Lex] Header map search case insensitivity
Browse files Browse the repository at this point in the history
Correct D135801 to be case insensitive.

Differential Revision: https://reviews.llvm.org/D137179
  • Loading branch information
troyj-gh committed Nov 1, 2022
1 parent d225ff3 commit 00022c5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clang/lib/Lex/HeaderSearch.cpp
Expand Up @@ -388,7 +388,9 @@ void HeaderSearch::indexInitialHeaderMaps() {
break;

// Give earlier keys precedence over identical later keys.
auto Callback = [&](StringRef Filename) { Index.try_emplace(Filename, i); };
auto Callback = [&](StringRef Filename) {
Index.try_emplace(Filename.lower(), i);
};
Dir.getHeaderMap()->forEachKey(Callback);
}

Expand Down Expand Up @@ -1021,7 +1023,7 @@ Optional<FileEntryRef> HeaderSearch::LookupFile(
// Handle cold misses of user includes in the presence of many header
// maps. We avoid searching perhaps thousands of header maps by
// jumping directly to the correct one or jumping beyond all of them.
auto Iter = SearchDirHeaderMapIndex.find(Filename);
auto Iter = SearchDirHeaderMapIndex.find(Filename.lower());
if (Iter == SearchDirHeaderMapIndex.end())
// Not in index => Skip to first SearchDir after initial header maps
It = search_dir_nth(FirstNonHeaderMapSearchDirIdx);
Expand Down

0 comments on commit 00022c5

Please sign in to comment.