[cfe-commits] r140499 - /cfe/trunk/lib/CodeGen/CGVTT.cpp

Peter Collingbourne peter at pcc.me.uk
Sun Sep 25 18:56:10 PDT 2011


Author: pcc
Date: Sun Sep 25 20:56:10 2011
New Revision: 140499

URL: http://llvm.org/viewvc/llvm-project?rev=140499&view=rev
Log:
Remove CodeGenModule field from VTTBuilder

Modified:
    cfe/trunk/lib/CodeGen/CGVTT.cpp

Modified: cfe/trunk/lib/CodeGen/CGVTT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTT.cpp?rev=140499&r1=140498&r2=140499&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTT.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTT.cpp Sun Sep 25 20:56:10 2011
@@ -62,7 +62,7 @@
 /// VTT builder - Class for building VTT layout information.
 class VTTBuilder {
   
-  CodeGenModule &CGM;
+  ASTContext &Ctx;
 
   /// MostDerivedClass - The most derived class for which we're building this
   /// vtable.
@@ -140,7 +140,7 @@
   void LayoutVTT(BaseSubobject Base, bool BaseIsVirtual);
   
 public:
-  VTTBuilder(CodeGenModule &CGM, const CXXRecordDecl *MostDerivedClass,
+  VTTBuilder(ASTContext &Ctx, const CXXRecordDecl *MostDerivedClass,
              bool GenerateDefinition);
 
   // getVTTComponents - Returns a reference to the VTT components.
@@ -167,11 +167,11 @@
 
 };
 
-VTTBuilder::VTTBuilder(CodeGenModule &CGM,
+VTTBuilder::VTTBuilder(ASTContext &Ctx,
                        const CXXRecordDecl *MostDerivedClass,
                        bool GenerateDefinition)
-  : CGM(CGM), MostDerivedClass(MostDerivedClass), 
-  MostDerivedClassLayout(CGM.getContext().getASTRecordLayout(MostDerivedClass)),
+  : Ctx(Ctx), MostDerivedClass(MostDerivedClass), 
+  MostDerivedClassLayout(Ctx.getASTRecordLayout(MostDerivedClass)),
     GenerateDefinition(GenerateDefinition) {
   // Lay out this VTT.
   LayoutVTT(BaseSubobject(MostDerivedClass, CharUnits::Zero()), 
@@ -227,7 +227,7 @@
     const CXXRecordDecl *BaseDecl =
       cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
 
-    const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
+    const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(RD);
     CharUnits BaseOffset = Base.getBaseOffset() + 
       Layout.getBaseClassOffset(BaseDecl);
    
@@ -275,7 +275,7 @@
       BaseOffset = MostDerivedClassLayout.getVBaseClassOffset(BaseDecl);
       BaseDeclIsMorallyVirtual = true;
     } else {
-      const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
+      const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(RD);
       
       BaseOffset = Base.getBaseOffset() + 
         Layout.getBaseClassOffset(BaseDecl);
@@ -379,7 +379,7 @@
 CodeGenVTables::EmitVTTDefinition(llvm::GlobalVariable *VTT,
                                   llvm::GlobalVariable::LinkageTypes Linkage,
                                   const CXXRecordDecl *RD) {
-  VTTBuilder Builder(CGM, RD, /*GenerateDefinition=*/true);
+  VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/true);
 
   llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext()),
              *Int64Ty = llvm::Type::getInt64Ty(CGM.getLLVMContext());
@@ -445,7 +445,7 @@
 
   ComputeVTableRelatedInformation(RD, /*VTableRequired=*/true);
 
-  VTTBuilder Builder(CGM, RD, /*GenerateDefinition=*/false);
+  VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/false);
 
   llvm::Type *Int8PtrTy = 
     llvm::Type::getInt8PtrTy(CGM.getLLVMContext());
@@ -485,7 +485,7 @@
   if (I != SubVTTIndicies.end())
     return I->second;
   
-  VTTBuilder Builder(CGM, RD, /*GenerateDefinition=*/false);
+  VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/false);
 
   for (llvm::DenseMap<BaseSubobject, uint64_t>::const_iterator I =
        Builder.getSubVTTIndicies().begin(), 
@@ -511,7 +511,7 @@
   if (I != SecondaryVirtualPointerIndices.end())
     return I->second;
 
-  VTTBuilder Builder(CGM, RD, /*GenerateDefinition=*/false);
+  VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/false);
 
   // Insert all secondary vpointer indices.
   for (llvm::DenseMap<BaseSubobject, uint64_t>::const_iterator I = 





More information about the cfe-commits mailing list