1*67e74705SXin Li // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s
2*67e74705SXin Li
3*67e74705SXin Li struct C {
4*67e74705SXin Li void member_function();
5*67e74705SXin Li static int static_member_function();
6*67e74705SXin Li static int static_member_variable;
7*67e74705SXin Li };
8*67e74705SXin Li
9*67e74705SXin Li int C::static_member_variable = 0;
10*67e74705SXin Li
member_function()11*67e74705SXin Li void C::member_function() { static_member_variable = 0; }
12*67e74705SXin Li
static_member_function()13*67e74705SXin Li int C::static_member_function() { return static_member_variable; }
14*67e74705SXin Li
15*67e74705SXin Li C global_variable;
16*67e74705SXin Li
global_function()17*67e74705SXin Li int global_function() { return -1; }
18*67e74705SXin Li
19*67e74705SXin Li namespace ns {
global_namespace_function()20*67e74705SXin Li void global_namespace_function() { global_variable.member_function(); }
21*67e74705SXin Li int global_namespace_variable = 1;
22*67e74705SXin Li }
23*67e74705SXin Li
24*67e74705SXin Li // Check that the functions that belong to C have C as a context and the
25*67e74705SXin Li // functions that belong to the namespace have it as a context, and the global
26*67e74705SXin Li // function has the file as a context.
27*67e74705SXin Li
28*67e74705SXin Li // CHECK: ![[FILE:[0-9]+]] = !DIFile(filename: "{{.*}}context.cpp",
29*67e74705SXin Li // CHECK: ![[C:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C",
30*67e74705SXin Li // CHECK: ![[NS:.*]] = !DINamespace(name: "ns"
31*67e74705SXin Li // CHECK: !DISubprogram(name: "member_function",{{.*}} scope: ![[C]],{{.*}} isDefinition: true
32*67e74705SXin Li
33*67e74705SXin Li // CHECK: !DISubprogram(name: "static_member_function",{{.*}} scope: ![[C]],{{.*}} isDefinition: true
34*67e74705SXin Li
35*67e74705SXin Li // CHECK: !DISubprogram(name: "global_function",{{.*}} scope: ![[FILE]],{{.*}} isDefinition: true
36*67e74705SXin Li
37*67e74705SXin Li // CHECK: !DISubprogram(name: "global_namespace_function",{{.*}} scope: ![[NS]],{{.*}} isDefinition: true
38