[llvm] r256179 - fix leak in a test, make the sanitizer bot green
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 21 11:09:01 PST 2015
Author: kcc
Date: Mon Dec 21 13:09:01 2015
New Revision: 256179
URL: http://llvm.org/viewvc/llvm-project?rev=256179&view=rev
Log:
fix leak in a test, make the sanitizer bot green
Modified:
llvm/trunk/unittests/Support/TrailingObjectsTest.cpp
Modified: llvm/trunk/unittests/Support/TrailingObjectsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TrailingObjectsTest.cpp?rev=256179&r1=256178&r2=256179&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/TrailingObjectsTest.cpp (original)
+++ llvm/trunk/unittests/Support/TrailingObjectsTest.cpp Mon Dec 21 13:09:01 2015
@@ -164,7 +164,8 @@ TEST(TrailingObjects, ThreeArg) {
sizeof(double) + sizeof(short) + 3 * sizeof(bool));
EXPECT_EQ(sizeof(Class3),
llvm::RoundUpToAlignment(1, llvm::alignOf<double>()));
- Class3 *C = reinterpret_cast<Class3 *>(::operator new(1000));
+ std::unique_ptr<char[]> P(new char[1000]);
+ Class3 *C = reinterpret_cast<Class3 *>(P.get());
EXPECT_EQ(C->getTrailingObjects<double>(), reinterpret_cast<double *>(C + 1));
EXPECT_EQ(C->getTrailingObjects<short>(),
reinterpret_cast<short *>(reinterpret_cast<double *>(C + 1) + 1));
More information about the llvm-commits
mailing list