1; RUN: llc -mtriple=x86_64-apple-macosx10.8.0 -O0 -filetype=obj -o %t %s 2; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s 3; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64-apple-macosx10.8.0 -O0 -filetype=obj -o %t %s 4; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s 5; Test that we generate debug info for by-value struct args that are not used. 6; 7; CHECK: DW_TAG_formal_parameter 8; CHECK: DW_TAG_formal_parameter 9; CHECK: DW_TAG_formal_parameter 10; CHECK: DW_TAG_formal_parameter 11; CHECK-NOT: DW_TAG 12; CHECK: DW_AT_name {{.*}} "info" 13; 14; generated from 15; 16; typedef unsigned long NSUInteger; 17; typedef struct 18; { 19; NSUInteger width; 20; NSUInteger height; 21; double pixelAspect; 22; } ImageInfo; 23; @implementation Bitmap 24; - (id)initWithCopy:(Bitmap *)otherBitmap 25; andInfo:(ImageInfo)info 26; andLength:(NSUInteger)length 27; { 28; } 29; @end 30 31; ModuleID = 't.mm' 32target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 33target triple = "x86_64-apple-macosx10.8.0" 34 35%0 = type opaque 36%struct._objc_cache = type opaque 37%struct._class_t = type { ptr, ptr, ptr, ptr, ptr } 38%struct._class_ro_t = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr } 39%struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } 40%struct._objc_method = type { ptr, ptr, ptr } 41%struct._objc_protocol_list = type { i64, [0 x ptr] } 42%struct._protocol_t = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr } 43%struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } 44%struct._prop_t = type { ptr, ptr } 45%struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] } 46%struct._ivar_t = type { ptr, ptr, ptr, i32, i32 } 47%struct.ImageInfo = type { i64, i64, double } 48 49@_objc_empty_cache = external global %struct._objc_cache 50@_objc_empty_vtable = external global ptr 51@"OBJC_CLASS_$_Bitmap" = global %struct._class_t { ptr @"OBJC_METACLASS_$_Bitmap", ptr null, ptr @_objc_empty_cache, ptr @_objc_empty_vtable, ptr @"\01l_OBJC_CLASS_RO_$_Bitmap" }, section "__DATA, __objc_data", align 8 52@"OBJC_METACLASS_$_Bitmap" = global %struct._class_t { ptr @"OBJC_METACLASS_$_Bitmap", ptr @"OBJC_CLASS_$_Bitmap", ptr @_objc_empty_cache, ptr @_objc_empty_vtable, ptr @"\01l_OBJC_METACLASS_RO_$_Bitmap" }, section "__DATA, __objc_data", align 8 53@"\01L_OBJC_CLASS_NAME_" = internal global [7 x i8] c"Bitmap\00", section "__TEXT,__objc_classname,cstring_literals", align 1 54@"\01l_OBJC_METACLASS_RO_$_Bitmap" = internal global %struct._class_ro_t { i32 3, i32 40, i32 40, ptr null, ptr @"\01L_OBJC_CLASS_NAME_", ptr null, ptr null, ptr null, ptr null, ptr null }, section "__DATA, __objc_const", align 8 55@"\01L_OBJC_METH_VAR_NAME_" = internal global [32 x i8] c"initWithCopy:andInfo:andLength:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 56@"\01L_OBJC_METH_VAR_TYPE_" = internal global [23 x i8] c"@56@0:8@16{?=QQd}24Q48\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 57@"\01l_OBJC_$_INSTANCE_METHODS_Bitmap" = internal global { i32, i32, [1 x %struct._objc_method] } { i32 24, i32 1, [1 x %struct._objc_method] [%struct._objc_method { ptr @"\01L_OBJC_METH_VAR_NAME_", ptr @"\01L_OBJC_METH_VAR_TYPE_", ptr @"\01-[Bitmap initWithCopy:andInfo:andLength:]" }] }, section "__DATA, __objc_const", align 8 58@"\01l_OBJC_CLASS_RO_$_Bitmap" = internal global %struct._class_ro_t { i32 2, i32 0, i32 0, ptr null, ptr @"\01L_OBJC_CLASS_NAME_", ptr @"\01l_OBJC_$_INSTANCE_METHODS_Bitmap", ptr null, ptr null, ptr null, ptr null }, section "__DATA, __objc_const", align 8 59@"\01L_OBJC_LABEL_CLASS_$" = internal global [1 x ptr] [ptr @"OBJC_CLASS_$_Bitmap"], section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 60@llvm.used = appending global [5 x ptr] [ptr @"\01L_OBJC_CLASS_NAME_", ptr @"\01L_OBJC_METH_VAR_NAME_", ptr @"\01L_OBJC_METH_VAR_TYPE_", ptr @"\01l_OBJC_$_INSTANCE_METHODS_Bitmap", ptr @"\01L_OBJC_LABEL_CLASS_$"], section "llvm.metadata" 61 62; Function Attrs: ssp uwtable 63define internal ptr @"\01-[Bitmap initWithCopy:andInfo:andLength:]"(ptr %self, ptr %_cmd, ptr %otherBitmap, ptr byval(%struct.ImageInfo) align 8 %info, i64 %length) #0 !dbg !7 { 64entry: 65 %retval = alloca ptr, align 8 66 %self.addr = alloca ptr, align 8 67 %_cmd.addr = alloca ptr, align 8 68 %otherBitmap.addr = alloca ptr, align 8 69 %length.addr = alloca i64, align 8 70 store ptr %self, ptr %self.addr, align 8 71 call void @llvm.dbg.declare(metadata ptr %self.addr, metadata !28, metadata !DIExpression()), !dbg !29 72 store ptr %_cmd, ptr %_cmd.addr, align 8 73 call void @llvm.dbg.declare(metadata ptr %_cmd.addr, metadata !30, metadata !DIExpression()), !dbg !29 74 store ptr %otherBitmap, ptr %otherBitmap.addr, align 8 75 call void @llvm.dbg.declare(metadata ptr %otherBitmap.addr, metadata !32, metadata !DIExpression()), !dbg !29 76 call void @llvm.dbg.declare(metadata ptr %info, metadata !33, metadata !DIExpression()), !dbg !34 77 store i64 %length, ptr %length.addr, align 8 78 call void @llvm.dbg.declare(metadata ptr %length.addr, metadata !35, metadata !DIExpression()), !dbg !36 79 %0 = load ptr, ptr %retval, !dbg !37 80 ret ptr %0, !dbg !37 81} 82 83; Function Attrs: nounwind readnone 84declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 85 86attributes #0 = { ssp uwtable } 87attributes #1 = { nounwind readnone } 88 89!llvm.dbg.cu = !{!0} 90!llvm.module.flags = !{!24, !25, !26, !27, !38} 91 92!0 = distinct !DICompileUnit(language: DW_LANG_ObjC_plus_plus, producer: "clang version 3.4 ", isOptimized: false, runtimeVersion: 2, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2) 93!1 = !DIFile(filename: "t.mm", directory: "") 94!2 = !{} 95!3 = !{!4} 96!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "Bitmap", line: 8, size: 8, align: 8, flags: DIFlagObjcClassComplete, runtimeLang: DW_LANG_ObjC_plus_plus, file: !1, scope: !5, elements: !2) 97!5 = !DIFile(filename: "t.mm", directory: "") 98!7 = distinct !DISubprogram(name: "-[Bitmap initWithCopy:andInfo:andLength:]", line: 9, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 9, file: !1, scope: !5, type: !8, retainedNodes: !2) 99!8 = !DISubroutineType(types: !9) 100!9 = !{!4, !10, !11, !14, !15, !19} 101!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4) 102!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "SEL", line: 9, flags: DIFlagArtificial, file: !1, baseType: !12) 103!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !13) 104!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "objc_selector", flags: DIFlagFwdDecl, file: !1) 105!14 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4) 106!15 = !DIDerivedType(tag: DW_TAG_typedef, name: "ImageInfo", line: 7, file: !1, baseType: !16) 107!16 = !DICompositeType(tag: DW_TAG_structure_type, line: 2, size: 192, align: 64, file: !1, elements: !17) 108!17 = !{!18, !21, !22} 109!18 = !DIDerivedType(tag: DW_TAG_member, name: "width", line: 4, size: 64, align: 64, file: !1, scope: !16, baseType: !19) 110!19 = !DIDerivedType(tag: DW_TAG_typedef, name: "NSUInteger", line: 1, file: !1, baseType: !20) 111!20 = !DIBasicType(tag: DW_TAG_base_type, name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned) 112!21 = !DIDerivedType(tag: DW_TAG_member, name: "height", line: 5, size: 64, align: 64, offset: 64, file: !1, scope: !16, baseType: !19) 113!22 = !DIDerivedType(tag: DW_TAG_member, name: "pixelAspect", line: 6, size: 64, align: 64, offset: 128, file: !1, scope: !16, baseType: !23) 114!23 = !DIBasicType(tag: DW_TAG_base_type, name: "double", size: 64, align: 64, encoding: DW_ATE_float) 115!24 = !{i32 1, !"Objective-C Version", i32 2} 116!25 = !{i32 1, !"Objective-C Image Info Version", i32 0} 117!26 = !{i32 1, !"Objective-C Image Info Section", !"__DATA, __objc_imageinfo, regular, no_dead_strip"} 118!27 = !{i32 4, !"Objective-C Garbage Collection", i32 0} 119!28 = !DILocalVariable(name: "self", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !7, file: !5, type: !14) 120!29 = !DILocation(line: 9, scope: !7) 121!30 = !DILocalVariable(name: "_cmd", line: 9, arg: 2, flags: DIFlagArtificial, scope: !7, file: !5, type: !31) 122!31 = !DIDerivedType(tag: DW_TAG_typedef, name: "SEL", line: 9, file: !1, baseType: !12) 123!32 = !DILocalVariable(name: "otherBitmap", line: 9, arg: 3, scope: !7, file: !5, type: !14) 124!33 = !DILocalVariable(name: "info", line: 10, arg: 4, scope: !7, file: !5, type: !15) 125!34 = !DILocation(line: 10, scope: !7) 126!35 = !DILocalVariable(name: "length", line: 11, arg: 5, scope: !7, file: !5, type: !19) 127!36 = !DILocation(line: 11, scope: !7) 128!37 = !DILocation(line: 13, scope: !7) 129!38 = !{i32 1, !"Debug Info Version", i32 3} 130