This patch replaces a lot of index-based loops with iterators and ranges.
Depends on D117566.
Paths 
  |  Differential  D119722  
[clang][lex] Use `SearchDirIterator` types in for loops ClosedPublic Authored by jansvoboda11 on Feb 14 2022, 7:34 AM. 
Details Summary This patch replaces a lot of index-based loops with iterators and ranges. Depends on D117566. 
Diff Detail 
 Event Timelinejansvoboda11 created this revision. Comment Actions Nice. I think this reads a lot better than the index-based implementation. 
 
 This revision is now accepted and ready to land.Feb 15 2022, 12:47 AM This revision was landed with ongoing or failed builds.Feb 15 2022, 2:04 AM Closed by commit rGe7dcf09fc321: [clang][lex] Use `SearchDirIterator` types in for loops (authored by jansvoboda11).  ·  Explain Why This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
 
 
Diff 408724 clang/include/clang/Lex/HeaderSearch.h
 clang/lib/Lex/HeaderSearch.cpp
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Could we change this function to return an unsigned instead of Optional<unsigned> now?
Also, is &DL - &*SearchDirs.begin() safe and doesn’t trigger the issues we saw previously if start and end are allocated in different memory regions, because I don’t know.