1; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=All < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s 2 3; Generate from clang with the following source. Note that the definition of 4; the inline function follows its use to workaround another bug that should be 5; fixed soon. 6; namespace ns { 7; int func(int i); 8; } 9; extern int x; 10; int main() { return ns::func(x); } 11; int __attribute__((always_inline)) ns::func(int i) { return i * 2; } 12 13; CHECK: DW_TAG_namespace 14; CHECK-NEXT: DW_AT_name {{.*}} "ns" 15; CHECK-NOT: DW_TAG 16; CHECK: DW_TAG_subprogram 17; CHECK-NOT: DW_TAG 18; CHECK: DW_AT_linkage_name {{.*}} "_ZN2ns4funcEi" 19; CHECK-NOT: DW_TAG 20; CHECK: DW_TAG_formal_parameter 21; CHECK: NULL 22; CHECK-NOT: NULL 23; CHECK: DW_TAG_subprogram 24; CHECK-NOT: DW_TAG 25; CHECK: DW_AT_abstract_origin {{.*}} "_ZN2ns4funcEi" 26; CHECK-NOT: DW_TAG 27; CHECK: DW_TAG_formal_parameter 28; CHECK: DW_AT_abstract_origin {{.*}} "i" 29; CHECK: NULL 30; CHECK: NULL 31; CHECK: NULL 32 33@x = external global i32 34 35; Function Attrs: uwtable 36define i32 @main() #0 !dbg !4 { 37entry: 38 %i.addr.i = alloca i32, align 4 39 %retval = alloca i32, align 4 40 store i32 0, i32* %retval 41 %0 = load i32, i32* @x, align 4, !dbg !16 42 store i32 %0, i32* %i.addr.i, align 4 43 call void @llvm.dbg.declare(metadata i32* %i.addr.i, metadata !117, metadata !DIExpression()), !dbg !18 44 %1 = load i32, i32* %i.addr.i, align 4, !dbg !18 45 %mul.i = mul nsw i32 %1, 2, !dbg !18 46 ret i32 %mul.i, !dbg !16 47} 48 49; Function Attrs: alwaysinline nounwind uwtable 50define i32 @_ZN2ns4funcEi(i32 %i) #1 !dbg !9 { 51entry: 52 %i.addr = alloca i32, align 4 53 store i32 %i, i32* %i.addr, align 4 54 call void @llvm.dbg.declare(metadata i32* %i.addr, metadata !17, metadata !DIExpression()), !dbg !19 55 %0 = load i32, i32* %i.addr, align 4, !dbg !19 56 %mul = mul nsw i32 %0, 2, !dbg !19 57 ret i32 %mul, !dbg !19 58} 59 60; Function Attrs: nounwind readnone 61declare void @llvm.dbg.declare(metadata, metadata, metadata) #2 62 63attributes #0 = { uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 64attributes #1 = { alwaysinline nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 65attributes #2 = { nounwind readnone } 66 67!llvm.dbg.cu = !{!0} 68!llvm.module.flags = !{!13, !14} 69!llvm.ident = !{!15} 70 71!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) 72!1 = !DIFile(filename: "namespace_inline_function_definition.cpp", directory: "/tmp/dbginfo") 73!2 = !{} 74!4 = distinct !DISubprogram(name: "main", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !1, scope: !5, type: !6, retainedNodes: !2) 75!5 = !DIFile(filename: "namespace_inline_function_definition.cpp", directory: "/tmp/dbginfo") 76!6 = !DISubroutineType(types: !7) 77!7 = !{!8} 78!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 79!9 = distinct !DISubprogram(name: "func", linkageName: "_ZN2ns4funcEi", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !1, scope: !10, type: !11, retainedNodes: !2) 80!10 = !DINamespace(name: "ns", scope: null) 81!11 = !DISubroutineType(types: !12) 82!12 = !{!8, !8} 83!13 = !{i32 2, !"Dwarf Version", i32 4} 84!14 = !{i32 2, !"Debug Info Version", i32 3} 85!15 = !{!"clang version 3.5.0 "} 86!16 = !DILocation(line: 5, scope: !4) 87!17 = !DILocalVariable(name: "i", line: 6, arg: 1, scope: !9, file: !5, type: !8) 88 89!117 = !DILocalVariable(name: "i", line: 6, arg: 1, scope: !9, file: !5, type: !8) 90 91!18 = !DILocation(line: 6, scope: !9, inlinedAt: !16) 92!19 = !DILocation(line: 6, scope: !9) 93