From e74408615c1905ff95680c45d5869948d13f45ae Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Fri, 18 Oct 2024 18:28:39 -0700 Subject: [PATCH] [CIR][CIRGen] Add missing testcase for null base class Forgot to git add in cb0cb34b7d6a8fa22e6ca54b6f9783dbf938d271 --- clang/test/CIR/CodeGen/const-baseclass.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 clang/test/CIR/CodeGen/const-baseclass.cpp diff --git a/clang/test/CIR/CodeGen/const-baseclass.cpp b/clang/test/CIR/CodeGen/const-baseclass.cpp new file mode 100644 index 000000000000..5f2669bfe23f --- /dev/null +++ b/clang/test/CIR/CodeGen/const-baseclass.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s + +struct Empty { }; +struct A { +}; + +struct B : A, Empty { + B() : A(), Empty() { } +}; + +void f() { + B b1; +} + +// CHECK-LABEL: @_ZN1BC2Ev +// CHECK: %[[A:.*]] = cir.base_class_addr({{.*}}) [0] -> !cir.ptr +// CHECK: cir.call @_ZN1AC2Ev(%[[A:.*]]) : (!cir.ptr) -> () +// CHECK: %[[BASE:.*]] = cir.base_class_addr({{.*}}) [0] -> !cir.ptr +// CHECK: cir.call @_ZN5EmptyC2Ev(%[[BASE]]) : (!cir.ptr) -> () \ No newline at end of file