jansvoboda11 added inline comments.

================
Comment at: clang/lib/Lex/HeaderSearch.cpp:710
+  CacheLookup.HitIt = HitIt;
+  noteLookupUsage(&*HitIt - &*search_dir_begin(), Loc);
 }
----------------
jansvoboda11 wrote:
> ahoppen wrote:
> > I haven’t looked into this in total details but `&*` looks a little awkward 
> > to me. Dereference a pointer/iteration and then get its pointer value back? 
> > 
> > Wouldn’t this hit the same issue that we saw before if `serach_dir_begin` 
> > is allocated in a different bump allocator begin than `HitIt`?
> > 
> > If possible, would `std::distance` communicate the intent more clearly?
> This should really call to `searchDirIdx()`. That will be updated when we 
> switch to different storage type in a follow up commit.
> 
> Since we're using forward iterators, calling `std::distance` would be O(n) 
> instead of the current O(1).
(Used `ConstSearchDirIterator::Idx` for now, but will refactor this with the 
new storage layout in a follow-up.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119721

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to