blob: d58f7c68887c55a8eb9cc317add96aac166cb234 [file] [log] [blame]
Eric Christopher2e3fd942013-10-17 01:31:21 +00001// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s
2
3struct C {
4 void member_function();
5 static int static_member_function();
6 static int static_member_variable;
7};
8
9int C::static_member_variable = 0;
10
11void C::member_function() { static_member_variable = 0; }
12
13int C::static_member_function() { return static_member_variable; }
14
15C global_variable;
16
17int global_function() { return -1; }
18
19namespace ns {
20void global_namespace_function() { global_variable.member_function(); }
21int global_namespace_variable = 1;
22}
23
24// Check that the functions that belong to C have C as a context and the
25// functions that belong to the namespace have it as a context, and the global
26// function has the file as a context.
27
Stephen Hines176edba2014-12-01 14:53:08 -080028// CHECK: metadata !"0x2e\00member_function\00{{.*}}", metadata !{{[0-9]+}}, metadata !"_ZTS1C"{{.*}} [ DW_TAG_subprogram ] [line 11] [def] [member_function]
Eric Christopher2e3fd942013-10-17 01:31:21 +000029
Stephen Hines176edba2014-12-01 14:53:08 -080030// CHECK: metadata !"0x2e\00static_member_function\00{{.*}}", metadata !{{[0-9]+}}, metadata !"_ZTS1C"{{.*}} [ DW_TAG_subprogram ] [line 13] [def] [static_member_function]
Eric Christopher2e3fd942013-10-17 01:31:21 +000031
Stephen Hines176edba2014-12-01 14:53:08 -080032// CHECK: metadata !"0x2e\00global_function\00{{[^,]+}}", metadata !{{[0-9]+}}, metadata [[FILE:![0-9]*]]{{.*}} [ DW_TAG_subprogram ] [line 17] [def] [global_function]
Stephen Hines6bcf27b2014-05-29 04:14:42 -070033// CHECK: [[FILE]] = {{.*}} [ DW_TAG_file_type ]
Eric Christopher2e3fd942013-10-17 01:31:21 +000034
Stephen Hines176edba2014-12-01 14:53:08 -080035// CHECK: metadata !"0x2e\00global_namespace_function\00{{[^,]+}}", metadata !{{[0-9]+}}, metadata [[NS:![0-9]*]]{{.*}} [ DW_TAG_subprogram ] [line 20] [def] [global_namespace_function]
Stephen Hines6bcf27b2014-05-29 04:14:42 -070036// CHECK: [[NS]] = {{.*}} [ DW_TAG_namespace ] [ns] [line 19]