[clang] de9731b - [clang][lex] Avoid `DirectoryLookup` copies

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 20 16:12:39 PDT 2022


Author: Jan Svoboda
Date: 2022-10-20T16:12:34-07:00
New Revision: de9731b7033f0393144299d19765a16cb6ae331f

URL: https://github.com/llvm/llvm-project/commit/de9731b7033f0393144299d19765a16cb6ae331f
DIFF: https://github.com/llvm/llvm-project/commit/de9731b7033f0393144299d19765a16cb6ae331f.diff

LOG: [clang][lex] Avoid `DirectoryLookup` copies

This patch fixes a performance regression introduced in D121685 that was caused by copying `DirectoryLookup`.

rdar://101206790

Reviewed By: ributzka

Differential Revision: https://reviews.llvm.org/D136019

Added: 
    

Modified: 
    clang/lib/Lex/HeaderSearch.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index dd82f4280edb5..72303452f9334 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -305,7 +305,7 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName,
 
   // 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


        


More information about the cfe-commits mailing list