1*9880d681SAndroid Build Coastguard Worker; REQUIRES: object-emission 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker; Built from source: 6*9880d681SAndroid Build Coastguard Worker; $ clang++ a.cpp b.cpp -g -c -emit-llvm 7*9880d681SAndroid Build Coastguard Worker; $ llvm-link a.bc b.bc -o ab.bc 8*9880d681SAndroid Build Coastguard Worker; $ cat a.cpp 9*9880d681SAndroid Build Coastguard Worker; # 1 "func.h" 10*9880d681SAndroid Build Coastguard Worker; inline int func(int i) { 11*9880d681SAndroid Build Coastguard Worker; return i * 2; 12*9880d681SAndroid Build Coastguard Worker; } 13*9880d681SAndroid Build Coastguard Worker; int (*x)(int) = &func; 14*9880d681SAndroid Build Coastguard Worker; $ cat b.cpp 15*9880d681SAndroid Build Coastguard Worker; # 1 "func.h" 16*9880d681SAndroid Build Coastguard Worker; inline int func(int i) { 17*9880d681SAndroid Build Coastguard Worker; return i * 2; 18*9880d681SAndroid Build Coastguard Worker; } 19*9880d681SAndroid Build Coastguard Worker; int (*y)(int) = &func; 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_compile_unit 22*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram 23*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG 24*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_name {{.*}} "func" 25*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_compile_unit 26*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG_subprogram 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Worker@x = global i32 (i32)* @_Z4funci, align 8 29*9880d681SAndroid Build Coastguard Worker@y = global i32 (i32)* @_Z4funci, align 8 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Worker; Function Attrs: inlinehint nounwind uwtable 32*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr i32 @_Z4funci(i32 %i) #0 !dbg !4 { 33*9880d681SAndroid Build Coastguard Worker %1 = alloca i32, align 4 34*9880d681SAndroid Build Coastguard Worker store i32 %i, i32* %1, align 4 35*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata i32* %1, metadata !20, metadata !DIExpression()), !dbg !21 36*9880d681SAndroid Build Coastguard Worker %2 = load i32, i32* %1, align 4, !dbg !22 37*9880d681SAndroid Build Coastguard Worker %3 = mul nsw i32 %2, 2, !dbg !22 38*9880d681SAndroid Build Coastguard Worker ret i32 %3, !dbg !22 39*9880d681SAndroid Build Coastguard Worker} 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 42*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Workerattributes #0 = { inlinehint nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 45*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 46*9880d681SAndroid Build Coastguard Worker 47*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0, !13} 48*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!17, !18} 49*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!19, !19} 50*9880d681SAndroid Build Coastguard Worker 51*9880d681SAndroid Build Coastguard Worker!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: !10, imports: !2) 52*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo") 53*9880d681SAndroid Build Coastguard Worker!2 = !{} 54*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "func", linkageName: "_Z4funci", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !5, scope: !6, type: !7, variables: !2) 55*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "func.h", directory: "/tmp/dbginfo") 56*9880d681SAndroid Build Coastguard Worker!6 = !DIFile(filename: "func.h", directory: "/tmp/dbginfo") 57*9880d681SAndroid Build Coastguard Worker!7 = !DISubroutineType(types: !8) 58*9880d681SAndroid Build Coastguard Worker!8 = !{!9, !9} 59*9880d681SAndroid Build Coastguard Worker!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 60*9880d681SAndroid Build Coastguard Worker!10 = !{!11} 61*9880d681SAndroid Build Coastguard Worker!11 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !6, type: !12, variable: i32 (i32)** @x) 62*9880d681SAndroid Build Coastguard Worker!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !7) 63*9880d681SAndroid Build Coastguard Worker!13 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !14, enums: !2, retainedTypes: !2, globals: !15, imports: !2) 64*9880d681SAndroid Build Coastguard Worker!14 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo") 65*9880d681SAndroid Build Coastguard Worker!15 = !{!16} 66*9880d681SAndroid Build Coastguard Worker!16 = !DIGlobalVariable(name: "y", line: 4, isLocal: false, isDefinition: true, scope: null, file: !6, type: !12, variable: i32 (i32)** @y) 67*9880d681SAndroid Build Coastguard Worker!17 = !{i32 2, !"Dwarf Version", i32 4} 68*9880d681SAndroid Build Coastguard Worker!18 = !{i32 1, !"Debug Info Version", i32 3} 69*9880d681SAndroid Build Coastguard Worker!19 = !{!"clang version 3.5.0 "} 70*9880d681SAndroid Build Coastguard Worker!20 = !DILocalVariable(name: "i", line: 1, arg: 1, scope: !4, file: !6, type: !9) 71*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 1, scope: !4) 72*9880d681SAndroid Build Coastguard Worker!22 = !DILocation(line: 2, scope: !4) 73*9880d681SAndroid Build Coastguard Worker!24 = distinct !DISubprogram(name: "func", linkageName: "_Z4funci", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !13, scopeLine: 1, file: !5, scope: !6, type: !7, variables: !2) 74