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

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


troyj created this revision.
troyj added a reviewer: bruno.
Herald added a project: All.
troyj requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Correct D135801 <https://reviews.llvm.org/D135801> to be case insensitive.


Repository:
  rG LLVM Github Monorepo

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.472357.patch
Type: text/x-patch
Size: 1093 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221101/5371a7f8/attachment.bin>


More information about the cfe-commits mailing list