Files
swift-mirror/test/DebugInfo/LinetableArtificialFn.swift
Arnold Schwaighofer 39fa2f0228 Use the swift calling convention for swift functions
Use the generic type lowering algorithm described in
"docs/CallingConvention.rst#physical-lowering" to map from IRGen's explosion
type to the type expected by the ABI.

Change IRGen to use the swift calling convention (swiftcc) for native swift
functions.

Use the 'swiftself' attribute on self parameters and for closures contexts.

Use the 'swifterror' parameter for swift error parameters.

Change functions in the runtime that are called as native swift functions to use
the swift calling convention.

rdar://19978563
2017-02-14 12:17:57 -08:00

35 lines
1007 B
Swift

// RUN: %target-swift-frontend %s -emit-ir -g -o - -disable-sil-linking | %FileCheck %s
// Verify that a helper function that is generated on-the-fly does
// not mess up the linetable of the calling function.
// CHECK: store i2048 10, i2048* [[STKLOC:%.*]], align
// CHECK: call swiftcc {{(i32|i64)}} @_TFSiCfT22_builtinIntegerLiteralBi2048__Si(i2048* {{.*}} [[STKLOC]]
// CHECK: store {{(i32|i64)}} {{.*}}getelementptr
// CHECK: store {{(i32|i64)}} {{.*}}getelementptr{{.*}}, !dbg ![[DBG:[0-9]+]]
// CHECK-NOT: ![[DBG]] = !{i32 0, i32 0,
class TurnBasedPolicy {
typealias Rules = (onWin : Int, onHint : Int, onLose : Int, onWrongGuess: Int, numAttempts : Int, numHints : Int, secretRange : (Int, Int))
init (r : Rules) {
self.rules = r
}
var rules : Rules
var secret = 0
var attempts = 0
var hints = 0
var hintedRange = (0, 0)
}
var easyPolicy : TurnBasedPolicy.Rules = (
onWin : 2,
onHint : -1,
onLose : -2,
onWrongGuess : 0,
numAttempts : 7,
numHints : 7,
secretRange : (1,10)
)