[PATCH] [libcxxabi] Cleanup memory in tests to placate ASAN.

Eric Fiselier eric at efcs.ca
Tue Nov 18 17:35:27 PST 2014


================
Comment at: test/test_vector1.cpp:231
@@ -229,2 +230,3 @@
 //  We should have thrown in the middle of cleaning up "two", which means that
 //  there should be 20 calls to the destructor, and "three" was not cleaned up.
+    if ( gConstructorCounter != 20 || gDestructorCounter != 20 ) {
----------------
jroelofs wrote:
> This comment lies if you end up going though with the change.
> 
> Is there a way to tell asan that we expect a leak here? Based on this comment, I think leaking is part of the expected behavior of the test. @mclow.lists what do you think?
I'll change the comment. Leaking is *currently* part of the expected behavior since the call to cleanup three should never be called. Changing it to an assert should test the same thing (that control flow exits the block before the next statement).

http://reviews.llvm.org/D6281






More information about the cfe-commits mailing list