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 @@ -913,8 +913,9 @@ void CIRRecordLowering::computeVolatileBitfields() {
913913void  CIRRecordLowering::accumulateBases () {
914914  //  If we've got a primary virtual base, we need to add it with the bases.
915915  if  (astRecordLayout.isPrimaryBaseVirtual ()) {
916-     cirGenTypes.getCGModule ().errorNYI (recordDecl->getSourceRange (),
917-                                        " accumulateBases: primary virtual base"  );
916+     const  CXXRecordDecl *baseDecl = astRecordLayout.getPrimaryBase ();
917+     members.push_back (MemberInfo (CharUnits::Zero (), MemberInfo::InfoKind::Base,
918+                                  getStorageType (baseDecl), baseDecl));
918919  }
919920
920921  //  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