Home | History | Annotate | Download | only in DebugInfo
      1 ; REQUIRES: object-emission
      2 
      3 ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
      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
      8 ; $ opt -inline ab.bc -o ab-opt.bc
      9 ; $ cat a.cpp
     10 ; # 1 "func.h"
     11 ; inline int func(int i) {
     12 ;   return i * 2;
     13 ; }
     14 ; int (*x)(int) = &func;
     15 ; $ cat b.cpp
     16 ; # 1 "func.h"
     17 ; inline int func(int i) {
     18 ;   return i * 2;
     19 ; }
     20 ; int (*y)(int) = &func;
     21 
     22 ; CHECK: DW_TAG_compile_unit
     23 ; CHECK:   DW_TAG_subprogram
     24 ; CHECK-NOT: DW_TAG
     25 ; CHECK:     DW_AT_name {{.*}} "func"
     26 ; CHECK: DW_TAG_compile_unit
     27 ; CHECK-NOT: DW_TAG_subprogram
     28 
     29 @x = global i32 (i32)* @_Z4funci, align 8
     30 @y = global i32 (i32)* @_Z4funci, align 8
     31 
     32 ; Function Attrs: inlinehint nounwind uwtable
     33 define linkonce_odr i32 @_Z4funci(i32 %i) #0 {
     34   %1 = alloca i32, align 4
     35   store i32 %i, i32* %1, align 4
     36   call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !20), !dbg !21
     37   %2 = load i32* %1, align 4, !dbg !22
     38   %3 = mul nsw i32 %2, 2, !dbg !22
     39   ret i32 %3, !dbg !22
     40 }
     41 
     42 ; Function Attrs: nounwind readnone
     43 declare void @llvm.dbg.declare(metadata, metadata) #1
     44 
     45 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" }
     46 attributes #1 = { nounwind readnone }
     47 
     48 !llvm.dbg.cu = !{!0, !13}
     49 !llvm.module.flags = !{!17, !18}
     50 !llvm.ident = !{!19, !19}
     51 
     52 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.5.0 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !10, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/a.cpp] [DW_LANG_C_plus_plus]
     53 !1 = metadata !{metadata !"a.cpp", metadata !"/tmp/dbginfo"}
     54 !2 = metadata !{}
     55 !3 = metadata !{metadata !4}
     56 !4 = metadata !{i32 786478, metadata !5, metadata !6, metadata !"func", metadata !"func", metadata !"_Z4funci", i32 1, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32)* @_Z4funci, null, null, metadata !2, i32 1} ; [ DW_TAG_subprogram ] [line 1] [def] [func]
     57 !5 = metadata !{metadata !"func.h", metadata !"/tmp/dbginfo"}
     58 !6 = metadata !{i32 786473, metadata !5}          ; [ DW_TAG_file_type ] [/tmp/dbginfo/func.h]
     59 !7 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
     60 !8 = metadata !{metadata !9, metadata !9}
     61 !9 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
     62 !10 = metadata !{metadata !11}
     63 !11 = metadata !{i32 786484, i32 0, null, metadata !"x", metadata !"x", metadata !"", metadata !6, i32 4, metadata !12, i32 0, i32 1, i32 (i32)** @x, null} ; [ DW_TAG_variable ] [x] [line 4] [def]
     64 !12 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !7} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
     65 !13 = metadata !{i32 786449, metadata !14, i32 4, metadata !"clang version 3.5.0 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !15, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/b.cpp] [DW_LANG_C_plus_plus]
     66 !14 = metadata !{metadata !"b.cpp", metadata !"/tmp/dbginfo"}
     67 !15 = metadata !{metadata !16}
     68 !16 = metadata !{i32 786484, i32 0, null, metadata !"y", metadata !"y", metadata !"", metadata !6, i32 4, metadata !12, i32 0, i32 1, i32 (i32)** @y, null} ; [ DW_TAG_variable ] [y] [line 4] [def]
     69 !17 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
     70 !18 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
     71 !19 = metadata !{metadata !"clang version 3.5.0 "}
     72 !20 = metadata !{i32 786689, metadata !4, metadata !"i", metadata !6, i32 16777217, metadata !9, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [i] [line 1]
     73 !21 = metadata !{i32 1, i32 0, metadata !4, null}
     74 !22 = metadata !{i32 2, i32 0, metadata !4, null}
     75