mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Previously, we were just running ObjCARCContract when codegening. This is out of character with the rest of the LLVM passes in Swift, namely that after these have run, an IR pass no longer contains any compiler intrinsics. This can be seen by SwiftARCContract running in the -O pipeline. This commit harmonizes the behavior here. For testing purposes, I added a flag that disables the running of ObjCARCContract for testing purposes. rdar://34824507
29 lines
1.3 KiB
Swift
29 lines
1.3 KiB
Swift
// Make sure that we run objc arc contract when emitting ir or bc with optimization enabled.
|
|
|
|
// RUN: %empty-directory(%t)
|
|
|
|
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-ir -Xllvm -disable-objc-arc-contract -parse-as-library -O | %FileCheck --check-prefix=CHECK-WITHOUT-PASS %s
|
|
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-bc -Xllvm -disable-objc-arc-contract -parse-as-library -O -o %t/test1.bc && %llvm-dis -o - %t/test1.bc | %FileCheck --check-prefix=CHECK-WITHOUT-PASS %s
|
|
|
|
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-ir -parse-as-library -O | %FileCheck --check-prefix=CHECK-WITH-PASS %s
|
|
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-bc -parse-as-library -O -o %t/test2.bc && %llvm-dis -o - %t/test2.bc | %FileCheck --check-prefix=CHECK-WITH-PASS %s
|
|
|
|
|
|
// REQUIRES: objc_interop
|
|
// REQUIRES: asserts
|
|
|
|
// CHECK-WITHOUT-PASS: call void (...) @clang.arc.use
|
|
// CHECK-WITH-PASS-NOT: call void (...) @clang.arc.use
|
|
|
|
import Foundation
|
|
|
|
@inline(never)
|
|
public func foo() throws {
|
|
let x: FileManager! = nil
|
|
let y = URL(string: "http://swift.org")
|
|
let z: URL! = nil
|
|
let w: String = "foo"
|
|
var e: NSError? = nil
|
|
test(x, y, z, w, .usingNewMetadataOnly, &e)
|
|
}
|