[libcxx] r328445 - avoid new/delete ellision in construct.pass.cpp
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 24 20:00:42 PDT 2018
Author: ericwf
Date: Sat Mar 24 20:00:42 2018
New Revision: 328445
URL: http://llvm.org/viewvc/llvm-project?rev=328445&view=rev
Log:
avoid new/delete ellision in construct.pass.cpp
Modified:
libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
Modified: libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp?rev=328445&r1=328444&r2=328445&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp Sat Mar 24 20:00:42 2018
@@ -63,6 +63,7 @@ int main()
globalMemCounter.last_new_size = 0;
A* ap = a.allocate(3);
+ DoNotOptimize(ap);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int)));
assert(A_constructed == 0);
@@ -100,6 +101,7 @@ int main()
assert(A_constructed == 0);
a.deallocate(ap, 3);
+ DoNotOptimize(ap);
assert(globalMemCounter.checkOutstandingNewEq(0));
assert(A_constructed == 0);
}
@@ -111,6 +113,7 @@ int main()
globalMemCounter.last_new_size = 0;
move_only* ap = a.allocate(3);
+ DoNotOptimize(ap);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int)));
assert(move_only_constructed == 0);
@@ -132,6 +135,7 @@ int main()
assert(move_only_constructed == 0);
a.deallocate(ap, 3);
+ DoNotOptimize(ap);
assert(globalMemCounter.checkOutstandingNewEq(0));
assert(move_only_constructed == 0);
}
More information about the cfe-commits
mailing list