summaryrefslogtreecommitdiff
path: root/include/llvm/Support/RecyclingAllocator.h
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@arm.com>2013-08-27 11:20:13 +0000
committerJoey Gouly <joey.gouly@arm.com>2013-08-27 11:20:13 +0000
commit9dc1842b3f7bab8304f0dd23c077c6ef3788b6f1 (patch)
tree7e439cb0ee34e18c83f6a4bc032ef69ecb078ff8 /include/llvm/Support/RecyclingAllocator.h
parentc59efb626a7a11ec661981e96ba09bba0497b731 (diff)
downloadllvm-9dc1842b3f7bab8304f0dd23c077c6ef3788b6f1.tar.gz
llvm-9dc1842b3f7bab8304f0dd23c077c6ef3788b6f1.tar.bz2
llvm-9dc1842b3f7bab8304f0dd23c077c6ef3788b6f1.tar.xz
Add an assertion to the fixed-size allocator to ensure that we don't request
an allocation that is greater than what we will actually allocate. Patch by Artyom Skrobov! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/RecyclingAllocator.h')
-rw-r--r--include/llvm/Support/RecyclingAllocator.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/llvm/Support/RecyclingAllocator.h b/include/llvm/Support/RecyclingAllocator.h
index f67503f6fb..001d1cf7c3 100644
--- a/include/llvm/Support/RecyclingAllocator.h
+++ b/include/llvm/Support/RecyclingAllocator.h
@@ -60,9 +60,10 @@ public:
}
template<class AllocatorType, class T, size_t Size, size_t Align>
-inline void *operator new(size_t,
+inline void *operator new(size_t size,
llvm::RecyclingAllocator<AllocatorType,
T, Size, Align> &Allocator) {
+ assert(size <= Size && "allocation size exceeded");
return Allocator.Allocate();
}