[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / apple-kext-indirect-call-2.cpp
blob125cb699a8971013dffb6968a9376c3c48680b6c
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fapple-kext -fno-rtti -emit-llvm -o - %s | FileCheck %s
3 // CHECK: @_ZTV1A ={{.*}} unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr null, ptr @_ZNK1A3abcEv, ptr null] }
4 // CHECK: @_ZTV4Base ={{.*}} unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr null, ptr @_ZNK4Base3abcEv, ptr null] }
5 // CHECK: @_ZTV8Derived2 ={{.*}} unnamed_addr constant { [5 x ptr] } { [5 x ptr] [ptr null, ptr null, ptr null, ptr @_ZNK8Derived23efgEv, ptr null] }
6 // CHECK: @_ZTV2D2 ={{.*}} unnamed_addr constant { [5 x ptr] } { [5 x ptr] [ptr null, ptr null, ptr null, ptr @_ZNK2D23abcEv, ptr null] }
8 struct A {
9 virtual const char* abc(void) const;
12 const char* A::abc(void) const {return "A"; };
14 struct B : virtual A {
15 virtual void VF();
18 void B::VF() {}
20 void FUNC(B* p) {
21 // CHECK: [[T1:%.*]] = load ptr, ptr getelementptr inbounds (ptr, ptr @_ZTV1A, i64 2)
22 // CHECK-NEXT: [[T2:%.*]] = call noundef ptr [[T1]]
23 const char* c = p->A::abc();
27 // Test2
28 struct Base { virtual char* abc(void) const; };
30 char* Base::abc() const { return 0; }
32 struct Derived : public Base {
35 void FUNC1(Derived* p) {
36 // CHECK: [[U1:%.*]] = load ptr, ptr getelementptr inbounds (ptr, ptr @_ZTV4Base, i64 2)
37 // CHECK-NEXT: [[U2:%.*]] = call noundef ptr [[U1]]
38 char* c = p->Base::abc();
42 // Test3
43 struct Base2 { };
45 struct Derived2 : virtual Base2 {
46 virtual char* efg(void) const;
49 char* Derived2::efg(void) const { return 0; }
51 void FUNC2(Derived2* p) {
52 // CHECK: [[V1:%.*]] = load ptr, ptr getelementptr inbounds (ptr, ptr @_ZTV8Derived2, i64 3)
53 // CHECK-NEXT: [[V2:%.*]] = call noundef ptr [[V1]]
54 char* c = p->Derived2::efg();
57 // Test4
58 struct Base3 { };
60 struct D1 : virtual Base3 {
63 struct D2 : virtual Base3 {
64 virtual char *abc(void) const;
67 struct Sub : D1, D2 {
70 char* D2::abc(void) const { return 0; }
72 void FUNC3(Sub* p) {
73 // CHECK: [[W1:%.*]] = load ptr, ptr getelementptr inbounds (ptr, ptr @_ZTV2D2, i64 3)
74 // CHECK-NEXT: [[W2:%.*]] = call noundef ptr [[W1]]
75 char* c = p->D2::abc();