[PATCH] Add specialization of FoldingSetTrait for std::pair.

Manuel Klimek klimek at google.com
Fri May 23 06:08:31 PDT 2014


Hi jordan_rose,

Needed for clang's static analyzer. Jordan suggested to add it directly
in FoldingSet.h.

http://reviews.llvm.org/D3895

Files:
  include/llvm/ADT/FoldingSet.h

Index: include/llvm/ADT/FoldingSet.h
===================================================================
--- include/llvm/ADT/FoldingSet.h
+++ include/llvm/ADT/FoldingSet.h
@@ -794,6 +794,14 @@
     ID.AddPointer(X);
   }
 };
+template <typename T1, typename T2>
+struct llvm::FoldingSetTrait<std::pair<T1, T2>> {
+  static inline void Profile(const std::pair<T1, T2> &P,
+                             llvm::FoldingSetNodeID &ID) {
+    ID.Add(P.first);
+    ID.Add(P.second);
+  }
+};
 } // End of namespace llvm.
 
 #endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3895.9754.patch
Type: text/x-patch
Size: 525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140523/233f6faa/attachment.bin>


More information about the llvm-commits mailing list