diff options
Diffstat (limited to 'llvm/unittests')
-rw-r--r-- | llvm/unittests/Support/AllocatorTest.cpp | 6 | ||||
-rw-r--r-- | llvm/unittests/Support/BinaryStreamTest.cpp | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/unittests/Support/AllocatorTest.cpp b/llvm/unittests/Support/AllocatorTest.cpp index 4b544641e9b..4897c47eb28 100644 --- a/llvm/unittests/Support/AllocatorTest.cpp +++ b/llvm/unittests/Support/AllocatorTest.cpp @@ -17,9 +17,9 @@ namespace { TEST(AllocatorTest, Basics) { BumpPtrAllocator Alloc; - int *a = (int*)Alloc.Allocate(sizeof(int), 1); - int *b = (int*)Alloc.Allocate(sizeof(int) * 10, 1); - int *c = (int*)Alloc.Allocate(sizeof(int), 1); + int *a = (int*)Alloc.Allocate(sizeof(int), alignof(int)); + int *b = (int*)Alloc.Allocate(sizeof(int) * 10, alignof(int)); + int *c = (int*)Alloc.Allocate(sizeof(int), alignof(int)); *a = 1; b[0] = 2; b[9] = 2; diff --git a/llvm/unittests/Support/BinaryStreamTest.cpp b/llvm/unittests/Support/BinaryStreamTest.cpp index dfac3038c71..1e646a6cf90 100644 --- a/llvm/unittests/Support/BinaryStreamTest.cpp +++ b/llvm/unittests/Support/BinaryStreamTest.cpp @@ -686,7 +686,8 @@ TEST_F(BinaryStreamTest, BinaryItemStream) { std::vector<Foo> Foos = {{1, 1.0}, {2, 2.0}, {3, 3.0}}; BumpPtrAllocator Allocator; for (const auto &F : Foos) { - uint8_t *Ptr = Allocator.Allocate<uint8_t>(sizeof(Foo)); + uint8_t *Ptr = static_cast<uint8_t *>(Allocator.Allocate(sizeof(Foo), + alignof(Foo))); MutableArrayRef<uint8_t> Buffer(Ptr, sizeof(Foo)); MutableBinaryByteStream Stream(Buffer, llvm::support::big); BinaryStreamWriter Writer(Stream); |