blob: 3de75ed3db541b6b17ec67148a7b9c238a6267fb [file] [log] [blame]
Anders Carlssonf89e0422011-01-23 21:07:30 +00001// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
2
3namespace 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
15namespace 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 Carlsson1679f5a2011-01-29 03:52:01 +000026
27namespace 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 Carlsson268ab8c2011-01-29 05:04:11 +000039
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 Carlsson1679f5a2011-01-29 03:52:01 +000051}