From 8fb51e4800fe4c490329c92c876cf4441d36a780 Mon Sep 17 00:00:00 2001 From: John Criswell Date: Mon, 22 Nov 2004 16:32:35 +0000 Subject: [PATCH] Moved into the poolalloc tree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18102 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/MallocAllocator.h | 93 -------------------------- 1 file changed, 93 deletions(-) delete mode 100644 include/llvm/Support/MallocAllocator.h diff --git a/include/llvm/Support/MallocAllocator.h b/include/llvm/Support/MallocAllocator.h deleted file mode 100644 index ae3dbace05a..00000000000 --- a/include/llvm/Support/MallocAllocator.h +++ /dev/null @@ -1,93 +0,0 @@ -//===-- llvm/Support/MallocAllocator.h --------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines MallocAllocator class, an STL compatible allocator which -// just uses malloc/free to get and release memory. The default allocator uses -// the STL pool allocator runtime library, this explicitly avoids it. -// -// This file is used for variety of purposes, including the pool allocator -// project and testing, regardless of whether or not it's used directly in the -// LLVM code, so don't delete this from CVS if you think it's unused! -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_MALLOCALLOCATOR_H -#define LLVM_SUPPORT_MALLOCALLOCATOR_H - -#include -#include - -namespace llvm { - -template -struct MallocAllocator { - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef T value_type; - template struct rebind { - typedef MallocAllocator other; - }; - - template - MallocAllocator(const MallocAllocator &) {} - MallocAllocator() {} - - pointer address(reference x) const { return &x; } - const_pointer address(const_reference x) const { return &x; } - size_type max_size() const { return ~0 / sizeof(T); } - - static pointer allocate(size_t n, void* hint = 0) { - return static_cast(malloc(n*sizeof(T))); - } - - static void deallocate(pointer p, size_t n) { - free(static_cast(p)); - } - - void construct(pointer p, const T &val) { - new(static_cast(p)) T(val); - } - void destroy(pointer p) { - p->~T(); - } -}; - -template -inline bool operator==(const MallocAllocator &, const MallocAllocator &) { - return true; -} -template -inline bool operator!=(const MallocAllocator&, const MallocAllocator&) { - return false; -} -} // End llvm namespace - -/* - * This specialization was used for optimization earlier, but doesn't appear - * to work with newer versions of GCC, Linux or otherwise. - * - * This can be re-enabled if desired, but by default, it won't be included. - */ -#if 0 -namespace std { - template - struct _Alloc_traits > { - static const bool _S_instanceless = true; - typedef ::llvm::MallocAllocator base_alloc_type; - typedef ::llvm::MallocAllocator _Alloc_type; - typedef ::llvm::MallocAllocator allocator_type; - }; -} -#endif - -#endif