Files
swift-mirror/test/SILGen/deinit_in_vtable.swift
Dmitri Hrybenko 3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00

40 lines
932 B
Swift

// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
// The second run tests is it can be compiled without crashes.
// RUN: %target-swift-frontend -O -S %s
private class A {
func foo() -> Int { return 0 }
}
// CHECK-LABEL: deinit_in_vtable.(A in {{.*}}).__deallocating_deinit
// CHECK: sil private @[[A:.*]] :
private class B : A {
override func foo() -> Int { return 1 }
}
// CHECK-LABEL: deinit_in_vtable.(B in {{.*}}).__deallocating_deinit
// CHECK: sil private @[[B:.*]] :
@inline(never)
private func testfunc(a: A) -> Int {
return a.foo()
}
public func testmain() {
testfunc(B())
}
// Check if the deallocating destructors are listed in the vtable.
// This is required so that the are not removed (if not public) by dead
// function elimination
// CHECK-LABEL: sil_vtable A
// CHECK: A.deinit!deallocator: [[A]]
// CHECK-LABEL: sil_vtable B
// CHECK-NOT: A.deinit
// CHECK: B.deinit!deallocator: [[B]]