annotate clang/test/CodeGenCXX/debug-info-function-context.cpp @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children 1f2b6ac9f198
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 struct C {
anatofuz
parents:
diff changeset
4 void member_function();
anatofuz
parents:
diff changeset
5 static int static_member_function();
anatofuz
parents:
diff changeset
6 static int static_member_variable;
anatofuz
parents:
diff changeset
7 };
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 int C::static_member_variable = 0;
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 void C::member_function() { static_member_variable = 0; }
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 int C::static_member_function() { return static_member_variable; }
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 C global_variable;
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 int global_function() { return -1; }
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 namespace ns {
anatofuz
parents:
diff changeset
20 void global_namespace_function() { global_variable.member_function(); }
anatofuz
parents:
diff changeset
21 int global_namespace_variable = 1;
anatofuz
parents:
diff changeset
22 }
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 // Check that the functions that belong to C have C as a context and the
anatofuz
parents:
diff changeset
25 // functions that belong to the namespace have it as a context, and the global
anatofuz
parents:
diff changeset
26 // function has the file as a context.
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 // CHECK: ![[FILE:[0-9]+]] = !DIFile(filename: "{{.*}}context.cpp",
anatofuz
parents:
diff changeset
29 // CHECK: ![[C:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C",
anatofuz
parents:
diff changeset
30 // CHECK: ![[NS:.*]] = !DINamespace(name: "ns"
anatofuz
parents:
diff changeset
31 // CHECK: !DISubprogram(name: "member_function",{{.*}} scope: ![[C]],{{.*}} DISPFlagDefinition
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 // CHECK: !DISubprogram(name: "static_member_function",{{.*}} scope: ![[C]],{{.*}} DISPFlagDefinition
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 // CHECK: !DISubprogram(name: "global_function",{{.*}} scope: ![[FILE]],{{.*}} DISPFlagDefinition
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 // CHECK: !DISubprogram(name: "global_namespace_function",{{.*}} scope: ![[NS]],{{.*}} DISPFlagDefinition