Anders Carlsson | f89e042 | 2011-01-23 21:07:30 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s |
| 2 | |
| 3 | namespace Test1 { |
| 4 | struct A { |
| 5 | virtual int f() final; |
| 6 | }; |
| 7 | |
| 8 | // CHECK: define i32 @_ZN5Test11fEPNS_1AE |
| 9 | int f(A *a) { |
| 10 | // CHECK: call i32 @_ZN5Test11A1fEv |
| 11 | return a->f(); |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | namespace Test2 { |
| 16 | struct A final { |
| 17 | virtual int f(); |
| 18 | }; |
| 19 | |
| 20 | // CHECK: define i32 @_ZN5Test21fEPNS_1AE |
| 21 | int f(A *a) { |
| 22 | // CHECK: call i32 @_ZN5Test21A1fEv |
| 23 | return a->f(); |
| 24 | } |
| 25 | } |
Anders Carlsson | 1679f5a | 2011-01-29 03:52:01 +0000 | [diff] [blame] | 26 | |
| 27 | namespace Test3 { |
| 28 | struct A { |
| 29 | virtual int f(); |
| 30 | }; |
| 31 | |
| 32 | struct B final : A { }; |
| 33 | |
| 34 | // CHECK: define i32 @_ZN5Test31fEPNS_1BE |
| 35 | int f(B *b) { |
| 36 | // CHECK: call i32 @_ZN5Test31A1fEv |
| 37 | return b->f(); |
| 38 | } |
Anders Carlsson | 268ab8c | 2011-01-29 05:04:11 +0000 | [diff] [blame] | 39 | |
| 40 | // CHECK: define i32 @_ZN5Test31fERNS_1BE |
| 41 | int f(B &b) { |
| 42 | // CHECK: call i32 @_ZN5Test31A1fEv |
| 43 | return b.f(); |
| 44 | } |
| 45 | |
| 46 | // CHECK: define i32 @_ZN5Test31fEPv |
| 47 | int f(void *v) { |
| 48 | // CHECK: call i32 @_ZN5Test31A1fEv |
| 49 | return static_cast<B*>(v)->f(); |
| 50 | } |
Anders Carlsson | 1679f5a | 2011-01-29 03:52:01 +0000 | [diff] [blame] | 51 | } |