[PATCH] D92627: Basic: Add hashing support for FileEntryRef and DirectoryEntryRef

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 8 18:11:53 PST 2020


dexonsmith added a comment.

Thanks for the reviews! Pushed 2878e965af27ce037378a4f0409e89039108c09f <https://reviews.llvm.org/rG2878e965af27ce037378a4f0409e89039108c09f>.



================
Comment at: clang/include/clang/Basic/DirectoryEntry.h:104
+  bool isSpecialDenseMapKey() const {
+    return ME == llvm::DenseMapInfo<const MapEntry *>::getEmptyKey() ||
+           ME == llvm::DenseMapInfo<const MapEntry *>::getTombstoneKey();
----------------
dexonsmith wrote:
> jansvoboda11 wrote:
> > Nit: would it make sense to avoid copy-pasting the constructor logic here (`llvm::DenseMapInfo<const MapEntry *>::getEmptyKey()`) and call the constructor instead?
> > For example: `isSameRef(DirectoryEntryRef(dense_map_empty_tag{}))`.
> > 
> > The same goes for `FileEntryRef`.
> Yes, that seems decent; I hadn't considered using `isSameRef` when the `MapEntry` is a bogus pointer, but that's probably better too. I'll update this and the instance of that below.
Incorporated those suggestions (and the nit below) in the commit I pushed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92627



More information about the cfe-commits mailing list