101 lines · plain
1; RUN: %llc_dwarf -O0 -filetype=obj -o %t.o %s2; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s3;4; Test debug info for variadic function arguments.5; Created from tools/clang/tests/CodeGenCXX/debug-info-varargs.cpp6;7; The ... parameter of variadic should be emitted as8; DW_TAG_unspecified_parameters.9;10; Normal variadic function.11; void b(int c, ...);12;13; CHECK: DW_TAG_subprogram14; CHECK-NOT: DW_TAG15; CHECK: DW_AT_name ("a")16; CHECK-NOT: DW_TAG17; CHECK: DW_TAG_formal_parameter18; CHECK-NOT: DW_TAG19; CHECK: DW_TAG_formal_parameter20; CHECK-NOT: DW_TAG21; CHECK: DW_TAG_unspecified_parameters22;23; CHECK: DW_TAG_subprogram24; CHECK-NOT: DW_TAG25; CHECK: DW_AT_name ("b")26; CHECK-NOT: DW_TAG27; CHECK: DW_TAG_formal_parameter28; CHECK-NOT: DW_TAG29; CHECK: DW_TAG_variable30; CHECK-NOT: DW_TAG31; CHECK: DW_TAG_variable32; CHECK-NOT: DW_TAG33; CHECK: DW_TAG_unspecified_parameters34;35; Variadic C++ member function.36; struct A { void a(int c, ...); }37;38; Variadic function pointer.39; void (*fptr)(int, ...);40;41; CHECK: DW_TAG_subroutine_type42; CHECK-NOT: DW_TAG43; CHECK: DW_TAG_formal_parameter44; CHECK-NOT: DW_TAG45; CHECK: DW_TAG_unspecified_parameters46;47; ModuleID = 'llvm/tools/clang/test/CodeGenCXX/debug-info-varargs.cpp'48 49%struct.A = type { i8 }50 51; Function Attrs: nounwind ssp uwtable52define void @_Z1biz(i32 %c, ...) #0 !dbg !14 {53 %1 = alloca i32, align 454 %a = alloca %struct.A, align 155 %fptr = alloca ptr, align 856 store i32 %c, ptr %1, align 457 call void @llvm.dbg.declare(metadata ptr %1, metadata !21, metadata !DIExpression()), !dbg !2258 call void @llvm.dbg.declare(metadata ptr %a, metadata !23, metadata !DIExpression()), !dbg !2459 call void @llvm.dbg.declare(metadata ptr %fptr, metadata !25, metadata !DIExpression(DW_OP_deref)), !dbg !2760 store ptr @_Z1biz, ptr %fptr, align 8, !dbg !2761 ret void, !dbg !2862}63 64; Function Attrs: nounwind readnone65declare void @llvm.dbg.declare(metadata, metadata, metadata) #166 67attributes #0 = { nounwind ssp uwtable }68attributes #1 = { nounwind readnone }69 70!llvm.dbg.cu = !{!0}71!llvm.module.flags = !{!18, !19}72!llvm.ident = !{!20}73 74!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)75!1 = !DIFile(filename: "llvm/tools/clang/test/CodeGenCXX/debug-info-varargs.cpp", directory: "radar/13690847")76!2 = !{}77!3 = !{!4}78!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 3, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS1A")79!5 = !{!6}80!6 = !DISubprogram(name: "a", linkageName: "_ZN1A1aEiz", line: 6, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !1, scope: !4, type: !7)81!7 = !DISubroutineType(types: !8)82!8 = !{null, !9, !10, null}83!9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)84!10 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)85!14 = distinct !DISubprogram(name: "b", linkageName: "_Z1biz", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 13, file: !1, scope: !15, type: !16, retainedNodes: !2)86!15 = !DIFile(filename: "llvm/tools/clang/test/CodeGenCXX/debug-info-varargs.cpp", directory: "radar/13690847")87!16 = !DISubroutineType(types: !17)88!17 = !{null, !10, null}89!18 = !{i32 2, !"Dwarf Version", i32 3}90!19 = !{i32 1, !"Debug Info Version", i32 3}91!20 = !{!"clang version 3.5 "}92!21 = !DILocalVariable(name: "c", line: 13, arg: 1, scope: !14, file: !15, type: !10)93!22 = !DILocation(line: 13, scope: !14)94!23 = !DILocalVariable(name: "a", line: 16, scope: !14, file: !15, type: !4)95!24 = !DILocation(line: 16, scope: !14)96; Manually modifed to avoid dependence on pointer size97!25 = !DILocalVariable(name: "fptr", line: 18, scope: !14, file: !15, type: !26)98!26 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !16)99!27 = !DILocation(line: 18, scope: !14)100!28 = !DILocation(line: 22, scope: !14)101