[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGenCXX / microsoft-abi-this-nullable.cpp
blobe0523f4cf4d1e0abed786f82c54d259d70c7b651
1 // RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 | FileCheck %s
2 // RUN: %clang_cc1 -fno-rtti -emit-llvm %s -o - -mconstructor-aliases -triple=i386-pc-win32 -fno-delete-null-pointer-checks | FileCheck %s
4 struct Left {
5 virtual void left();
6 };
8 struct Right {
9 virtual void right();
12 struct ChildNoOverride : Left, Right {
15 struct ChildOverride : Left, Right {
16 virtual void left();
17 virtual void right();
20 extern "C" void foo(void *);
22 void call_left_no_override(ChildNoOverride *child) {
23 // CHECK: %[[CHILD:.*]] = load ptr
24 child->left();
27 void ChildOverride::left() {}
29 void call_right_no_override(ChildNoOverride *child) {
30 child->right();
31 // When calling a right base's virtual method, one needs to adjust `this` at the caller site.
33 // CHECK: %[[RIGHT_i8:.*]] = getelementptr inbounds i8, ptr %[[CHILD]], i32 4
35 // CHECK: %[[VFTABLE:.*]] = load ptr, ptr %[[RIGHT_i8]]
36 // CHECK: %[[VFUN:.*]] = getelementptr inbounds ptr, ptr %[[VFTABLE]], i64 0
39 void ChildOverride::right() {
40 foo(this);
43 void call_right_override(ChildOverride *child) {
44 child->right();
45 // Ensure that `nonnull` and `dereferenceable(N)` are not emitted whether or not null is valid
47 // CHECK: %[[RIGHT:.*]] = getelementptr inbounds i8, ptr %[[CHILD]], i32 4
48 // CHECK: %[[VFUN_VALUE:.*]] = load ptr, ptr %[[VFUN]]
49 // CHECK: call x86_thiscallcc void %[[VFUN_VALUE]](ptr noundef %[[RIGHT]])