From f856249d496663b72b9eac37cdabb52932abd0e0 Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Mon, 8 Jul 2013 19:17:48 +0000 Subject: StringRef: add DenseMapInfo for StringRef. Remove the implementation in include/llvm/Support/YAMLTraits.h. Added a DenseMap type DITypeHashMap in DebugInfo.h: DenseMap, MDNode*> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185852 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/StringRef.h | 8 ++++++++ include/llvm/DebugInfo.h | 4 ++++ include/llvm/Support/YAMLTraits.h | 10 +--------- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index d013d05623..c5f2632f4b 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -548,6 +548,14 @@ namespace llvm { template struct isPodLike; template <> struct isPodLike { static const bool value = true; }; + template struct DenseMapInfo; + template<> struct DenseMapInfo { + static StringRef getEmptyKey() { return StringRef(); } + static StringRef getTombstoneKey() { return StringRef(" ", 0); } + static unsigned getHashValue(StringRef const val); + static bool isEqual(StringRef const lhs, + StringRef const rhs) { return lhs.equals(rhs); } + }; } #endif diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h index 372d367b70..c33a21d729 100644 --- a/include/llvm/DebugInfo.h +++ b/include/llvm/DebugInfo.h @@ -17,6 +17,7 @@ #ifndef LLVM_DEBUGINFO_H #define LLVM_DEBUGINFO_H +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -45,6 +46,9 @@ namespace llvm { class DIType; class DIObjCProperty; + /// Map from a pair to MDNode. + typedef DenseMap, MDNode*> DITypeHashMap; + /// DIDescriptor - A thin wraper around MDNode to access encoded debug info. /// This should not be stored in a container, because the underlying MDNode /// may change in certain situations. diff --git a/include/llvm/Support/YAMLTraits.h b/include/llvm/Support/YAMLTraits.h index 801868ff1f..14cbfc2373 100644 --- a/include/llvm/Support/YAMLTraits.h +++ b/include/llvm/Support/YAMLTraits.h @@ -760,15 +760,7 @@ private: } static inline bool classof(const MapHNode *) { return true; } - struct StrMappingInfo { - static StringRef getEmptyKey() { return StringRef(); } - static StringRef getTombstoneKey() { return StringRef(" ", 0); } - static unsigned getHashValue(StringRef const val) { - return llvm::HashString(val); } - static bool isEqual(StringRef const lhs, - StringRef const rhs) { return lhs.equals(rhs); } - }; - typedef llvm::DenseMap NameToNode; + typedef llvm::DenseMap NameToNode; bool isValidKey(StringRef key); -- cgit v1.2.3