[PATCH] D116750: [clang][lex] Keep search directory indices up-to-date
    Jan Svoboda via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Fri Jan  7 04:43:14 PST 2022
    
    
  
jansvoboda11 added a comment.
In D116750#3227143 <https://reviews.llvm.org/D116750#3227143>, @ahoppen wrote:
> Adjusting the indices seem pretty fragile to me. Any reason why you wanted to stick with indices as keys instead of switching to something else like I suggested here <https://reviews.llvm.org/D113676#3137288>?
I've implemented your suggestion locally like so:
  llvm::SpecificBumpPtrAllocator<DirectoryLookup> SearchDirsAlloc;
  std::vector<DirectoryLookup *> SearchDirs;
  llvm::DenseMap<const DirectoryLookup *, unsigned> SearchDirToHSEntry;
  ...
In the end, I decided to stick with just updating the indices to avoid creating unnecessary indirection (and replacing `.` with `->` everywhere).
I don't have any preference though, so if you feel strongly about the fragility, I can use addresses to refer to `DirectoryLookup` objects instead of indices.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116750/new/
https://reviews.llvm.org/D116750
    
    
More information about the cfe-commits
mailing list