[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / clang / test / CodeGenCXX / debug-info-namespace.cpp
blob788588348817ec1c0c2052ce18842ce42035026f
1 // RUN: %clang_cc1 -std=c++11 -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -std=c++11 -debug-info-kind=line-tables-only -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLT %s
3 // RUN: %clang_cc1 -std=c++11 -debug-info-kind=line-directives-only -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-GMLI %s
4 // RUN: %clang_cc1 -std=c++11 -debug-info-kind=standalone -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-NOLIMIT %s
6 namespace A {
7 #line 1 "foo.cpp"
8 namespace B {
9 extern int i;
10 int f1() { return 0; }
11 void f1(int) { }
12 struct foo;
13 struct bar { };
14 typedef bar baz;
15 extern int var_decl;
16 void func_decl(void);
17 extern int var_fwd;
18 void func_fwd(void);
21 namespace A {
22 using namespace B;
25 using namespace A;
26 namespace E = A;
27 int B::i = f1();
28 int func(bool b) {
29 if (b) {
30 using namespace A::B;
31 return i;
33 using namespace A;
34 using B::foo;
35 using B::bar;
36 using B::f1;
37 using B::i;
38 using B::baz;
39 namespace X = A;
40 namespace Y = X;
41 using B::var_decl;
42 using B::func_decl;
43 using B::var_fwd;
44 using B::func_fwd;
45 return i + X::B::i + Y::B::i;
48 namespace A {
49 using B::i;
50 namespace B {
51 int var_fwd = i;
53 inline namespace I {
54 int var_i;
57 namespace {
58 int anonymous;
60 void B::func_fwd() {
61 anonymous = 0;
64 namespace C {
65 void c();
67 void C::c() {}
69 // This should work even if 'i' and 'func' were declarations & not definitions,
70 // but it doesn't yet.
72 // CHECK: [[I:![0-9]+]] = distinct !DIGlobalVariable(name: "i",{{.*}} scope: [[NS:![0-9]+]],
73 // CHECK: [[NS]] = !DINamespace(name: "B", scope: [[CTXT:![0-9]+]])
74 // CHECK: [[CTXT]] = !DINamespace(name: "A", scope: null)
75 // CHECK: [[FOOCPP:.*]] = !DIFile(filename: "foo.cpp"
76 // CHECK: [[VAR_FWD:![0-9]+]] = distinct !DIGlobalVariable(name: "var_fwd",{{.*}} scope: [[NS]],
77 // CHECK-SAME: line: 44
78 // CHECK-SAME: isDefinition: true
79 // CHECK: distinct !DIGlobalVariable(name: "var_i",{{.*}} scope: [[INLINE:![0-9]+]],
80 // CHECK: [[INLINE]] = !DINamespace(name: "I", scope: [[CTXT]], exportSymbols: true)
81 // CHECK: !DINamespace(scope: null)
82 // CHECK: [[CU:![0-9]+]] = distinct !DICompileUnit(
83 // CHECK-SAME: imports: [[MODULES:![0-9]*]]
84 // CHECK: [[MODULES]] = !{[[M1:![0-9]+]], [[M2:![0-9]+]], [[M3:![0-9]+]], [[M4:![0-9]+]]}
85 // CHECK: [[M1]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CTXT]], entity: [[NS]], file: [[FOOCPP]], line: 15)
86 // CHECK: [[M2]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CU]], entity: [[CTXT]],
87 // CHECK: [[M3]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "E", scope: [[CU]], entity: [[CTXT]], file: [[FOOCPP]], line: 19)
88 // CHECK: [[M4]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CTXT]], entity: [[I]]
89 // CHECK: [[F1:![0-9]+]] = distinct !DISubprogram(name: "f1",{{.*}} line: 4
90 // CHECK-SAME: DISPFlagDefinition
91 // CHECK: [[FUNC:![0-9]+]] = distinct !DISubprogram(name: "func",{{.*}} DISPFlagDefinition
92 // CHECK-SAME: retainedNodes: [[FUNC_NODES:![0-9]*]]
93 // CHECK: [[FUNC_NODES]] = !{[[M5:![0-9]+]], [[M6:![0-9]+]], [[M7:![0-9]+]], [[M8:![0-9]+]], [[M9:![0-9]+]], [[M10:![0-9]+]], [[M11:![0-9]+]], [[M12:![0-9]+]], [[M13:![0-9]+]], [[M14:![0-9]+]], [[M15:![0-9]+]], [[M16:![0-9]+]], [[M17:![0-9]+]]}
94 // CHECK: [[M5]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[LEX2:![0-9]+]], entity: [[NS]], file: [[FOOCPP]], line: 23)
95 // CHECK: [[LEX2]] = distinct !DILexicalBlock(scope: [[LEX1:![0-9]+]], file: [[FOOCPP]],
96 // CHECK: [[LEX1]] = distinct !DILexicalBlock(scope: [[FUNC:![0-9]+]], file: [[FOOCPP]],
97 // CHECK: [[M6]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[FUNC]], entity: [[CTXT]],
98 // CHECK: [[M7]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FOO:![0-9]+]], file: [[FOOCPP]], line: 27)
99 // CHECK: [[FOO]] = !DICompositeType(tag: DW_TAG_structure_type, name: "foo",
100 // CHECK-SAME: line: 5
101 // CHECK-SAME: DIFlagFwdDecl
102 // CHECK: [[M8]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[BAR:![0-9]+]]
103 // CHECK: [[BAR]] = !DICompositeType(tag: DW_TAG_structure_type, name: "bar",
104 // CHECK-SAME: line: 6
105 // CHECK-SAME: DIFlagFwdDecl
106 // CHECK: [[M9]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[F1]]
107 // CHECK: [[M10]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[I]]
108 // CHECK: [[M11]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[BAZ:![0-9]+]]
109 // CHECK: [[BAZ]] = !DIDerivedType(tag: DW_TAG_typedef, name: "baz", scope: [[NS]], file: [[FOOCPP]],
110 // CHECK-SAME: baseType: [[BAR]]
111 // CHECK: [[M12]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "X", scope: [[FUNC]], entity: [[CTXT]]
112 // CHECK: [[M13]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "Y", scope: [[FUNC]], entity: [[M12]]
113 // CHECK: [[M14]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[VAR_DECL:![0-9]+]]
114 // CHECK: [[VAR_DECL]] = !DIGlobalVariable(name: "var_decl", linkageName: "{{[^"]*var_decl[^"]*}}", scope: [[NS]],{{.*}} line: 8,
115 // CHECK: [[M15]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FUNC_DECL:![0-9]+]]
116 // CHECK: [[FUNC_DECL]] = !DISubprogram(name: "func_decl",
117 // CHECK-SAME: scope: [[NS]], file: [[FOOCPP]], line: 9
118 // CHECK: [[M16]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[VAR_FWD:![0-9]+]]
119 // CHECK: [[M17]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FUNC_FWD:![0-9]+]]
120 // CHECK: [[FUNC_FWD]] = distinct !DISubprogram(name: "func_fwd",{{.*}} line: 53,{{.*}} DISPFlagDefinition
121 // CHECK: distinct !DISubprogram(name: "c",{{.*}}, scope: ![[C:[0-9]+]],{{.*}}, line: 60,{{.*}} DISPFlagDefinition
122 // CHECK: ![[C]] = !DINamespace(name: "C",
124 // CHECK-GMLT: [[CU:![0-9]+]] = distinct !DICompileUnit(
125 // CHECK-GMLT-SAME: emissionKind: LineTablesOnly,
126 // CHECK-GMLT-NOT: imports:
128 // CHECK-GMLI: [[CU:![0-9]+]] = distinct !DICompileUnit(
129 // CHECK-GMLI-SAME: emissionKind: DebugDirectivesOnly,
130 // CHECK-GMLI-NOT: imports:
132 // CHECK-NOLIMIT: !DICompositeType(tag: DW_TAG_structure_type, name: "bar",{{.*}} line: 6,
133 // CHECK-NOLIMIT-NOT: DIFlagFwdDecl
134 // CHECK-NOLIMIT-SAME: ){{$}}