[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / vtable-consteval.cpp
blob1454f6fde357d42154169f657f9a5418867a1ccb
1 // RUN: %clang_cc1 -std=c++20 %s -emit-llvm -o - -triple x86_64-linux | FileCheck %s --check-prefix=ITANIUM --implicit-check-not=DoNotEmit
2 // RUN: %clang_cc1 -std=c++20 %s -emit-llvm -o - -triple x86_64-windows | FileCheck %s --check-prefix=MSABI --implicit-check-not=DoNotEmit
4 // FIXME: The MSVC ABI rule in use here was discussed with MS folks prior to
5 // them implementing virtual consteval functions, but we do not know for sure
6 // if this is the ABI rule they will use.
8 // ITANIUM-DAG: @_ZTV1A = {{.*}} constant { [2 x ptr] } {{.*}} null, {{.*}} @_ZTI1A
9 // MSABI-DAG: @[[A_VFTABLE:.*]] = {{.*}} constant { [1 x ptr] } {{.*}} @"??_R4A@@6B@"
10 struct A {
11 virtual consteval void DoNotEmit_f() {}
13 // ITANIUM-DAG: @a = {{.*}}global %struct.A { {{.*}} @_ZTV1A,
14 // MSABI-DAG: @"?a@@3UA@@A" = {{.*}}global %struct.A { ptr @"??_7A@@6B@" }
15 A a;
17 // ITANIUM-DAG: @_ZTV1B = {{.*}} constant { [4 x ptr] } {{.*}} null, ptr @_ZTI1B, ptr @_ZN1B1fEv, ptr @_ZN1B1hEv
18 // MSABI-DAG: @[[B_VFTABLE:.*]] = {{.*}} constant { [3 x ptr] } {{.*}} @"??_R4B@@6B@", ptr @"?f@B@@UEAAXXZ", ptr @"?h@B@@UEAAXXZ"
19 struct B {
20 virtual void f() {}
21 virtual consteval void DoNotEmit_g() {}
22 virtual void h() {}
24 // ITANIUM-DAG: @b = {{.*}}global %struct.B { {{.*}} @_ZTV1B,
25 // MSABI-DAG: @"?b@@3UB@@A" = {{.*}}global %struct.B { ptr @"??_7B@@6B@" }
26 B b;
28 // ITANIUM-DAG: @_ZTV1C = {{.*}} constant { [4 x ptr] } {{.*}} null, ptr @_ZTI1C, ptr @_ZN1CD1Ev, ptr @_ZN1CD0Ev
29 // MSABI-DAG: @[[C_VFTABLE:.*]] = {{.*}} constant { [2 x ptr] } {{.*}} @"??_R4C@@6B@", ptr @"??_GC@@UEAAPEAXI@Z"
30 struct C {
31 virtual ~C() = default;
32 virtual consteval C &operator=(const C&) = default;
34 // ITANIUM-DAG: @c = {{.*}}global %struct.C { {{.*}} @_ZTV1C,
35 // MSABI-DAG: @"?c@@3UC@@A" = {{.*}}global %struct.C { ptr @"??_7C@@6B@" }
36 C c;
38 // ITANIUM-DAG: @_ZTV1D = {{.*}} constant { [4 x ptr] } {{.*}} null, ptr @_ZTI1D, ptr @_ZN1DD1Ev, ptr @_ZN1DD0Ev
39 // MSABI-DAG: @[[D_VFTABLE:.*]] = {{.*}} constant { [2 x ptr] } {{.*}} @"??_R4D@@6B@", ptr @"??_GD@@UEAAPEAXI@Z"
40 struct D : C {};
41 // ITANIUM-DAG: @d = {{.*}}global { ptr } { {{.*}} @_ZTV1D,
42 // MSABI-DAG: @"?d@@3UD@@A" = {{.*}}global { ptr } { ptr @"??_7D@@6B@" }
43 D d;
45 // ITANIUM-DAG: @_ZTV1E = {{.*}} constant { [3 x ptr] } {{.*}} null, ptr @_ZTI1E, ptr @_ZN1E1fEv
46 // MSABI-DAG: @[[E_VFTABLE:.*]] = {{.*}} constant { [2 x ptr] } {{.*}} @"??_R4E@@6B@", ptr @"?f@E@@UEAAXXZ"
47 struct E { virtual void f() {} };
48 // ITANIUM-DAG: @e = {{.*}}global %struct.E { {{.*}} @_ZTV1E,
49 // MSABI-DAG: @"?e@@3UE@@A" = {{.*}}global %struct.E { ptr @"??_7E@@6B@" }
50 E e;
52 // ITANIUM-DAG: @_ZTV1F = {{.*}} constant { [3 x ptr] } {{.*}} null, ptr @_ZTI1F, ptr @_ZN1E1fEv
53 // MSABI-DAG: @[[F_VFTABLE:.*]] = {{.*}} constant { [2 x ptr] } {{.*}} @"??_R4F@@6B@", ptr @"?f@E@@UEAAXXZ"
54 struct F : E { virtual consteval void DoNotEmit_g(); };
55 // ITANIUM-DAG: @f = {{.*}}global { ptr } { {{.*}} @_ZTV1F,
56 // MSABI-DAG: @"?f@@3UF@@A" = {{.*}}global { ptr } { ptr @"??_7F@@6B@" }
57 F f;
59 // MSABI-DAG: @"??_7A@@6B@" = {{.*}} alias {{.*}} @[[A_VFTABLE]],
60 // MSABI-DAG: @"??_7B@@6B@" = {{.*}} alias {{.*}} @[[B_VFTABLE]],
61 // MSABI-DAG: @"??_7C@@6B@" = {{.*}} alias {{.*}} @[[C_VFTABLE]],
62 // MSABI-DAG: @"??_7D@@6B@" = {{.*}} alias {{.*}} @[[D_VFTABLE]],
63 // MSABI-DAG: @"??_7E@@6B@" = {{.*}} alias {{.*}} @[[E_VFTABLE]],
64 // MSABI-DAG: @"??_7F@@6B@" = {{.*}} alias {{.*}} @[[F_VFTABLE]],