[all-commits] [llvm/llvm-project] a7130d: [ADT][NFC] Use empty base optimisation in BumpPtrA...
Nathan James via All-commits
all-commits at lists.llvm.org
Tue Jan 12 14:44:09 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a7130d85e4b9e47b18a89eac3d47fd8c19d449c1
https://github.com/llvm/llvm-project/commit/a7130d85e4b9e47b18a89eac3d47fd8c19d449c1
Author: Nathan James <n.james93 at hotmail.co.uk>
Date: 2021-01-12 (Tue, 12 Jan 2021)
Changed paths:
M llvm/include/llvm/Support/Allocator.h
Log Message:
-----------
[ADT][NFC] Use empty base optimisation in BumpPtrAllocatorImpl
Most uses of this class just use the default MallocAllocator.
As this contains no fields, we can use the empty base optimisation for BumpPtrAllocatorImpl and save 8 bytes of padding for most use cases.
This prevents using a class that is marked as `final` as the `AllocatorT` template argument.
In one must use an allocator that has been marked as `final`, the simplest way around this is a proxy class.
The class should have all the methods that `AllocaterBase` expects and should forward the calls to your own allocator instance.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D94439
More information about the All-commits
mailing list