xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/microsoft-abi-vftables.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -fno-rtti -triple=i386-pc-win32 -emit-llvm -o - -O1 -disable-llvm-optzns | FileCheck %s -check-prefix=NO-RTTI
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -triple=i386-pc-win32 -emit-llvm -o - -O1 -disable-llvm-optzns | FileCheck %s -check-prefix=RTTI
3*0a6a1f1dSLionel Sambuc 
4*0a6a1f1dSLionel Sambuc // RTTI-DAG: $"\01??_7S@@6B@" = comdat largest
5*0a6a1f1dSLionel Sambuc // RTTI-DAG: $"\01??_7V@@6B@" = comdat largest
6*0a6a1f1dSLionel Sambuc // RTTI-DAG: $"\01??_7W@?A@@6B@" = comdat largest
7*0a6a1f1dSLionel Sambuc 
8*0a6a1f1dSLionel Sambuc struct S {
9*0a6a1f1dSLionel Sambuc   virtual ~S();
10*0a6a1f1dSLionel Sambuc } s;
11*0a6a1f1dSLionel Sambuc 
12*0a6a1f1dSLionel Sambuc // RTTI-DAG: [[VTABLE_S:@.*]] = private unnamed_addr constant [2 x i8*] [i8* bitcast ({{.*}} @"\01??_R4S@@6B@" to i8*), i8* bitcast ({{.*}} @"\01??_GS@@UAEPAXI@Z" to i8*)], comdat($"\01??_7S@@6B@")
13*0a6a1f1dSLionel Sambuc // RTTI-DAG: @"\01??_7S@@6B@" = unnamed_addr alias getelementptr inbounds ([2 x i8*]* [[VTABLE_S]], i32 0, i32 1)
14*0a6a1f1dSLionel Sambuc 
15*0a6a1f1dSLionel Sambuc // NO-RTTI-DAG: @"\01??_7S@@6B@" = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast ({{.*}} @"\01??_GS@@UAEPAXI@Z" to i8*)]
16*0a6a1f1dSLionel Sambuc 
17*0a6a1f1dSLionel Sambuc struct __declspec(dllimport) U {
18*0a6a1f1dSLionel Sambuc   virtual ~U();
19*0a6a1f1dSLionel Sambuc } u;
20*0a6a1f1dSLionel Sambuc 
21*0a6a1f1dSLionel Sambuc // RTTI-DAG: @"\01??_7U@@6B@" = available_externally dllimport unnamed_addr constant [1 x i8*] [i8* bitcast ({{.*}} @"\01??_GU@@UAEPAXI@Z" to i8*)]
22*0a6a1f1dSLionel Sambuc 
23*0a6a1f1dSLionel Sambuc // NO-RTTI-DAG: @"\01??_7U@@6B@" = available_externally dllimport unnamed_addr constant [1 x i8*] [i8* bitcast ({{.*}} @"\01??_GU@@UAEPAXI@Z" to i8*)]
24*0a6a1f1dSLionel Sambuc 
25*0a6a1f1dSLionel Sambuc struct __declspec(dllexport) V {
26*0a6a1f1dSLionel Sambuc   virtual ~V();
27*0a6a1f1dSLionel Sambuc } v;
28*0a6a1f1dSLionel Sambuc 
29*0a6a1f1dSLionel Sambuc // RTTI-DAG: [[VTABLE_V:@.*]] = private unnamed_addr constant [2 x i8*] [i8* bitcast ({{.*}} @"\01??_R4V@@6B@" to i8*), i8* bitcast ({{.*}} @"\01??_GV@@UAEPAXI@Z" to i8*)], comdat($"\01??_7V@@6B@")
30*0a6a1f1dSLionel Sambuc // RTTI-DAG: @"\01??_7V@@6B@" = dllexport unnamed_addr alias getelementptr inbounds ([2 x i8*]* [[VTABLE_V]], i32 0, i32 1)
31*0a6a1f1dSLionel Sambuc 
32*0a6a1f1dSLionel Sambuc // NO-RTTI-DAG: @"\01??_7V@@6B@" = weak_odr dllexport unnamed_addr constant [1 x i8*] [i8* bitcast ({{.*}} @"\01??_GV@@UAEPAXI@Z" to i8*)]
33*0a6a1f1dSLionel Sambuc 
34*0a6a1f1dSLionel Sambuc namespace {
35*0a6a1f1dSLionel Sambuc struct W {
36*0a6a1f1dSLionel Sambuc   virtual ~W();
37*0a6a1f1dSLionel Sambuc } w;
38*0a6a1f1dSLionel Sambuc }
39*0a6a1f1dSLionel Sambuc // RTTI-DAG: [[VTABLE_W:@.*]] = private unnamed_addr constant [2 x i8*] [i8* bitcast ({{.*}} @"\01??_R4W@?A@@6B@" to i8*), i8* bitcast ({{.*}} @"\01??_GW@?A@@UAEPAXI@Z" to i8*)], comdat($"\01??_7W@?A@@6B@")
40*0a6a1f1dSLionel Sambuc // RTTI-DAG: @"\01??_7W@?A@@6B@" = internal unnamed_addr alias getelementptr inbounds ([2 x i8*]* @1, i32 0, i32 1)
41*0a6a1f1dSLionel Sambuc 
42*0a6a1f1dSLionel Sambuc // NO-RTTI-DAG: @"\01??_7W@?A@@6B@" = internal unnamed_addr constant [1 x i8*] [i8* bitcast ({{.*}} @"\01??_GW@?A@@UAEPAXI@Z" to i8*)]
43