Revision 2f78b708576de5a8011bd267953c7b795564b440 authored by Chris Lattner on 12 January 2016, 06:43:27 UTC, committed by Chris Lattner on 12 January 2016, 06:43:27 UTC
1 parent e30cd93
Raw File
readonly.sil
// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
//sil_stage canonical

import Builtin
import Swift
import SwiftShims

private class XXX{}

// This is the swift content of this file:
//@effects(readonly) public func foo(x : Int) { }
//@effects(readonly) public func bar(x : XXX) { }

sil @_TFC8readonly3XXXD : $@convention(method) (@owned XXX) -> ()
sil @_TFC8readonly3XXXd : $@convention(method) (@guaranteed XXX) -> @owned Builtin.NativeObject
sil @_TFC8readonly3XXXcfMS0_FT_S0_ : $@convention(method) (@owned XXX) -> @owned XXX
sil @_TFC8readonly3XXXCfMS0_FT_S0_ : $@convention(thin) (@thick XXX.Type) -> @owned XXX

//CHECK: target datalayout

//CHECK: ; Function Attrs: readonly
//CHECK-NEXT: define void @function_foo(
sil [readonly] @function_foo : $@convention(thin) (Int) -> () {
bb0(%0 : $Int):
  %1 = tuple ()                                   // user: %2
  return %1 : $()                                 // id: %2
}

//CHECK-NOT: ; Function Attrs: readonly
//CHECK: define void @function_bar(
sil [readonly] @function_bar : $@convention(thin) (@owned XXX) -> () {
bb0(%0 : $XXX):
  strong_release %0 : $XXX                        // id: %2
  %3 = tuple ()                                   // user: %4
  return %3 : $()                                 // id: %4
}

sil_vtable XXX {
  #XXX.deinit!deallocator: _TFC8readonly3XXXD	// readonly.XXX.__deallocating_deinit
  #XXX.init!initializer.1: _TFC8readonly3XXXcfMS0_FT_S0_	// readonly.XXX.init (readonly.XXX.Type)() -> readonly.XXX
}



back to top