<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jul 8, 2013, at 12:43 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite">Remove the implementation in include/llvm/Support/YAMLTraits.h.<br>Added a DenseMap type DITypeHashMap in DebugInfo.h:<br> DenseMap<std::pair<StringRef, unsigned>, MDNode*><br><br></blockquote><br>I imagine you have a follow-on patch for this, but I'd rather see it<br>as part of the next patch.<br></div></blockquote><div><br></div>Yes there will be follow-on patches that use DITypeHashMap.</div><div>Yes YAML code is using a DenseMap of StringRef.</div><div><br></div><div>Manman</div><div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>I assume, also, that the YAML code is exercising it?<br><br>-eric<br><br><blockquote type="cite">Modified:<br>   llvm/trunk/include/llvm/ADT/StringRef.h<br>   llvm/trunk/include/llvm/DebugInfo.h<br>   llvm/trunk/include/llvm/Support/YAMLTraits.h<br>   llvm/trunk/lib/Support/StringRef.cpp<br><br>Modified: llvm/trunk/include/llvm/ADT/StringRef.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=185852&r1=185851&r2=185852&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=185852&r1=185851&r2=185852&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/ADT/StringRef.h (original)<br>+++ llvm/trunk/include/llvm/ADT/StringRef.h Mon Jul  8 14:17:48 2013<br>@@ -548,6 +548,14 @@ namespace llvm {<br>  template <typename T> struct isPodLike;<br>  template <> struct isPodLike<StringRef> { static const bool value = true; };<br><br>+  template <typename T> struct DenseMapInfo;<br>+  template<> struct DenseMapInfo<StringRef> {<br>+    static StringRef getEmptyKey() { return StringRef(); }<br>+    static StringRef getTombstoneKey() { return StringRef(" ", 0); }<br>+    static unsigned getHashValue(StringRef const val);<br>+    static bool isEqual(StringRef const lhs,<br>+                        StringRef const rhs) { return lhs.equals(rhs); }<br>+  };<br>}<br><br>#endif<br><br>Modified: llvm/trunk/include/llvm/DebugInfo.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=185852&r1=185851&r2=185852&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=185852&r1=185851&r2=185852&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/DebugInfo.h (original)<br>+++ llvm/trunk/include/llvm/DebugInfo.h Mon Jul  8 14:17:48 2013<br>@@ -17,6 +17,7 @@<br>#ifndef LLVM_DEBUGINFO_H<br>#define LLVM_DEBUGINFO_H<br><br>+#include "llvm/ADT/DenseMap.h"<br>#include "llvm/ADT/SmallPtrSet.h"<br>#include "llvm/ADT/SmallVector.h"<br>#include "llvm/ADT/StringRef.h"<br>@@ -45,6 +46,9 @@ namespace llvm {<br>  class DIType;<br>  class DIObjCProperty;<br><br>+  /// Map from a pair <unique type name, an unsigned flag> to MDNode.<br>+  typedef DenseMap<std::pair<StringRef, unsigned>, MDNode*> DITypeHashMap;<br>+<br>  /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.<br>  /// This should not be stored in a container, because the underlying MDNode<br>  /// may change in certain situations.<br><br>Modified: llvm/trunk/include/llvm/Support/YAMLTraits.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/YAMLTraits.h?rev=185852&r1=185851&r2=185852&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/YAMLTraits.h?rev=185852&r1=185851&r2=185852&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/Support/YAMLTraits.h (original)<br>+++ llvm/trunk/include/llvm/Support/YAMLTraits.h Mon Jul  8 14:17:48 2013<br>@@ -760,15 +760,7 @@ private:<br>    }<br>    static inline bool classof(const MapHNode *) { return true; }<br><br>-    struct StrMappingInfo {<br>-      static StringRef getEmptyKey() { return StringRef(); }<br>-      static StringRef getTombstoneKey() { return StringRef(" ", 0); }<br>-      static unsigned getHashValue(StringRef const val) {<br>-                                                return llvm::HashString(val); }<br>-      static bool isEqual(StringRef const lhs,<br>-                          StringRef const rhs) { return lhs.equals(rhs); }<br>-    };<br>-    typedef llvm::DenseMap<StringRef, HNode*, StrMappingInfo> NameToNode;<br>+    typedef llvm::DenseMap<StringRef, HNode*> NameToNode;<br><br>    bool isValidKey(StringRef key);<br><br><br>Modified: llvm/trunk/lib/Support/StringRef.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringRef.cpp?rev=185852&r1=185851&r2=185852&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringRef.cpp?rev=185852&r1=185851&r2=185852&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/Support/StringRef.cpp (original)<br>+++ llvm/trunk/lib/Support/StringRef.cpp Mon Jul  8 14:17:48 2013<br>@@ -11,6 +11,7 @@<br>#include "llvm/ADT/APInt.h"<br>#include "llvm/ADT/Hashing.h"<br>#include "llvm/ADT/OwningPtr.h"<br>+#include "llvm/ADT/StringExtras.h"<br>#include "llvm/ADT/edit_distance.h"<br>#include <bitset><br><br>@@ -465,3 +466,7 @@ bool StringRef::getAsInteger(unsigned Ra<br>hash_code llvm::hash_value(StringRef S) {<br>  return hash_combine_range(S.begin(), S.end());<br>}<br>+<br>+unsigned DenseMapInfo<StringRef>::getHashValue(StringRef const val) {<br>+  return llvm::HashString(val);<br>+}<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</blockquote></div></blockquote></div><br></body></html>