Fix JITTest.ModuleDeletion in -Asserts mode (which turns off JITEmitDebugInfo
authorJeffrey Yasskin <jyasskin@google.com>
Wed, 11 Nov 2009 05:30:02 +0000 (05:30 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Wed, 11 Nov 2009 05:30:02 +0000 (05:30 +0000)
by default).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86807 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/ExecutionEngine/JIT/JITTest.cpp

index 19765d4e60eafb27559579b6a10f14e4de9968eb..5b8d299f58f275407f1b1e8ba23926bb73f4087a 100644 (file)
@@ -434,10 +434,16 @@ TEST_F(JITTest, ModuleDeletion) {
             RJMM->deallocateFunctionBodyCalls.size());
 
   SmallPtrSet<const void*, 2> ExceptionTablesDeallocated;
+  unsigned NumTablesDeallocated = 0;
   for (unsigned i = 0, e = RJMM->deallocateExceptionTableCalls.size();
        i != e; ++i) {
     ExceptionTablesDeallocated.insert(
         RJMM->deallocateExceptionTableCalls[i].ET);
+    if (RJMM->deallocateExceptionTableCalls[i].ET != NULL) {
+        // If JITEmitDebugInfo is off, we'll "deallocate" NULL, which doesn't
+        // appear in startExceptionTableCalls.
+        NumTablesDeallocated++;
+    }
   }
   for (unsigned i = 0, e = RJMM->startExceptionTableCalls.size(); i != e; ++i) {
     EXPECT_TRUE(ExceptionTablesDeallocated.count(
@@ -446,7 +452,7 @@ TEST_F(JITTest, ModuleDeletion) {
       << RJMM->startExceptionTableCalls[i].F_dump;
   }
   EXPECT_EQ(RJMM->startExceptionTableCalls.size(),
-            RJMM->deallocateExceptionTableCalls.size());
+            NumTablesDeallocated);
 }
 
 // This code is copied from JITEventListenerTest, but it only runs once for all