OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. |
| 5 */ |
| 6 |
| 7 /* Test that dwarf info for method pointers is preserved after linking. |
| 8 * |
| 9 */ |
| 10 |
| 11 class TestClass { |
| 12 public: |
| 13 int foo() { return 42; } |
| 14 }; |
| 15 |
| 16 typedef int (TestClass::*method_ptr)(); |
| 17 |
| 18 __attribute__((noinline)) static int foo(TestClass *dwarf_test_method_ptr_param, |
| 19 method_ptr *mp) { |
| 20 // CHECK-DAG: (DW_TAG_formal_parameter) |
| 21 // CHECK-DAG: DW_AT_location |
| 22 // CHECK: DW_AT_name{{.*}} dwarf_test_method_ptr_param |
| 23 // CHECK-NEXT: {{.*}}DW_AT_decl_file{{.*}} : 1 |
| 24 // CHECK-NEXT: {{.*}}DW_AT_decl_line{{.*}} : 18 |
| 25 return (dwarf_test_method_ptr_param->**mp)(); |
| 26 } |
| 27 |
| 28 int caller(TestClass *my_test_param) { |
| 29 method_ptr mp = &TestClass::foo; |
| 30 return foo(my_test_param, &mp); |
| 31 } |
| 32 |
| 33 int main() { |
| 34 TestClass TC; |
| 35 int ret = caller(&TC); |
| 36 return ret; |
| 37 } |
OLD | NEW |