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() {
961961void CIRRecordLowering::accumulateBases () {
962962 // If we've got a primary virtual base, we need to add it with the bases.
963963 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));
966967 }
967968
968969 // Accumulate the non-virtual bases.
Original file line number Diff line number Diff line change 55// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
66// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
77
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.
831struct A {
932 int a;
1033};
You can’t perform that action at this time.
0 commit comments