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 | 2a4adbea9659d8ccf32a5e240190e3bec323bf43 (patch) | |
tree | c71668449122e42b0a5a9a701df0ff6645d75af1 /clang/lib/CodeGen/CGVtable.h | |
parent | 69a8e083c5e0ecb741b6e287e557c1e0c384efc4 (diff) | |
download | bcm5719-llvm-2a4adbea9659d8ccf32a5e240190e3bec323bf43.tar.gz bcm5719-llvm-2a4adbea9659d8ccf32a5e240190e3bec323bf43.zip |
Add a DenseMapInfo specialization for BaseSubobject.
llvm-svn: 93399
Diffstat (limited to 'clang/lib/CodeGen/CGVtable.h')
-rw-r--r-- | clang/lib/CodeGen/CGVtable.h | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGVtable.h b/clang/lib/CodeGen/CGVtable.h index b4798141230..0caaec28169 100644 --- a/clang/lib/CodeGen/CGVtable.h +++ b/clang/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> > |