Skip to content

Commit b969940

Browse files
committed
[NFC] AST: Define DenseMapInfo<KnownProtocolKind>.
1 parent 1d1e10a commit b969940

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

include/swift/AST/KnownProtocols.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,27 @@ void simple_display(llvm::raw_ostream &out,
7171

7272
} // end namespace swift
7373

74+
namespace llvm {
75+
template <typename T, typename Enable>
76+
struct DenseMapInfo;
77+
template <>
78+
struct DenseMapInfo<swift::KnownProtocolKind> {
79+
using KnownProtocolKind = swift::KnownProtocolKind;
80+
using Impl = DenseMapInfo<uint8_t>;
81+
static inline KnownProtocolKind getEmptyKey() {
82+
return (KnownProtocolKind)Impl::getEmptyKey();
83+
}
84+
static inline KnownProtocolKind getTombstoneKey() {
85+
return (KnownProtocolKind)Impl::getTombstoneKey();
86+
}
87+
static unsigned getHashValue(const KnownProtocolKind &Val) {
88+
return Impl::getHashValue((uint8_t)Val);
89+
}
90+
static bool isEqual(const KnownProtocolKind &LHS,
91+
const KnownProtocolKind &RHS) {
92+
return LHS == RHS;
93+
}
94+
};
95+
} // namespace llvm
96+
7497
#endif

0 commit comments

Comments
 (0)