diff options
author | Anders Carlsson <andersca@mac.com> | 2010-01-14 01:39:42 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-01-14 01:39:42 +0000 |
commit | 7e37a6981b8d8c7dc4caee4d05487978ff2cd770 (patch) | |
tree | 931115f36af9250868e7796b9ea53e9f808853e9 | |
parent | e3eef64ae7a730f3611a08b133a08b786a3773a8 (diff) |
Add a DenseMapInfo specialization for BaseSubobject.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93399 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGVtable.h | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/lib/CodeGen/CGVtable.h b/lib/CodeGen/CGVtable.h index b479814123..0caaec2816 100644 --- a/lib/CodeGen/CGVtable.h +++ b/lib/CodeGen/CGVtable.h @@ -80,12 +80,47 @@ public: /// getBaseOffset - Returns the base class offset. uint64_t getBaseOffset() const { return BaseOffset; } - + friend bool operator==(const BaseSubobject &LHS, const BaseSubobject &RHS) { return LHS.Base == RHS.Base && LHS.BaseOffset == RHS.BaseOffset; } }; - + +} // end namespace CodeGen +} // end namespace clang + +namespace llvm { + +template<> struct DenseMapInfo<clang::CodeGen::BaseSubobject> { + static clang::CodeGen::BaseSubobject getEmptyKey() { + return clang::CodeGen::BaseSubobject( + DenseMapInfo<const clang::CXXRecordDecl *>::getEmptyKey(), + DenseMapInfo<uint64_t>::getEmptyKey()); + } + + static clang::CodeGen::BaseSubobject getTombstoneKey() { + return clang::CodeGen::BaseSubobject( + DenseMapInfo<const clang::CXXRecordDecl *>::getTombstoneKey(), + DenseMapInfo<uint64_t>::getTombstoneKey()); + } + + static unsigned getHashValue(const clang::CodeGen::BaseSubobject &Base) { + return + DenseMapInfo<const clang::CXXRecordDecl *>::getHashValue(Base.getBase()) ^ + DenseMapInfo<uint64_t>::getHashValue(Base.getBaseOffset()); + } + + static bool isEqual(const clang::CodeGen::BaseSubobject &LHS, + const clang::CodeGen::BaseSubobject &RHS) { + return LHS == RHS; + } +}; + +} + +namespace clang { +namespace CodeGen { + class CGVtableInfo { public: typedef std::vector<std::pair<GlobalDecl, ThunkAdjustment> > |