1; RUN: llc < %s -filetype=obj | llvm-dwarfdump -v - --debug-info | FileCheck %s 2; 3; IR module created as follows: 4; clang -emit-llvm -S db-abs-1.cpp -o db-abs-1.ll -g 5; clang -emit-llvm -S db-abs-2.cpp -o db-abs-2.ll -gmlt 6; llvm-link db-abs-1.ll db-abs-2.ll -S -o db-abs-3.ll 7; --- db-abs-1.cpp --- 8; void f1(); 9; inline __attribute__((always_inline)) void f2(int) { 10; f1(); 11; } 12; void f3() { 13; f2(0); 14; } 15; --- db-abs-2.cpp --- 16; void f() { 17; } 18; --- 19; The point is that f3() is compiled -g and we get an abstract variable for the 20; unnamed parameter to f2(); then f() is compiled -gmlt and it's okay to have 21; the abstract variable still there. 22; PR31437. 23; 24; (The 'always_inline' attribute forces f2() to be inlined even at -O0, the 25; 'inline' keyword means the non-inlined definition of f2() can be omitted from 26; the IR. These are just tactics to simplify the generated test case.) 27; 28; Verify we see the formal parameter in the first compile-unit, and nothing in 29; the second compile-unit. 30; 31; CHECK: DW_TAG_compile_unit 32; CHECK-NOT: DW_TAG 33; CHECK: DW_AT_name {{.*}} "db-abs-1.cpp" 34; CHECK-NOT: NULL 35; CHECK: DW_TAG_subprogram 36; CHECK-NEXT: DW_AT_linkage_name {{.*}} "_Z2f2i" 37; CHECK-NOT: {{DW_TAG|NULL}} 38; CHECK: DW_TAG_formal_parameter 39; CHECK-NOT: DW_AT_name 40; CHECK: {{DW_TAG|NULL}} 41; CHECK: DW_TAG_inlined_subroutine 42; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "_Z2f2i" 43 44; CHECK: DW_TAG_compile_unit 45; CHECK-NOT: DW_TAG 46 47; ModuleID = 'llvm-link' 48source_filename = "llvm-link" 49target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 50target triple = "x86_64-unknown-linux-gnu" 51 52; Function Attrs: noinline uwtable 53define void @_Z2f3v() #0 !dbg !8 { 54entry: 55 %.addr.i = alloca i32, align 4 56 call void @llvm.dbg.declare(metadata i32* %.addr.i, metadata !11, metadata !16), !dbg !17 57 store i32 0, i32* %.addr.i, align 4 58 call void @_Z2f1v(), !dbg !19 59 ret void, !dbg !20 60} 61 62; Function Attrs: nounwind readnone 63declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 64 65declare void @_Z2f1v() #2 66 67; Function Attrs: noinline nounwind uwtable 68define void @_Z1fv() #3 !dbg !21 { 69entry: 70 ret void, !dbg !23 71} 72 73attributes #0 = { noinline uwtable } 74attributes #1 = { nounwind readnone } 75attributes #2 = { nounwind } 76attributes #3 = { noinline nounwind uwtable } 77 78!llvm.dbg.cu = !{!0, !3} 79!llvm.ident = !{!5, !5} 80!llvm.module.flags = !{!6, !7} 81 82!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 293745)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 83!1 = !DIFile(filename: "db-abs-1.cpp", directory: "/home/probinson/projects/scratch/pr31437") 84!2 = !{} 85!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !4, producer: "clang version 5.0.0 (trunk 293745)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2) 86!4 = !DIFile(filename: "db-abs-2.cpp", directory: "/home/probinson/projects/scratch/pr31437") 87!5 = !{!"clang version 5.0.0 (trunk 293745)"} 88!6 = !{i32 2, !"Dwarf Version", i32 4} 89!7 = !{i32 2, !"Debug Info Version", i32 3} 90!8 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !1, file: !1, line: 5, type: !9, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 91!9 = !DISubroutineType(types: !10) 92!10 = !{null} 93!11 = !DILocalVariable(arg: 1, scope: !12, file: !1, line: 2, type: !15) 94!12 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2i", scope: !1, file: !1, line: 2, type: !13, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 95!13 = !DISubroutineType(types: !14) 96!14 = !{null, !15} 97!15 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 98!16 = !DIExpression() 99!17 = !DILocation(line: 2, column: 50, scope: !12, inlinedAt: !18) 100!18 = distinct !DILocation(line: 6, column: 3, scope: !8) 101!19 = !DILocation(line: 3, column: 3, scope: !12, inlinedAt: !18) 102!20 = !DILocation(line: 7, column: 1, scope: !8) 103!21 = distinct !DISubprogram(name: "f", scope: !4, file: !4, line: 1, type: !22, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !3, retainedNodes: !2) 104!22 = !DISubroutineType(types: !2) 105!23 = !DILocation(line: 2, column: 1, scope: !21) 106