dexonsmith added inline comments.

================
Comment at: clang/include/clang/Basic/SourceManager.h:652-662
+  llvm::DenseMap<FileEntryRef, SrcMgr::NamedContentCache *,
+                 FileEntryRefSameRefDenseMapInfo>
+      NamedFileInfos;
+
   /// Memoized information about all of the files tracked by this
   /// SourceManager.
   ///
----------------
It feels expensive to have both of these maps. I wonder if instead we could do 
something like:

```
lang=c++
DenseMap<const FileEntry*, TinyPtrSet<NamedContentCache*>> FirstFileInfo;
```
I.e., lookup by `FileEntry*`, then linear search for the right `FileEntryRef`.

Similar idea: just point at `NamedContentCache*` directly here, but add 
`NamedContentCache *NamedContentCache::Next` to turn it into a linked list. 
Also lookup by `FileEntry*` and then a linear search for the right ref.

Note that `FileInfo` itself would have a direct pointer to the right thing; no 
need for a linear search.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137304

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

Reply via email to