xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/microsoft-interface.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -fms-extensions -Wno-microsoft -triple=i386-pc-windows-gnu -emit-llvm %s -o - | FileCheck %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc __interface I {
4f4a2713aSLionel Sambuc   int test() {
5f4a2713aSLionel Sambuc     return 1;
6f4a2713aSLionel Sambuc   }
7f4a2713aSLionel Sambuc };
8f4a2713aSLionel Sambuc 
9f4a2713aSLionel Sambuc struct S : I {
testS10f4a2713aSLionel Sambuc   virtual int test() override {
11f4a2713aSLionel Sambuc     return I::test();
12f4a2713aSLionel Sambuc   }
13f4a2713aSLionel Sambuc };
14f4a2713aSLionel Sambuc 
fn()15f4a2713aSLionel Sambuc int fn() {
16f4a2713aSLionel Sambuc   S s;
17f4a2713aSLionel Sambuc   return s.test();
18f4a2713aSLionel Sambuc }
19f4a2713aSLionel Sambuc 
20f4a2713aSLionel Sambuc // CHECK: @_ZTV1S = linkonce_odr unnamed_addr constant [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_ZTI1S to i8*), i8* bitcast (i32 (%struct.S*)* @_ZN1S4testEv to i8*)]
21f4a2713aSLionel Sambuc 
22f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @_Z2fnv()
23*0a6a1f1dSLionel Sambuc // CHECK:   call x86_thiscallcc void @_ZN1SC1Ev(%struct.S* %s)
24*0a6a1f1dSLionel Sambuc // CHECK:   %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc i32 @_ZN1S4testEv(%struct.S* %s)
25f4a2713aSLionel Sambuc 
26*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define linkonce_odr x86_thiscallcc void @_ZN1SC1Ev(%struct.S* %this)
27*0a6a1f1dSLionel Sambuc // CHECK:   call x86_thiscallcc void @_ZN1SC2Ev(%struct.S* %{{[.0-9A-Z_a-z]+}})
28f4a2713aSLionel Sambuc 
29*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define linkonce_odr x86_thiscallcc i32 @_ZN1S4testEv(%struct.S* %this)
30*0a6a1f1dSLionel Sambuc // CHECK:   %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc i32 @_ZN1I4testEv(%__interface.I* %{{[.0-9A-Z_a-z]+}})
31f4a2713aSLionel Sambuc 
32*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define linkonce_odr x86_thiscallcc i32 @_ZN1I4testEv(%__interface.I* %this)
33f4a2713aSLionel Sambuc // CHECK:   ret i32 1
34f4a2713aSLionel Sambuc 
35*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define linkonce_odr x86_thiscallcc void @_ZN1SC2Ev(%struct.S* %this)
36*0a6a1f1dSLionel Sambuc // CHECK:   call x86_thiscallcc void @_ZN1IC2Ev(%__interface.I* %{{[.0-9A-Z_a-z]+}})
37*0a6a1f1dSLionel Sambuc // CHECK:   store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*]* @_ZTV1S, i64 0, i64 2) to i32 (...)**), i32 (...)*** %{{[.0-9A-Z_a-z]+}}
38f4a2713aSLionel Sambuc 
39*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define linkonce_odr x86_thiscallcc void @_ZN1IC2Ev(%__interface.I* %this)
40*0a6a1f1dSLionel Sambuc // CHECK:   store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*]* @_ZTV1I, i64 0, i64 2) to i32 (...)**), i32 (...)*** %{{[.0-9A-Z_a-z]+}}
41