Files
swift-mirror/test/DebugInfo/self.swift
Adrian Prantl 990ad90c56 Debug info: Emit the object type for variables that reside in an alloca.
rdar://problem/16076982.

Swift SVN r14535
2014-02-28 20:53:05 +00:00

22 lines
904 B
Swift

// RUN: %swift %s -emit-ir -g -o - | FileCheck %s
struct stuffStruct {
var a: Int = 6
var b: String = "Nothing"
}
func f() {
var thing: stuffStruct = stuffStruct()
}
// In the constructor, self has a type of "inout stuffStruct", but it
// is constructed in an alloca. The debug info for the alloca should not
// describe a reference type as we would normally do with inout arguments.
//
// CHECK: define void @_TFV4self11stuffStructCfMS0_FT_S0_(%V4self11stuffStruct* noalias sret) {
// CHECK-NEXT: entry:
// CHECK-NEXT: %[[ALLOCA:.*]] = alloca %V4self11stuffStruct, align 8
// CHECK: call void @llvm.dbg.declare(metadata !{%V4self11stuffStruct* %[[ALLOCA]]}, metadata ![[SELF:.*]]), !dbg
// CHECK: ![[STUFFSTRUCT:[0-9]+]] = {{.*}} [ DW_TAG_structure_type ] [_TtV4self11stuffStruct]
// CHECK: ![[SELF]] = {{.*}}, metadata ![[STUFFSTRUCT]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [self]