ahoppen added inline comments.

================
Comment at: clang/lib/Lex/HeaderSearch.cpp:710
+  CacheLookup.HitIt = HitIt;
+  noteLookupUsage(&*HitIt - &*search_dir_begin(), Loc);
 }
----------------
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?


================
Comment at: clang/lib/Lex/HeaderSearch.cpp:982
 
+  ConstSearchDirIterator NextIt = [](auto ItCopy) { return ++ItCopy; }(It);
+
----------------
What’s the reason that this can’t be? The current lambda-based implementation 
looks a little over-complicated to me. But maybe I’m missing something.
```
ConstSearchDirIterator NextIt = ItCopy;
++NextIt;
```

or even something equivalent to 
```
ConstSearchDirIterator NextIt = std::next(ItCopy);
```


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