1651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// RUN: %clang_cc1 -std=c++11 -fms-extensions -Wno-microsoft -triple=i386-pc-windows-gnu -emit-llvm %s -o - | FileCheck %s
2e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall
3e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall__interface I {
4e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall  int test() {
5e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall    return 1;
6e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall  }
7e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall};
8e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall
9e402e72273cde2a64fa6097c1fe93f500038675dJohn McCallstruct S : I {
10e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall  virtual int test() override {
11e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall    return I::test();
12e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall  }
13e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall};
14e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall
15e402e72273cde2a64fa6097c1fe93f500038675dJohn McCallint fn() {
16e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall  S s;
17e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall  return s.test();
18e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall}
19e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall
20e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall// 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*)]
21e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall
2293ab6bf534fb6c26563c00f28a8fc5581bb71dfdStephen Lin// CHECK-LABEL: define i32 @_Z2fnv()
23651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK:   call x86_thiscallcc void @_ZN1SC1Ev(%struct.S* %s)
24651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK:   %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc i32 @_ZN1S4testEv(%struct.S* %s)
25e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall
26651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK-LABEL: define linkonce_odr x86_thiscallcc void @_ZN1SC1Ev(%struct.S* %this)
27651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK:   call x86_thiscallcc void @_ZN1SC2Ev(%struct.S* %{{[.0-9A-Z_a-z]+}})
28e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall
29651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK-LABEL: define linkonce_odr x86_thiscallcc i32 @_ZN1S4testEv(%struct.S* %this)
30651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK:   %{{[.0-9A-Z_a-z]+}} = call x86_thiscallcc i32 @_ZN1I4testEv(%__interface.I* %{{[.0-9A-Z_a-z]+}})
31e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall
32651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK-LABEL: define linkonce_odr x86_thiscallcc void @_ZN1SC2Ev(%struct.S* %this)
33651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK:   call x86_thiscallcc void @_ZN1IC2Ev(%__interface.I* %{{[.0-9A-Z_a-z]+}})
343ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK:   store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTV1S, i64 0, i64 2) to i32 (...)**), i32 (...)*** %{{[.0-9A-Z_a-z]+}}
35e402e72273cde2a64fa6097c1fe93f500038675dJohn McCall
36651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// CHECK-LABEL: define linkonce_odr x86_thiscallcc void @_ZN1IC2Ev(%__interface.I* %this)
373ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK:   store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTV1I, i64 0, i64 2) to i32 (...)**), i32 (...)*** %{{[.0-9A-Z_a-z]+}}
380e2c34f92f00628d48968dfea096d36381f494cbStephen Hines
390e2c34f92f00628d48968dfea096d36381f494cbStephen Hines// CHECK-LABEL: define linkonce_odr x86_thiscallcc i32 @_ZN1I4testEv(%__interface.I* %this)
400e2c34f92f00628d48968dfea096d36381f494cbStephen Hines// CHECK:   ret i32 1
41