Home | History | Annotate | Download | only in Generic
      1 ; REQUIRES: object-emission
      2 
      3 ; Generate one file with all linkage names, and another with only abstract ones.
      4 ; Then test both.
      5 ; RUN: %llc_dwarf -accel-tables=Dwarf -dwarf-linkage-names=All -filetype=obj -o %t.All < %s
      6 ; RUN: %llc_dwarf -accel-tables=Dwarf -dwarf-linkage-names=Abstract -filetype=obj -o %t.Abstract < %s
      7 ; RUN: llvm-dwarfdump -debug-info -debug-names %t.All | FileCheck %s --check-prefix=ALL
      8 ; RUN: llvm-dwarfdump -debug-info -debug-names %t.Abstract \
      9 ; RUN:   | FileCheck %s --check-prefix=ABSTRACT --implicit-check-not=_Z1gi --implicit-check-not=_ZN1n1vE 
     10 ; RUN: llvm-dwarfdump -debug-names -verify %t.All | FileCheck --check-prefix=VERIFY %s
     11 ; RUN: llvm-dwarfdump -debug-names -verify %t.Abstract | FileCheck --check-prefix=VERIFY %s
     12 
     13 ; We should have all three linkage names in the .debug_info and .debug_names
     14 ; ALL: .debug_info contents:
     15 ; ALL: DW_AT_linkage_name	("_ZN1n1vE")
     16 ; ALL: DW_AT_linkage_name	("_Z1fi")
     17 ; ALL: DW_AT_linkage_name	("_Z1gi")
     18 ; ALL: .debug_names contents:
     19 ; ALL: String: {{.*}} "_Z1fi"
     20 ; ALL: String: {{.*}} "_Z1gi"
     21 ; ALL: String: {{.*}} "_ZN1n1vE"
     22 
     23 ; Only _Z1fi should be present in both sections
     24 ; ABSTRACT: .debug_info contents:
     25 ; ABSTRACT: DW_AT_linkage_name	("_Z1fi")
     26 ; ABSTRACT: .debug_names contents:
     27 ; ABSTRACT: String: {{.*}} "_Z1fi"
     28 
     29 ; There should be no verification errors for both files.
     30 ; VERIFY: No errors.
     31 
     32 ; Input generated from the following C code using
     33 ; clang -g -O2 -S -emit-llvm
     34 
     35 ; int e(int);
     36 ; inline int f(int a) { return e(a); }
     37 ; int g(int a) { return f(a); }
     38 ; 
     39 ; namespace n {
     40 ; int v;
     41 ; }
     42 
     43 @_ZN1n1vE = dso_local local_unnamed_addr global i32 0, align 4, !dbg !0
     44 
     45 define dso_local i32 @_Z1gi(i32 %a) local_unnamed_addr !dbg !12 {
     46 entry:
     47   call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !17
     48   call void @llvm.dbg.value(metadata i32 %a, metadata !18, metadata !DIExpression()), !dbg !21
     49   %call.i = tail call i32 @_Z1ei(i32 %a), !dbg !23
     50   ret i32 %call.i, !dbg !24
     51 }
     52 
     53 declare dso_local i32 @_Z1ei(i32) local_unnamed_addr
     54 
     55 ; Function Attrs: nounwind readnone speculatable
     56 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
     57 
     58 attributes #2 = { nounwind readnone speculatable }
     59 
     60 !llvm.dbg.cu = !{!5}
     61 !llvm.module.flags = !{!8, !9, !10}
     62 !llvm.ident = !{!11}
     63 
     64 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
     65 !1 = distinct !DIGlobalVariable(name: "v", linkageName: "_ZN1n1vE", scope: !2, file: !3, line: 6, type: !4, isLocal: false, isDefinition: true)
     66 !2 = !DINamespace(name: "n", scope: null)
     67 !3 = !DIFile(filename: "/tmp/linkage-name.cc", directory: "/usr/local/google/home/labath/ll/build/dbg")
     68 !4 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
     69 !5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 (trunk 331861) (llvm/trunk 331884)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !6, globals: !7)
     70 !6 = !{}
     71 !7 = !{!0}
     72 !8 = !{i32 2, !"Dwarf Version", i32 4}
     73 !9 = !{i32 2, !"Debug Info Version", i32 3}
     74 !10 = !{i32 1, !"wchar_size", i32 4}
     75 !11 = !{!"clang version 7.0.0 (trunk 331861) (llvm/trunk 331884)"}
     76 !12 = distinct !DISubprogram(name: "g", linkageName: "_Z1gi", scope: !3, file: !3, line: 3, type: !13, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !5, retainedNodes: !15)
     77 !13 = !DISubroutineType(types: !14)
     78 !14 = !{!4, !4}
     79 !15 = !{!16}
     80 !16 = !DILocalVariable(name: "a", arg: 1, scope: !12, file: !3, line: 3, type: !4)
     81 !17 = !DILocation(line: 3, column: 11, scope: !12)
     82 !18 = !DILocalVariable(name: "a", arg: 1, scope: !19, file: !3, line: 2, type: !4)
     83 !19 = distinct !DISubprogram(name: "f", linkageName: "_Z1fi", scope: !3, file: !3, line: 2, type: !13, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !5, retainedNodes: !20)
     84 !20 = !{!18}
     85 !21 = !DILocation(line: 2, column: 18, scope: !19, inlinedAt: !22)
     86 !22 = distinct !DILocation(line: 3, column: 23, scope: !12)
     87 !23 = !DILocation(line: 2, column: 30, scope: !19, inlinedAt: !22)
     88 !24 = !DILocation(line: 3, column: 16, scope: !12)
     89