debuginfofinder-imported-global-variable.ll 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ; RUN: opt -analyze -module-debuginfo < %s | FileCheck %s
  2. ; This is to track DebugInfoFinder's ability to find the debug info metadata,
  3. ; in particular, properly visit different kinds of DIImportedEntit'ies.
  4. ; Derived from the following C++ snippet
  5. ;
  6. ; namespace s {
  7. ; int i;
  8. ; }
  9. ;
  10. ; using s::i;
  11. ;
  12. ; compiled with `clang -O1 -g3 -emit-llvm -S`
  13. ; CHECK: Printing analysis 'Decodes module-level debug info':
  14. ; CHECK: Compile unit: DW_LANG_C_plus_plus from /somewhere/source.cpp
  15. ; CHECK: Global variable: i from /somewhere/source.cpp:2 ('_ZN1s1iE')
  16. ; CHECK: Type: int DW_ATE_signed
  17. @_ZN1s1iE = local_unnamed_addr global i32 0, align 4, !dbg !0
  18. !llvm.dbg.cu = !{!5}
  19. !llvm.module.flags = !{!10, !11, !12, !13}
  20. !llvm.ident = !{!14}
  21. !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
  22. !1 = distinct !DIGlobalVariable(name: "i", linkageName: "_ZN1s1iE", scope: !2, file: !3, line: 2, type: !4, isLocal: false, isDefinition: true)
  23. !2 = !DINamespace(name: "s", scope: null)
  24. !3 = !DIFile(filename: "source.cpp", directory: "/somewhere")
  25. !4 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  26. !5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.99", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !6, globals: !7, imports: !8)
  27. !6 = !{}
  28. !7 = !{!0}
  29. !8 = !{!9}
  30. !9 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !1, file: !3, line: 5)
  31. !10 = !{i32 2, !"Dwarf Version", i32 4}
  32. !11 = !{i32 2, !"Debug Info Version", i32 3}
  33. !12 = !{i32 1, !"wchar_size", i32 4}
  34. !13 = !{i32 7, !"PIC Level", i32 2}
  35. !14 = !{!"clang version 7.0.99"}