diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 12:57:14 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 12:57:14 +0000 |
commit | cf099d11218cb6f6c5cce947d6738e347f07fb12 (patch) | |
tree | d2b61ce94e654cb01a254d2195259db5f9cc3f3c /include/llvm/Support/Allocator.h | |
parent | 49011b52fcba02a6051957b84705159f52fae4e4 (diff) |
Diffstat (limited to 'include/llvm/Support/Allocator.h')
-rw-r--r-- | include/llvm/Support/Allocator.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/include/llvm/Support/Allocator.h b/include/llvm/Support/Allocator.h index 4a7251fa1ef33..c6807099f85e5 100644 --- a/include/llvm/Support/Allocator.h +++ b/include/llvm/Support/Allocator.h @@ -16,13 +16,15 @@ #include "llvm/Support/AlignOf.h" #include "llvm/Support/MathExtras.h" -#include "llvm/System/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include <algorithm> #include <cassert> #include <cstdlib> #include <cstddef> namespace llvm { +template <typename T> struct ReferenceAdder { typedef T& result; }; +template <typename T> struct ReferenceAdder<T&> { typedef T result; }; class MallocAllocator { public: @@ -201,7 +203,7 @@ public: char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr : (char *)Slab + Slab->Size; for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) { - Ptr = Allocator.AlignPtr(Ptr, alignof<T>()); + Ptr = Allocator.AlignPtr(Ptr, alignOf<T>()); if (Ptr + sizeof(T) <= End) reinterpret_cast<T*>(Ptr)->~T(); } @@ -221,16 +223,12 @@ public: inline void *operator new(size_t Size, llvm::BumpPtrAllocator &Allocator) { struct S { char c; -#ifdef __GNUC__ - char x __attribute__((aligned)); -#else union { double D; long double LD; long long L; void *P; } x; -#endif }; return Allocator.Allocate(Size, std::min((size_t)llvm::NextPowerOf2(Size), offsetof(S, x))); |