[llvm] r216790 - Add a trivial functor for use with unique_ptrs managing memory that needs to be freed rather than deleted.

David Blaikie dblaikie at gmail.com
Fri Aug 29 15:05:31 PDT 2014


Author: dblaikie
Date: Fri Aug 29 17:05:31 2014
New Revision: 216790

URL: http://llvm.org/viewvc/llvm-project?rev=216790&view=rev
Log:
Add a trivial functor for use with unique_ptrs managing memory that needs to be freed rather than deleted.

Modified:
    llvm/trunk/include/llvm/ADT/STLExtras.h

Modified: llvm/trunk/include/llvm/ADT/STLExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=216790&r1=216789&r2=216790&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/STLExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/STLExtras.h Fri Aug 29 17:05:31 2014
@@ -530,6 +530,12 @@ make_unique(size_t n) {
 
 #endif
 
+struct FreeDeleter {
+  void operator()(void* v) {
+    ::free(v);
+  }
+};
+
 template<typename First, typename Second>
 struct pair_hash {
   size_t operator()(const std::pair<First, Second> &P) const {





More information about the llvm-commits mailing list