File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -961,8 +961,9 @@ void CIRRecordLowering::computeVolatileBitfields() {
961
961
void CIRRecordLowering::accumulateBases () {
962
962
// If we've got a primary virtual base, we need to add it with the bases.
963
963
if (astRecordLayout.isPrimaryBaseVirtual ()) {
964
- cirGenTypes.getCGModule ().errorNYI (recordDecl->getSourceRange (),
965
- " accumulateBases: primary virtual base" );
964
+ const CXXRecordDecl *baseDecl = astRecordLayout.getPrimaryBase ();
965
+ members.push_back (MemberInfo (CharUnits::Zero (), MemberInfo::InfoKind::Base,
966
+ getStorageType (baseDecl), baseDecl));
966
967
}
967
968
968
969
// Accumulate the non-virtual bases.
Original file line number Diff line number Diff line change 5
5
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
6
6
// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
7
7
8
+ // Test the record layout for a class with a primary virtual base.
9
+ class Base {
10
+ public:
11
+ virtual void f ();
12
+ };
13
+
14
+ class Derived : public virtual Base {};
15
+
16
+ // This is just here to force the record types to be emitted.
17
+ void f () {
18
+ Derived d;
19
+ }
20
+
21
+ // CIR: !rec_Base = !cir.record<class "Base" {!cir.vptr}>
22
+ // CIR: !rec_Derived = !cir.record<class "Derived" {!rec_Base}>
23
+
24
+ // LLVM: %class.Derived = type { %class.Base }
25
+ // LLVM: %class.Base = type { ptr }
26
+
27
+ // OGCG: %class.Derived = type { %class.Base }
28
+ // OGCG: %class.Base = type { ptr }
29
+
30
+ // Test the constructor handling for a class with a virtual base.
8
31
struct A {
9
32
int a;
10
33
};
You can’t perform that action at this time.
0 commit comments