debug-names-name-collisions.ll 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ; REQUIRES: object-emission
  2. ; RUN: %llc_dwarf -accel-tables=Dwarf -dwarf-linkage-names=All -filetype=obj -o %t < %s
  3. ; RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
  4. ; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck --check-prefix=VERIFY %s
  5. ; Generated from the following C code using
  6. ; clang -S -emit-llvm col.cc
  7. ;
  8. ; namespace foo { struct foo {}; struct foo foo; }
  9. ; namespace bar { struct bar {}; struct bar bar; }
  10. ; namespace baz { struct baz {}; struct baz baz; }
  11. ; We have 6 names: foo, bar, baz and three mangled names of the variables.
  12. ; CHECK: Name count: 6
  13. ; Check that all the names are present in the output correct number of times.
  14. ; CHECK: String: 0x{{[0-9a-f]*}} "bar"
  15. ; CHECK-DAG: Tag: DW_TAG_namespace
  16. ; CHECK-DAG: Tag: DW_TAG_variable
  17. ; CHECK-DAG: Tag: DW_TAG_structure_type
  18. ; CHECK: String: 0x{{[0-9a-f]*}} "baz"
  19. ; CHECK-DAG: Tag: DW_TAG_namespace
  20. ; CHECK-DAG: Tag: DW_TAG_variable
  21. ; CHECK-DAG: Tag: DW_TAG_structure_type
  22. ; CHECK: String: 0x{{[0-9a-f]*}} "foo"
  23. ; CHECK-DAG: Tag: DW_TAG_namespace
  24. ; CHECK-DAG: Tag: DW_TAG_variable
  25. ; CHECK-DAG: Tag: DW_TAG_structure_type
  26. ; CHECK: String: 0x{{[0-9a-f]*}} "_ZN3foo3fooE"
  27. ; CHECK: Tag: DW_TAG_variable
  28. ; CHECK: String: 0x{{[0-9a-f]*}} "_ZN3bar3barE"
  29. ; CHECK: Tag: DW_TAG_variable
  30. ; CHECK: String: 0x{{[0-9a-f]*}} "_ZN3baz3bazE"
  31. ; CHECK: Tag: DW_TAG_variable
  32. ; VERIFY: No errors.
  33. %"struct.foo::foo" = type { i8 }
  34. %"struct.bar::bar" = type { i8 }
  35. %"struct.baz::baz" = type { i8 }
  36. @_ZN3foo3fooE = dso_local global %"struct.foo::foo" zeroinitializer, align 1, !dbg !0
  37. @_ZN3bar3barE = dso_local global %"struct.bar::bar" zeroinitializer, align 1, !dbg !6
  38. @_ZN3baz3bazE = dso_local global %"struct.baz::baz" zeroinitializer, align 1, !dbg !10
  39. !llvm.dbg.cu = !{!14}
  40. !llvm.module.flags = !{!16, !17, !18}
  41. !llvm.ident = !{!19}
  42. !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
  43. !1 = distinct !DIGlobalVariable(name: "foo", linkageName: "_ZN3foo3fooE", scope: !2, file: !3, line: 1, type: !4, isLocal: false, isDefinition: true)
  44. !2 = !DINamespace(name: "foo", scope: null)
  45. !3 = !DIFile(filename: "/tmp/col.cc", directory: "/tmp")
  46. !4 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo", scope: !2, file: !3, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !5, identifier: "_ZTSN3foo3fooE")
  47. !5 = !{}
  48. !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
  49. !7 = distinct !DIGlobalVariable(name: "bar", linkageName: "_ZN3bar3barE", scope: !8, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true)
  50. !8 = !DINamespace(name: "bar", scope: null)
  51. !9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "bar", scope: !8, file: !3, line: 2, size: 8, flags: DIFlagTypePassByValue, elements: !5, identifier: "_ZTSN3bar3barE")
  52. !10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression())
  53. !11 = distinct !DIGlobalVariable(name: "baz", linkageName: "_ZN3baz3bazE", scope: !12, file: !3, line: 3, type: !13, isLocal: false, isDefinition: true)
  54. !12 = !DINamespace(name: "baz", scope: null)
  55. !13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "baz", scope: !12, file: !3, line: 3, size: 8, flags: DIFlagTypePassByValue, elements: !5, identifier: "_ZTSN3baz3bazE")
  56. !14 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 (trunk 325496) (llvm/trunk 325732)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, globals: !15)
  57. !15 = !{!0, !6, !10}
  58. !16 = !{i32 2, !"Dwarf Version", i32 4}
  59. !17 = !{i32 2, !"Debug Info Version", i32 3}
  60. !18 = !{i32 1, !"wchar_size", i32 4}
  61. !19 = !{!"clang version 7.0.0 (trunk 325496) (llvm/trunk 325732)"}