// REQUIRES: objc_interop

// RUN: %target-swift-frontend -emit-sil %s -Onone -Xllvm \
// RUN:   -sil-print-after=mandatory-inlining \
// RUN:   -enable-ownership-stripping-after-serialization \
// RUN:   -Xllvm -sil-print-debuginfo -o /dev/null 2>&1 | %FileCheck %s

// CHECK: begin_borrow {{.*}} : $OSLog, loc {{.*}}, scope 5
// CHECK: tuple (), loc {{.*}}, scope 5
// CHECK: end_borrow %9 : $OSLog, loc {{.*}}, scope 5

import os

func bar() {
  if #available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) {
    foo(OSLog.default)
  }
}

@_transparent
func foo(_ logObject: OSLog) { }

// RUN: %target-swift-frontend -emit-sil %s -Onone -Xllvm \
// RUN:   -sil-print-after=mandatory-inlining \
// RUN:   -enable-ownership-stripping-after-serialization \
// RUN:   -Xllvm -sil-print-debuginfo -o /dev/null 2>&1 | %FileCheck %s

// CHECK: begin_borrow {{.*}} : $OSLog, loc {{.*}}, scope 3
// CHECK: tuple (), loc {{.*}}, scope 3
// CHECK: end_borrow %3 : $OSLog, loc {{.*}}, scope 3

import os

func bar() {
  foo(OSLog.default)
}

@_transparent
func foo(_ logObject: OSLog) { }

--- 
+++ 
@@ -1,16 +1,20 @@
+// REQUIRES: objc_interop
+
 // RUN: %target-swift-frontend -emit-sil %s -Onone -Xllvm \
 // RUN:   -sil-print-after=mandatory-inlining \
 // RUN:   -enable-ownership-stripping-after-serialization \
 // RUN:   -Xllvm -sil-print-debuginfo -o /dev/null 2>&1 | %FileCheck %s
 
-// CHECK: begin_borrow {{.*}} : $OSLog, loc {{.*}}, scope 3
-// CHECK: tuple (), loc {{.*}}, scope 3
-// CHECK: end_borrow %3 : $OSLog, loc {{.*}}, scope 3
+// CHECK: begin_borrow {{.*}} : $OSLog, loc {{.*}}, scope 5
+// CHECK: tuple (), loc {{.*}}, scope 5
+// CHECK: end_borrow %9 : $OSLog, loc {{.*}}, scope 5
 
 import os
 
 func bar() {
-  foo(OSLog.default)
+  if #available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) {
+    foo(OSLog.default)
+  }
 }
 
 @_transparent
[test/DebugInfo] Add a missing REQUIRES and availability macro.
