[PATCH] D136019: [clang][lex] Avoid `DirectoryLookup` copies

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 15 08:43:39 PDT 2022


jansvoboda11 created this revision.
jansvoboda11 added reviewers: ributzka, friss, vsapsai, arphaman.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch fixes a performance regression introduced in D121685 <https://reviews.llvm.org/D121685> that was caused by copying `DirectoryLookup`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136019

Files:
  clang/lib/Lex/HeaderSearch.cpp


Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -304,7 +304,7 @@
 
   // Look through the various header search paths to load any available module
   // maps, searching for a module map that describes this module.
-  for (DirectoryLookup Dir : search_dir_range()) {
+  for (DirectoryLookup &Dir : search_dir_range()) {
     if (Dir.isFramework()) {
       // Search for or infer a module map for a framework. Here we use
       // SearchName rather than ModuleName, to permit finding private modules


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136019.468022.patch
Type: text/x-patch
Size: 631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221015/13527589/attachment.bin>


More information about the cfe-commits mailing list