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 f(A * a)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 f(A * a)21 int f(A *a) { 22 // CHECK: call i32 @_ZN5Test21A1fEv 23 return a->f(); 24 } 25 } 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 f(B * b)35 int f(B *b) { 36 // CHECK: call i32 @_ZN5Test31A1fEv 37 return b->f(); 38 } 39 40 // CHECK: define i32 @_ZN5Test31fERNS_1BE f(B & b)41 int f(B &b) { 42 // CHECK: call i32 @_ZN5Test31A1fEv 43 return b.f(); 44 } 45 46 // CHECK: define i32 @_ZN5Test31fEPv f(void * v)47 int f(void *v) { 48 // CHECK: call i32 @_ZN5Test31A1fEv 49 return static_cast<B*>(v)->f(); 50 } 51 } 52