Eric Christopher | 2e3fd94 | 2013-10-17 01:31:21 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -g -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s |
| 2 | |
| 3 | struct C { |
| 4 | void member_function(); |
| 5 | static int static_member_function(); |
| 6 | static int static_member_variable; |
| 7 | }; |
| 8 | |
| 9 | int C::static_member_variable = 0; |
| 10 | |
| 11 | void C::member_function() { static_member_variable = 0; } |
| 12 | |
| 13 | int C::static_member_function() { return static_member_variable; } |
| 14 | |
| 15 | C global_variable; |
| 16 | |
| 17 | int global_function() { return -1; } |
| 18 | |
| 19 | namespace ns { |
| 20 | void global_namespace_function() { global_variable.member_function(); } |
| 21 | int 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 Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame^] | 28 | // CHECK: !"0x2e\00member_function\00{{.*}}", !{{[0-9]+}}, !"_ZTS1C"{{.*}} [ DW_TAG_subprogram ] [line 11] [def] [member_function] |
Eric Christopher | 2e3fd94 | 2013-10-17 01:31:21 +0000 | [diff] [blame] | 29 | |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame^] | 30 | // CHECK: !"0x2e\00static_member_function\00{{.*}}", !{{[0-9]+}}, !"_ZTS1C"{{.*}} [ DW_TAG_subprogram ] [line 13] [def] [static_member_function] |
Eric Christopher | 2e3fd94 | 2013-10-17 01:31:21 +0000 | [diff] [blame] | 31 | |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame^] | 32 | // CHECK: !"0x2e\00global_function\00{{[^,]+}}", !{{[0-9]+}}, [[FILE:![0-9]*]]{{.*}} [ DW_TAG_subprogram ] [line 17] [def] [global_function] |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 33 | // CHECK: [[FILE]] = {{.*}} [ DW_TAG_file_type ] |
Eric Christopher | 2e3fd94 | 2013-10-17 01:31:21 +0000 | [diff] [blame] | 34 | |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame^] | 35 | // CHECK: !"0x2e\00global_namespace_function\00{{[^,]+}}", !{{[0-9]+}}, [[NS:![0-9]*]]{{.*}} [ DW_TAG_subprogram ] [line 20] [def] [global_namespace_function] |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 36 | // CHECK: [[NS]] = {{.*}} [ DW_TAG_namespace ] [ns] [line 19] |