David Blaikie | 10743a9 | 2014-05-26 06:44:52 +0000 | [diff] [blame] | 1 | ; REQUIRES: object-emission |
| 2 | |
Adrian Prantl | 16aa4cf | 2017-09-11 23:05:20 +0000 | [diff] [blame] | 3 | ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s |
David Blaikie | 10743a9 | 2014-05-26 06:44:52 +0000 | [diff] [blame] | 4 | |
| 5 | ; Built from source: |
| 6 | ; $ clang++ a.cpp b.cpp -g -c -emit-llvm |
| 7 | ; $ llvm-link a.bc b.bc -o ab.bc |
David Blaikie | 10743a9 | 2014-05-26 06:44:52 +0000 | [diff] [blame] | 8 | ; $ cat a.cpp |
| 9 | ; # 1 "func.h" |
| 10 | ; inline int func(int i) { |
| 11 | ; return i * 2; |
| 12 | ; } |
| 13 | ; int (*x)(int) = &func; |
| 14 | ; $ cat b.cpp |
| 15 | ; # 1 "func.h" |
| 16 | ; inline int func(int i) { |
| 17 | ; return i * 2; |
| 18 | ; } |
| 19 | ; int (*y)(int) = &func; |
| 20 | |
| 21 | ; CHECK: DW_TAG_compile_unit |
| 22 | ; CHECK: DW_TAG_subprogram |
| 23 | ; CHECK-NOT: DW_TAG |
| 24 | ; CHECK: DW_AT_name {{.*}} "func" |
| 25 | ; CHECK: DW_TAG_compile_unit |
| 26 | ; CHECK-NOT: DW_TAG_subprogram |
| 27 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 28 | source_filename = "test/DebugInfo/Generic/cross-cu-linkonce.ll" |
| 29 | |
| 30 | @x = global i32 (i32)* @_Z4funci, align 8, !dbg !0 |
| 31 | @y = global i32 (i32)* @_Z4funci, align 8, !dbg !7 |
David Blaikie | 10743a9 | 2014-05-26 06:44:52 +0000 | [diff] [blame] | 32 | |
| 33 | ; Function Attrs: inlinehint nounwind uwtable |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 34 | define linkonce_odr i32 @_Z4funci(i32 %i) #0 !dbg !19 { |
David Blaikie | 10743a9 | 2014-05-26 06:44:52 +0000 | [diff] [blame] | 35 | %1 = alloca i32, align 4 |
| 36 | store i32 %i, i32* %1, align 4 |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 37 | call void @llvm.dbg.declare(metadata i32* %1, metadata !20, metadata !21), !dbg !22 |
| 38 | %2 = load i32, i32* %1, align 4, !dbg !23 |
| 39 | %3 = mul nsw i32 %2, 2, !dbg !23 |
| 40 | ret i32 %3, !dbg !23 |
David Blaikie | 10743a9 | 2014-05-26 06:44:52 +0000 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 44 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
David Blaikie | 10743a9 | 2014-05-26 06:44:52 +0000 | [diff] [blame] | 45 | |
| 46 | attributes #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" } |
| 47 | attributes #1 = { nounwind readnone } |
| 48 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 49 | !llvm.dbg.cu = !{!9, !13} |
| 50 | !llvm.module.flags = !{!16, !17} |
| 51 | !llvm.ident = !{!18, !18} |
David Blaikie | 10743a9 | 2014-05-26 06:44:52 +0000 | [diff] [blame] | 52 | |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 53 | !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 54 | !1 = !DIGlobalVariable(name: "x", scope: null, file: !2, line: 4, type: !3, isLocal: false, isDefinition: true) |
| 55 | !2 = !DIFile(filename: "func.h", directory: "/tmp/dbginfo") |
| 56 | !3 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, align: 64) |
| 57 | !4 = !DISubroutineType(types: !5) |
| 58 | !5 = !{!6, !6} |
| 59 | !6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 60 | !7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 61 | !8 = !DIGlobalVariable(name: "y", scope: null, file: !2, line: 4, type: !3, isLocal: false, isDefinition: true) |
| 62 | !9 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !10, producer: "clang version 3.5.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !12, imports: !11) |
| 63 | !10 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo") |
| 64 | !11 = !{} |
| 65 | !12 = !{!0} |
| 66 | !13 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !14, producer: "clang version 3.5.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !15, imports: !11) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 67 | !14 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo") |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 68 | !15 = !{!7} |
| 69 | !16 = !{i32 2, !"Dwarf Version", i32 4} |
| 70 | !17 = !{i32 1, !"Debug Info Version", i32 3} |
| 71 | !18 = !{!"clang version 3.5.0 "} |
| 72 | !19 = distinct !DISubprogram(name: "func", linkageName: "_Z4funci", scope: !2, file: !2, line: 1, type: !4, isLocal: false, isDefinition: true, scopeLine: 1, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !9, variables: !11) |
| 73 | !20 = !DILocalVariable(name: "i", arg: 1, scope: !19, file: !2, line: 1, type: !6) |
| 74 | !21 = !DIExpression() |
| 75 | !22 = !DILocation(line: 1, scope: !19) |
| 76 | !23 = !DILocation(line: 2, scope: !19) |
| 77 | |