diff --git a/include/swift/AST/Requirement.h b/include/swift/AST/Requirement.h index c8b90bbc8b631..61a9c220dc544 100644 --- a/include/swift/AST/Requirement.h +++ b/include/swift/AST/Requirement.h @@ -142,7 +142,7 @@ class Requirement { case RequirementKind::Conformance: case RequirementKind::Superclass: case RequirementKind::SameType: - second = hash_value(requirement.getSecondType()); + second = hash_value(requirement.getSecondType().getPointer()); break; case RequirementKind::Layout: diff --git a/include/swift/AST/Type.h b/include/swift/AST/Type.h index 1e9cf37b95fd9..3b0ac9c9d94f9 100644 --- a/include/swift/AST/Type.h +++ b/include/swift/AST/Type.h @@ -325,11 +325,6 @@ class Type { /// Return the name of the type as a string, for use in diagnostics only. std::string getString(const PrintOptions &PO = PrintOptions()) const; - friend llvm::hash_code hash_value(Type type) { - using llvm::hash_value; - return hash_value(type.getPointer()); - } - /// Return the name of the type, adding parens in cases where /// appending or prepending text to the result would cause that text /// to be appended to only a portion of the returned type. For @@ -502,6 +497,10 @@ class CanType : public Type { bool operator==(CanType T) const { return getPointer() == T.getPointer(); } bool operator!=(CanType T) const { return !operator==(T); } + friend llvm::hash_code hash_value(CanType T) { + return llvm::hash_value(T.getPointer()); + } + bool operator<(CanType T) const { return getPointer() < T.getPointer(); } }; diff --git a/include/swift/AST/Witness.h b/include/swift/AST/Witness.h index 4d72ae77ffd60..18bc1e1879c3b 100644 --- a/include/swift/AST/Witness.h +++ b/include/swift/AST/Witness.h @@ -206,13 +206,13 @@ struct TypeWitnessAndDecl { } friend llvm::hash_code hash_value(const TypeWitnessAndDecl &owner) { - return llvm::hash_combine(owner.witnessType, + return llvm::hash_combine(owner.witnessType.getPointer(), owner.witnessDecl); } friend bool operator==(const TypeWitnessAndDecl &lhs, const TypeWitnessAndDecl &rhs) { - return lhs.witnessType->isEqual(rhs.witnessType) && + return lhs.witnessType.getPointer() == rhs.witnessType.getPointer() && lhs.witnessDecl == rhs.witnessDecl; }