[PATCH] D137179: [clang][Lex] Header map search case insensitivity

Troy Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 1 11:37:38 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG00022c5613a7: [clang][Lex] Header map search case insensitivity (authored by troyj).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137179/new/

https://reviews.llvm.org/D137179

Files:
  clang/lib/Lex/HeaderSearch.cpp


Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -388,7 +388,9 @@
       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);
   }
 
@@ -1021,7 +1023,7 @@
         // 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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137179.472362.patch
Type: text/x-patch
Size: 1093 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221101/b2bc593a/attachment.bin>


More information about the cfe-commits mailing list