1; RUN: opt -analyze -module-debuginfo -enable-new-pm=0 < %s | FileCheck %s
2; RUN: opt -passes='print<module-debuginfo>' -disable-output 2>&1 < %s \
3; RUN:   | FileCheck %s
4
5; This is to track DebugInfoFinder's ability to find the debug info metadata,
6; in particular, properly visit different kinds of DIImportedEntities.
7
8; Derived from the following C++ snippet
9;
10; namespace s {
11;   int i;
12; }
13;
14; using s::i;
15;
16; compiled with `clang -O1 -g3 -emit-llvm -S`
17
18; CHECK: Compile unit: DW_LANG_C_plus_plus from /somewhere/source.cpp
19; CHECK: Global variable: i from /somewhere/source.cpp:2 ('_ZN1s1iE')
20; CHECK: Type: int DW_ATE_signed
21
22@_ZN1s1iE = local_unnamed_addr global i32 0, align 4, !dbg !0
23
24!llvm.dbg.cu = !{!5}
25!llvm.module.flags = !{!10, !11, !12, !13}
26!llvm.ident = !{!14}
27
28!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
29!1 = distinct !DIGlobalVariable(name: "i", linkageName: "_ZN1s1iE", scope: !2, file: !3, line: 2, type: !4, isLocal: false, isDefinition: true)
30!2 = !DINamespace(name: "s", scope: null)
31!3 = !DIFile(filename: "source.cpp", directory: "/somewhere")
32!4 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
33!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)
34!6 = !{}
35!7 = !{!0}
36!8 = !{!9}
37!9 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !1, file: !3, line: 5)
38!10 = !{i32 2, !"Dwarf Version", i32 4}
39!11 = !{i32 2, !"Debug Info Version", i32 3}
40!12 = !{i32 1, !"wchar_size", i32 4}
41!13 = !{i32 7, !"PIC Level", i32 2}
42!14 = !{!"clang version 7.0.99"}
43