Files
swift-mirror/test/DebugInfo/structs.swift
David Farler 8f2fbdc93a Make function parameters and refutable patterns always immutable
All refutable patterns and function parameters marked with 'var'
is now an error.

- Using explicit 'let' keyword on function parameters causes a warning.
- Don't suggest making function parameters mutable
- Remove uses in the standard library
- Update tests

rdar://problem/23378003
2015-11-09 16:56:13 -08:00

34 lines
995 B
Swift

// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
// Capture the pointer size from type Int
// CHECK: %Si = type <{ i[[PTRSIZE:[0-9]+]] }>
struct A {
var fn : () -> ()
}
func test(x : A) {
var vx = x
}
// CHECK: define hidden void @_TF7structs4test
// CHECK: [[VX:%.*]] = alloca
// CHECK: [[X_DBG:%.*]] = alloca
// CHECK: call void @llvm.dbg.declare(metadata {{.*}}* [[X_DBG]], metadata [[X_MD:!.*]], metadata
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A"
// CHECK-SAME: identifier: [[A_DI:"[^"]+"]]
class C {
var lots_of_extra_storage: (Int, Int, Int) = (1, 2, 3)
var member: C = C()
}
// A class is represented by a pointer, so B's total size should be PTRSIZE.
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "B",
// CHECK-SAME: {{.*}}size: [[PTRSIZE]]
struct B {
var c : C
}
// CHECK: [[X_MD]] = !DILocalVariable(name: "x", arg: 1
// CHECK-SAME: type: ![[A_DI]]