[PATCH] D43696: Reduce hash collisions for reference and pointer types

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 23 14:15:57 PST 2018


v.g.vassilev created this revision.
v.g.vassilev added reviewers: rtrieu, rsmith.

While investigating the work done in D41416 <https://reviews.llvm.org/D41416> I found out that the hash values for pointer and reference types are the same.


Repository:
  rC Clang

https://reviews.llvm.org/D43696

Files:
  lib/AST/ODRHash.cpp


Index: lib/AST/ODRHash.cpp
===================================================================
--- lib/AST/ODRHash.cpp
+++ lib/AST/ODRHash.cpp
@@ -577,7 +577,19 @@
     Inherited::Visit(T);
   }
 
-  void VisitType(const Type *T) {}
+  void VisitType(const Type *T) {
+    ID.AddInteger(T->getTypeClass());
+  }
+
+  void VisitPointerType(const PointerType *T) {
+    AddQualType(T->getPointeeType());
+    VisitType(T);
+  }
+
+  void VisitReferenceType(const ReferenceType *T) {
+    AddQualType(T->getPointeeType());
+    VisitType(T);
+  }
 
   void VisitAdjustedType(const AdjustedType *T) {
     AddQualType(T->getOriginalType());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43696.135699.patch
Type: text/x-patch
Size: 637 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180223/2f79fa67/attachment.bin>


More information about the cfe-commits mailing list