mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
rdar://problem/19450969 Undo reverts r24381..24384 with one fix: pull cleanup blocks from the back of the list. When breaking out of a while loop, an extra release could over-release a reference. Swift SVN r24553
41 lines
1.0 KiB
Swift
41 lines
1.0 KiB
Swift
// RUN: %target-swift-frontend %s -emit-sil -emit-verbose-sil -g -o - | FileCheck %s
|
|
|
|
class NSURL {}
|
|
|
|
class NSPathControlItem {
|
|
var URL: NSURL?
|
|
}
|
|
|
|
class NSPathControl {
|
|
var clickedPathItem: NSPathControlItem?;
|
|
}
|
|
|
|
class AppDelegate {
|
|
|
|
func LogStr(message: String) {
|
|
}
|
|
|
|
func componentClicked(sender: AnyObject)
|
|
{
|
|
if let control = sender as? NSPathControl
|
|
{
|
|
LogStr( "Got a path control" )
|
|
if let item = control.clickedPathItem
|
|
{
|
|
LogStr( "Got an NSPathControlItem" )
|
|
// Verify that the branch's location is >= the cleanup's location.
|
|
// ( The implicit false block of the conditional
|
|
// below inherits the location from the condition. )
|
|
// CHECK: br{{.*}}line:[[@LINE+1]]
|
|
if let url = item.URL
|
|
{
|
|
LogStr( "There is a url" )
|
|
}
|
|
// Verify that the branch's location is >= the cleanup's location.
|
|
// CHECK: strong_release{{.*}}$NSPathControlItem{{.*}}line:[[@LINE+2]]
|
|
// CHECK-NEXT: br{{.*}}line:[[@LINE+1]]
|
|
}
|
|
}
|
|
}
|
|
}
|